Skip to content

Commit

Permalink
Fix for azurerm_kubernetes_cluster InvalidLoadbalancerProfile
Browse files Browse the repository at this point in the history
  • Loading branch information
Aris van Ommeren committed Apr 19, 2020
1 parent b7ae3e2 commit edd985c
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -1266,7 +1266,7 @@ func expandKubernetesClusterNetworkProfile(input []interface{}, changeManagedIps
return &networkProfile, nil
}

func expandLoadBalancerProfile(d []interface{}, loadBalancerType string, allowToSetIpCount bool, allowToSetIpPrefixes bool, allowToSetOutboundIp bool) (*containerservice.ManagedClusterLoadBalancerProfile, error) {
func expandLoadBalancerProfile(d []interface{}, loadBalancerType string, ipCountChanges bool, ipPrefixesChanges bool, outboundIpChanges bool) (*containerservice.ManagedClusterLoadBalancerProfile, error) {
if len(d) == 0 || d[0] == nil {
return nil, nil
}
Expand All @@ -1281,6 +1281,11 @@ func expandLoadBalancerProfile(d []interface{}, loadBalancerType string, allowTo
var outboundIpPrefixes *containerservice.ManagedClusterLoadBalancerProfileOutboundIPPrefixes
var outboundIps *containerservice.ManagedClusterLoadBalancerProfileOutboundIPs

noChangesForLoadBalancerIps := !ipCountChanges && !ipPrefixesChanges && !outboundIpChanges
allowToSetIpCount := ipCountChanges || noChangesForLoadBalancerIps
allowToSetIpPrefixes := ipPrefixesChanges || noChangesForLoadBalancerIps
allowToSetOutboundIp := outboundIpChanges || noChangesForLoadBalancerIps

if ipCount := config["managed_outbound_ip_count"]; ipCount != nil && allowToSetIpCount {
if c := int32(ipCount.(int)); c > 0 {
managedOutboundIps = &containerservice.ManagedClusterLoadBalancerProfileManagedOutboundIPs{Count: &c}
Expand Down

0 comments on commit edd985c

Please sign in to comment.