Skip to content

Commit 2b0a48e

Browse files
authored
fix(cluster): don't cast attributes when loading from state (#307)
1 parent c271ff7 commit 2b0a48e

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

argocd/structure_cluster.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,11 @@ func flattenClusterConfig(config application.ClusterConfig, d *schema.ResourceDa
195195
// attributes and load them from state instead.
196196
// See https://github.com/argoproj/argo-cd/blob/8840929187f4dd7b9d9fd908ea5085a006895507/server/cluster/cluster.go#L448-L466
197197
if bt, ok := d.GetOk("config.0.bearer_token"); ok {
198-
r["bearer_token"] = bt.(string)
198+
r["bearer_token"] = bt
199199
}
200200

201201
if p, ok := d.GetOk("config.0.password"); ok {
202-
r["password"] = p.(string)
202+
r["password"] = p
203203
}
204204

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

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

245-
if a, ok := d.GetOk("config.0.exec_provider_config.0.env"); ok {
246-
c["env"] = a.([]string)
245+
if env, ok := d.GetOk("config.0.exec_provider_config.0.env"); ok {
246+
c["env"] = env
247247
}
248248

249249
return []map[string]interface{}{c}

0 commit comments

Comments
 (0)