Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions argocd/schema_application_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -994,6 +994,18 @@ func applicationSetPullRequestGeneratorSchemaV0() *schema.Schema {
MaxItems: 1,
Elem: secretRefResource(),
},
"insecure": {
Type: schema.TypeBool,
Description: "A flag for checking the validity of the SCM's certificates.",
Optional: true,
},
"ca_ref": {
Type: schema.TypeList,
Description: "Reference to a ConfigMap key containing trusted CA certificates for verifying the SCM server's TLS certificate.",
Optional: true,
MaxItems: 1,
Elem: configMapRefResource(),
},
},
},
},
Expand Down Expand Up @@ -1078,3 +1090,20 @@ func secretRefResource() *schema.Resource {
},
}
}

func configMapRefResource() *schema.Resource {
return &schema.Resource{
Schema: map[string]*schema.Schema{
"key": {
Type: schema.TypeString,
Description: "Key containing information in trusted CA certs.",
Required: true,
},
"config_map_name": {
Type: schema.TypeString,
Description: "Name of the ConfigMap.",
Required: true,
},
},
}
}
13 changes: 13 additions & 0 deletions argocd/structure_application_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,14 @@ func expandApplicationSetPullRequestGeneratorGitlab(g map[string]interface{}) *a
spgg.TokenRef = expandSecretRef(v[0].(map[string]interface{}))
}

if v, ok := g["insecure"].(bool); ok {
spgg.Insecure = v
}

if v, ok := g["ca_ref"].([]interface{}); ok && len(v) > 0 {
spgg.CARef = expandConfigMapKeyRef(v[0].(map[string]interface{}))
}

return spgg
}

Expand Down Expand Up @@ -1356,6 +1364,7 @@ func flattenApplicationSetPullRequestGeneratorGitlab(prgg *application.PullReque
"api": prgg.API,
"project": prgg.Project,
"pull_request_state": prgg.PullRequestState,
"insecure": prgg.Insecure,
}

if len(prgg.Labels) > 0 {
Expand All @@ -1366,6 +1375,10 @@ func flattenApplicationSetPullRequestGeneratorGitlab(prgg *application.PullReque
g["token_ref"] = flattenSecretRef(*prgg.TokenRef)
}

if prgg.CARef != nil {
g["ca_ref"] = flattenConfigMapKeyRef(*prgg.CARef)
}

return []map[string]interface{}{g}
}

Expand Down
16 changes: 16 additions & 0 deletions argocd/structures.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ func expandSecretRef(sr map[string]interface{}) *application.SecretRef {
}
}

func expandConfigMapKeyRef(cmr map[string]interface{}) *application.ConfigMapKeyRef {
return &application.ConfigMapKeyRef{
Key: cmr["key"].(string),
ConfigMapName: cmr["config_map_name"].(string),
}
}

func flattenIntOrString(ios *intstr.IntOrString) string {
if ios == nil {
return ""
Expand Down Expand Up @@ -87,6 +94,15 @@ func flattenSecretRef(sr application.SecretRef) []map[string]interface{} {
}
}

func flattenConfigMapKeyRef(cmr application.ConfigMapKeyRef) []map[string]interface{} {
return []map[string]interface{}{
{
"key": cmr.Key,
"config_map_name": cmr.ConfigMapName,
},
}
}

func flattenSyncWindows(sws application.SyncWindows) (result []map[string]interface{}) {
for _, sw := range sws {
result = append(result, map[string]interface{}{
Expand Down
Loading