From 2a8ae40b0a96f6e65c10954d9969fa8af4abd61b Mon Sep 17 00:00:00 2001 From: Megan Bang Date: Tue, 7 Jul 2020 16:19:12 -0500 Subject: [PATCH] UseIpAliases should be true when not set and the ip_allocation_policy block is set --- .../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 072a19be4c46..68438f5e1784 100644 --- a/third_party/terraform/resources/resource_container_cluster.go.erb +++ b/third_party/terraform/resources/resource_container_cluster.go.erb @@ -2560,14 +2560,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 -%> @@ -2580,7 +2580,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 -%> @@ -2591,7 +2591,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 }