Skip to content

Commit

Permalink
fix(cluster): don't cast attributes when loading from state (#307)
Browse files Browse the repository at this point in the history
  • Loading branch information
onematchfox authored Jul 4, 2023
1 parent c271ff7 commit 2b0a48e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions argocd/structure_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,11 @@ func flattenClusterConfig(config application.ClusterConfig, d *schema.ResourceDa
// attributes and load them from state instead.
// See https://github.com/argoproj/argo-cd/blob/8840929187f4dd7b9d9fd908ea5085a006895507/server/cluster/cluster.go#L448-L466
if bt, ok := d.GetOk("config.0.bearer_token"); ok {
r["bearer_token"] = bt.(string)
r["bearer_token"] = bt
}

if p, ok := d.GetOk("config.0.password"); ok {
r["password"] = p.(string)
r["password"] = p
}

return []map[string]interface{}{r}
Expand All @@ -217,7 +217,7 @@ func flattenClusterConfigTLSClientConfig(tcc application.TLSClientConfig, d *sch
// the state of this attribute and load it from state instead.
// See https://github.com/argoproj/argo-cd/blob/8840929187f4dd7b9d9fd908ea5085a006895507/server/cluster/cluster.go#L448-L466
if kd, ok := d.GetOk("config.0.tls_client_config.0.key_data"); ok {
c["key_data"] = kd.(string)
c["key_data"] = kd
}

return []map[string]interface{}{c}
Expand All @@ -238,12 +238,12 @@ func flattenClusterConfigExecProviderConfig(epc *application.ExecProviderConfig,
// sensitive data. Thus, we can't track the state of these
// attributes and load them from state instead.
// See https://github.com/argoproj/argo-cd/blob/8840929187f4dd7b9d9fd908ea5085a006895507/server/cluster/cluster.go#L454-L461
if a, ok := d.GetOk("config.0.exec_provider_config.0.args"); ok {
c["args"] = a.([]string)
if args, ok := d.GetOk("config.0.exec_provider_config.0.args"); ok {
c["args"] = args
}

if a, ok := d.GetOk("config.0.exec_provider_config.0.env"); ok {
c["env"] = a.([]string)
if env, ok := d.GetOk("config.0.exec_provider_config.0.env"); ok {
c["env"] = env
}

return []map[string]interface{}{c}
Expand Down

0 comments on commit 2b0a48e

Please sign in to comment.