Skip to content

Commit 2972dd7

Browse files
authored
kubernetes_service_account: fix image_pull_secrets crash due to empty map (#1744)
1 parent a65159c commit 2972dd7

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

kubernetes/structures.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -635,13 +635,12 @@ func flattenLabelSelectorRequirementList(l []metav1.LabelSelectorRequirement) []
635635
}
636636

637637
func flattenLocalObjectReferenceArray(in []api.LocalObjectReference) []interface{} {
638-
att := make([]interface{}, len(in))
639-
for i, v := range in {
640-
m := map[string]interface{}{}
641-
if v.Name != "" {
642-
m["name"] = v.Name
638+
att := []interface{}{}
639+
for _, v := range in {
640+
m := map[string]interface{}{
641+
"name": v.Name,
643642
}
644-
att[i] = m
643+
att = append(att, m)
645644
}
646645
return att
647646
}

0 commit comments

Comments
 (0)