Skip to content

Commit

Permalink
remove computed
Browse files Browse the repository at this point in the history
  • Loading branch information
ms-henglu committed Dec 17, 2021
1 parent dd5ef1a commit afd18e4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2548,6 +2548,10 @@ resource "azurerm_kubernetes_cluster" "test" {
}

func (KubernetesClusterResource) publicNetworkAccess(data acceptance.TestData, enabled bool) string {
authorizedIPConfig := ""
if !enabled {
authorizedIPConfig = `api_server_authorized_ip_ranges = ["0.0.0.0/32"]`
}
return fmt.Sprintf(`
provider "azurerm" {
features {}
Expand All @@ -2570,6 +2574,7 @@ resource "azurerm_kubernetes_cluster" "test" {
type = "SystemAssigned"
}
public_network_access_enabled = %t
%s
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, enabled)
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, enabled, authorizedIPConfig)
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func resourceKubernetesCluster() *pluginsdk.Resource {
"api_server_authorized_ip_ranges": {
Type: pluginsdk.TypeSet,
Optional: true,
Computed: true, // when public_network_access_enabled=false, api_server_authorized_ip_ranges will be set automatically
Elem: &pluginsdk.Schema{
Type: pluginsdk.TypeString,
ValidateFunc: validate.CIDR,
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 @@ -136,6 +136,8 @@ In addition, one of either `identity` or `service_principal` blocks must be spec

`public_network_access_enabled` - (Optional) Whether public network access is allowed for this Kubernetes Cluster. Defaults to `true`.

-> **Note:** When `public_network_access_enabled` is set to `true`, `0.0.0.0/32` must be added to `api_server_authorized_ip_ranges`.

```
resource "azurerm_resource_group" "example" {
name = "example"
Expand Down

0 comments on commit afd18e4

Please sign in to comment.