@@ -1290,6 +1290,11 @@ func TestAccResource{{.resourceClassName}}(t *testing.T) {
12901290 {{- else }}
12911291 {{- if eq $child_key "target_dn"}}
12921292 resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{getTestTargetDn $.child_targets $key $child_value false nil $child_index false}}"),
1293+ {{- else if (isInterfaceSlice $child_value)}}
1294+ resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}.#", "{{len $child_value}}"),
1295+ {{- range $index, $subvalue := $child_value}}
1296+ resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}.{{$index}}", "{{$subvalue}}"),
1297+ {{- end}}
12931298 {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
12941299 resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"),
12951300 {{- end}}
@@ -1392,9 +1397,14 @@ func TestAccResource{{.resourceClassName}}(t *testing.T) {
13921397 {{- end }}),
13931398 {{- end }}
13941399 {{- else }}
1395- {{- if eq $child_key "target_dn"}}
1400+ {{- if eq $child_key "target_dn"}}
13961401 resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{getTestTargetDn $.child_targets $key $child_value false nil $child_index false}}"),
1397- {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
1402+ {{- else if (isInterfaceSlice $child_value)}}
1403+ resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}.#", "{{len $child_value}}"),
1404+ {{- range $index, $subvalue := $child_value}}
1405+ resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}.{{$index}}", "{{$subvalue}}"),
1406+ {{- end}}
1407+ {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
13981408 resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"),
13991409 {{- end}}
14001410 {{- end}}
@@ -1496,9 +1506,14 @@ func TestAccResource{{.resourceClassName}}(t *testing.T) {
14961506 {{- end }}),
14971507 {{- end }}
14981508 {{- else }}
1499- {{- if eq $child_key "target_dn"}}
1509+ {{- if eq $child_key "target_dn"}}
15001510 resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.0.{{$child_key}}", "{{getTestTargetDn $.child_targets $key $child_value false nil 1 false}}"),
1501- {{- else}}
1511+ {{- else if (isInterfaceSlice $child_value)}}
1512+ resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.0.{{$child_key}}.#", "{{len $child_value}}"),
1513+ {{- range $index, $subvalue := $child_value}}
1514+ resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.0.{{$child_key}}.{{$index}}", "{{$subvalue}}"),
1515+ {{- end}}
1516+ {{- else}}
15021517 resource.TestCheckResourceAttr("aci_{{$.resourceName}}.test", "{{$key}}.0.{{$child_key}}", "{{$child_value}}"),
15031518 {{- end}}
15041519 {{- end}}
@@ -2508,6 +2523,12 @@ resource "aci_{{$.resourceName}}" "test" {
25082523 {{- else }}
25092524 {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil $index false}}
25102525 {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{- else if isInterfaceSlice $attributeValue}}{{- if lt 0 (len $attributeValue)}}[{{fromInterfacesToString $attributeValue}}]{{else}}[]{{end}}{{else}}"{{$attributeValue}}"{{end}}
2526+ {{- else if (isInterfaceSlice $child_value)}}
2527+ {{- if lt 0 (len $child_value)}}
2528+ {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}]
2529+ {{- else}}
2530+ {{$child_key}} = []
2531+ {{- end}}
25112532 {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
25122533 {{$child_key}} = "{{$child_value}}"
25132534 {{- end}}
@@ -2537,7 +2558,7 @@ resource "aci_{{$.resourceName}}" "test" {
25372558 {{- range $key, $value := $.resource_required}}
25382559 {{- if eq $key "target_dn" }}{{$attributeValue := getTestTargetDn $.targets $.resourceName $value true nil 0 false}}
25392560 {{$key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{- else if isInterfaceSlice $attributeValue}}{{- if lt 0 (len $attributeValue)}}[{{fromInterfacesToString $attributeValue}}]{{else}}[]{{end}}{{else}}"{{$attributeValue}}"{{end}}
2540- {{- else }}
2561+ {{- else }}
25412562 {{$key}} = "{{$value}}"
25422563 {{- end }}
25432564 {{- end}}
@@ -2610,7 +2631,13 @@ resource "aci_{{$.resourceName}}" "test" {
26102631 {{- else }}
26112632 {{- if eq $child_key "target_dn"}}{{$attributeValue := getTestTargetDn $.child_targets $key $child_value true nil 1 false}}
26122633 {{$child_key}} = {{if isReference $attributeValue}}{{$attributeValue}}{{- else if isInterfaceSlice $attributeValue}}{{- if lt 0 (len $attributeValue)}}[{{fromInterfacesToString $attributeValue}}]{{else}}[]{{end}}{{else}}"{{$attributeValue}}"{{end}}
2613- {{- else }}
2634+ {{- else if (isInterfaceSlice $child_value)}}
2635+ {{- if lt 0 (len $child_value)}}
2636+ {{$child_key}} = [{{range $index, $subvalue := $child_value}}{{if lt $index (subtract (len $child_value) 1)}}"{{$subvalue}}", {{else}}"{{$subvalue}}"{{end}}{{end}}]
2637+ {{- else}}
2638+ {{$child_key}} = []
2639+ {{- end}}
2640+ {{- else }}
26142641 {{$child_key}} = "{{$child_value}}"
26152642 {{- end}}
26162643 {{- end}}
@@ -3170,16 +3197,16 @@ resource "aci_{{$.resourceName}}" "test" {
31703197 {{- end }}{{- end }}),
31713198 {{- end }}
31723199 {{- else }}
3173- {{- if eq $child_key "target_dn"}}
3200+ {{- if eq $child_key "target_dn"}}
31743201 resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_key}}", "{{getTestTargetDn $.child_targets $key $child_value false nil $child_index false}}"),
3175- {{- else if (isInterfaceSlice $child_value)}}
3202+ {{- else if (isInterfaceSlice $child_value)}}
31763203 resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_key}}.#", "{{len $child_value}}"),
3177- {{- range $index, $subvalue := $child_value}}
3204+ {{- range $index, $subvalue := $child_value}}
31783205 resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_key}}.{{$index}}", "{{$subvalue}}"),
3179- {{- end}}
3180- {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
3206+ {{- end}}
3207+ {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
31813208 resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_key}}", "{{$child_value}}"),
3182- {{- end}}
3209+ {{- end}}
31833210 {{- end}}
31843211 {{- end}}
31853212 {{- end }}
@@ -3196,9 +3223,14 @@ resource "aci_{{$.resourceName}}" "test" {
31963223 {{- end }}),
31973224 {{- end }}
31983225 {{- else }}
3199- {{- if eq $child_key "target_dn"}}
3226+ {{- if eq $child_key "target_dn"}}
32003227 resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_index}}.{{$child_key}}", "{{getTestTargetDn $.child_targets $key $child_value false nil $child_index false}}"),
3201- {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
3228+ {{- else if (isInterfaceSlice $child_value)}}
3229+ resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_key}}.#", "{{len $child_value}}"),
3230+ {{- range $index, $subvalue := $child_value}}
3231+ resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_key}}.{{$index}}", "{{$subvalue}}"),
3232+ {{- end}}
3233+ {{- else if and (ne $child_key "deletable_child") (ne $child_key "child_required")}}
32023234 resource.TestCheckResourceAttr("{{$resourceName}}", "{{$inheritedKey}}.{{$key}}.{{$child_index}}.{{$child_key}}", "{{$child_value}}"),
32033235 {{- end}}
32043236 {{- end}}
0 commit comments