Skip to content

Commit 6744c26

Browse files
modular-magicianrileykarson
authored andcommitted
Handle bad enum values returned from the GKE API for stack_type (#7627) (#5429)
Signed-off-by: Modular Magician <[email protected]>
1 parent 2d7a7e6 commit 6744c26

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

.changelog/7627.txt

Lines changed: 3 additions & 0 deletions
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-beta/resource_container_cluster.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5056,6 +5056,13 @@ func flattenIPAllocationPolicy(c *container.Cluster, d *schema.ResourceData, con
50565056

50575057
p := c.IpAllocationPolicy
50585058

5059+
// handle older clusters that return JSON null
5060+
// corresponding to "STACK_TYPE_UNSPECIFIED" due to GKE declining to backfill
5061+
// equivalent to default_if_empty
5062+
if p.StackType == "" {
5063+
p.StackType = "IPV4"
5064+
}
5065+
50595066
return []map[string]interface{}{
50605067
{
50615068
"cluster_ipv4_cidr_block": p.ClusterIpv4CidrBlock,

0 commit comments

Comments
 (0)