Skip to content

Commit ba24e4e

Browse files
Maya Ozermx-moth
authored andcommitted
fix: Handle null input
1 parent e82cf92 commit ba24e4e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

internal/provider/resource_docker_service_structures.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,8 @@ func flattenContainerSpec(in *swarm.ContainerSpec) []interface{} {
183183
if len(in.CapabilityDrop) > 0 {
184184
m["cap_drop"] = in.CapabilityDrop
185185
}
186-
if in.Init {
187-
m["init"] = in.Init
186+
if in.Init != nil {
187+
m["init"] = *in.Init
188188
}
189189
out = append(out, m)
190190
return out
@@ -969,7 +969,8 @@ func createContainerSpec(v interface{}) (*swarm.ContainerSpec, error) {
969969
}
970970
}
971971
if value, ok := rawContainerSpec["init"]; ok {
972-
containerSpec.Init = value.(bool)
972+
v := value.(bool)
973+
containerSpec.Init = &v
973974
}
974975

975976
}

0 commit comments

Comments
 (0)