Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

azurerm_kubernetes_cluster: support for the backend_pool_type property #27596

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3020,6 +3020,7 @@ resource "azurerm_kubernetes_cluster" "test" {
load_balancer_sku = "standard"
load_balancer_profile {
outbound_ip_address_ids = [azurerm_public_ip.test.id]
backend_pool_type = "NodeIP"
}
}
}
Expand Down
29 changes: 29 additions & 0 deletions internal/services/containers/kubernetes_cluster_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -1094,26 +1094,30 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
Default: 0,
ValidateFunc: validation.IntBetween(0, 64000),
},

"idle_timeout_in_minutes": {
Type: pluginsdk.TypeInt,
Optional: true,
Default: 30,
ValidateFunc: validation.IntBetween(4, 100),
},

"managed_outbound_ip_count": {
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: validation.IntBetween(1, 100),
ConflictsWith: []string{"network_profile.0.load_balancer_profile.0.outbound_ip_prefix_ids", "network_profile.0.load_balancer_profile.0.outbound_ip_address_ids"},
},

"managed_outbound_ipv6_count": {
Type: pluginsdk.TypeInt,
Optional: true,
Computed: true,
ValidateFunc: validation.IntBetween(1, 100),
ConflictsWith: []string{"network_profile.0.load_balancer_profile.0.outbound_ip_prefix_ids", "network_profile.0.load_balancer_profile.0.outbound_ip_address_ids"},
},

"outbound_ip_prefix_ids": {
Type: pluginsdk.TypeSet,
Optional: true,
Expand All @@ -1123,6 +1127,7 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
ValidateFunc: azure.ValidateResourceID,
},
},

"outbound_ip_address_ids": {
Type: pluginsdk.TypeSet,
Optional: true,
Expand All @@ -1132,13 +1137,24 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
ValidateFunc: azure.ValidateResourceID,
},
},

"effective_outbound_ips": {
Type: pluginsdk.TypeSet,
Computed: true,
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
},
},

"backend_pool_type": {
Type: pluginsdk.TypeString,
Optional: true,
Default: string(managedclusters.BackendPoolTypeNodeIPConfiguration),
ValidateFunc: validation.StringInSlice([]string{
string(managedclusters.BackendPoolTypeNodeIPConfiguration),
string(managedclusters.BackendPoolTypeNodeIP),
}, false),
},
},
},
},
Expand Down Expand Up @@ -2383,6 +2399,11 @@ func resourceKubernetesClusterUpdate(d *pluginsdk.ResourceData, meta interface{}
loadBalancerProfile.AllocatedOutboundPorts = utils.Int64(int64(allocatedOutboundPorts))
}

if key := "network_profile.0.load_balancer_profile.0.backend_pool_type"; d.HasChange(key) {
backendPoolType := d.Get(key).(string)
loadBalancerProfile.BackendPoolType = pointer.To(managedclusters.BackendPoolType(backendPoolType))
}

existing.Model.Properties.NetworkProfile.LoadBalancerProfile = &loadBalancerProfile
}

Expand Down Expand Up @@ -3628,6 +3649,10 @@ func expandLoadBalancerProfile(d []interface{}) *managedclusters.ManagedClusterL
profile.OutboundIPs = &managedclusters.ManagedClusterLoadBalancerProfileOutboundIPs{PublicIPs: outIps}
}

if backendPoolType, ok := config["backend_pool_type"].(string); ok {
profile.BackendPoolType = pointer.To(managedclusters.BackendPoolType(backendPoolType))
}

return profile
}

Expand Down Expand Up @@ -3799,6 +3824,10 @@ func flattenKubernetesClusterNetworkProfile(profile *managedclusters.ContainerSe
}
}

if v := lbp.BackendPoolType; v != nil {
lb["backend_pool_type"] = v
}

lb["effective_outbound_ips"] = resourceReferencesToIds(profile.LoadBalancerProfile.EffectiveOutboundIPs)
lbProfiles = append(lbProfiles, lb)
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ A `load_balancer_profile` block supports the following:

~> **Note:** The fields `managed_outbound_ip_count`, `outbound_ip_address_ids` and `outbound_ip_prefix_ids` are mutually exclusive. Note that when specifying `outbound_ip_address_ids` ([azurerm_public_ip](/docs/providers/azurerm/r/public_ip.html)) the SKU must be `standard`.

* `backend_pool_type` - (Optional) The type of the managed inbound Load Balancer Backend Pool. Possible values are `NodeIP` and `NodeIPConfiguration`. Defaults to `NodeIPConfiguration`. See [the documentation](https://learn.microsoft.com/en-us/azure/aks/load-balancer-standard#change-the-inbound-pool-type) for more information.

* `idle_timeout_in_minutes` - (Optional) Desired outbound flow idle timeout in minutes for the cluster load balancer. Must be between `4` and `100` inclusive. Defaults to `30`.

* `managed_outbound_ip_count` - (Optional) Count of desired managed outbound IPs for the cluster load balancer. Must be between `1` and `100` inclusive.
Expand Down
Loading