Skip to content

Commit 2f10ead

Browse files
Handle bad enum values returned from the GKE API for stack_type (#7627) (#14208)
Signed-off-by: Modular Magician <[email protected]>
1 parent e0d4c9f commit 2f10ead

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changelog/7627.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:bug
2+
container: fixed a bug creating a diff adding a `stack_type` when GKE omitted `stackType` in API responses from older GKE clusters
3+
```

google/resource_container_cluster.go

+7
Original file line numberDiff line numberDiff line change
@@ -4491,6 +4491,13 @@ func flattenIPAllocationPolicy(c *container.Cluster, d *schema.ResourceData, con
44914491

44924492
p := c.IpAllocationPolicy
44934493

4494+
// handle older clusters that return JSON null
4495+
// corresponding to "STACK_TYPE_UNSPECIFIED" due to GKE declining to backfill
4496+
// equivalent to default_if_empty
4497+
if p.StackType == "" {
4498+
p.StackType = "IPV4"
4499+
}
4500+
44944501
return []map[string]interface{}{
44954502
{
44964503
"cluster_ipv4_cidr_block": p.ClusterIpv4CidrBlock,

0 commit comments

Comments
 (0)