From d432562ec197e8fedfb96c44f0e6442408a19aa5 Mon Sep 17 00:00:00 2001 From: megan07 Date: Wed, 8 Jul 2020 11:15:48 -0500 Subject: [PATCH] UseIpAliases should be true when not set and the ip_allocation_policy block is set (#3732) --- .../terraform/resources/resource_container_cluster.go.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/third_party/terraform/resources/resource_container_cluster.go.erb b/third_party/terraform/resources/resource_container_cluster.go.erb index 349470b37e8e..fa946f429848 100644 --- a/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/third_party/terraform/resources/resource_container_cluster.go.erb @@ -2582,14 +2582,14 @@ func expandClusterAddonsConfig(configured interface{}) *containerBeta.AddonsConf } <% unless version == 'ga' -%> -func expandIPAllocationPolicy(configured interface{}, networking_mode string) (*containerBeta.IPAllocationPolicy, error) { +func expandIPAllocationPolicy(configured interface{}, networkingMode string) (*containerBeta.IPAllocationPolicy, error) { <% else -%> func expandIPAllocationPolicy(configured interface{}) (*containerBeta.IPAllocationPolicy, error) { <% end -%> l := configured.([]interface{}) if len(l) == 0 || l[0] == nil { <% unless version == 'ga' -%> - if networking_mode == "VPC_NATIVE" { + if networkingMode == "VPC_NATIVE" { return nil, fmt.Errorf("`ip_allocation_policy` block is required for VPC_NATIVE clusters.") } <% end -%> @@ -2602,7 +2602,7 @@ func expandIPAllocationPolicy(configured interface{}) (*containerBeta.IPAllocati config := l[0].(map[string]interface{}) return &containerBeta.IPAllocationPolicy{ <% unless version == 'ga' -%> - UseIpAliases: networking_mode == "VPC_NATIVE", + UseIpAliases: networkingMode == "VPC_NATIVE" || networkingMode == "", <% else -%> UseIpAliases: true, <% end -%> @@ -2613,7 +2613,7 @@ func expandIPAllocationPolicy(configured interface{}) (*containerBeta.IPAllocati ServicesSecondaryRangeName: config["services_secondary_range_name"].(string), ForceSendFields: []string{"UseIpAliases"}, <% unless version == 'ga' -%> - UseRoutes: networking_mode == "ROUTES", + UseRoutes: networkingMode == "ROUTES", <% end -%> }, nil }