diff --git a/azurerm/internal/services/containers/kubernetes_nodepool.go b/azurerm/internal/services/containers/kubernetes_nodepool.go index 3c1f4cc66a0f..05b8853eb2ef 100644 --- a/azurerm/internal/services/containers/kubernetes_nodepool.go +++ b/azurerm/internal/services/containers/kubernetes_nodepool.go @@ -64,6 +64,7 @@ func SchemaDefaultNodePool() *schema.Schema { "enable_node_public_ip": { Type: schema.TypeBool, Optional: true, + ForceNew: true, }, "max_count": { diff --git a/azurerm/resource_arm_kubernetes_cluster.go b/azurerm/resource_arm_kubernetes_cluster.go index de42284b4ebe..e34b11d03f51 100644 --- a/azurerm/resource_arm_kubernetes_cluster.go +++ b/azurerm/resource_arm_kubernetes_cluster.go @@ -459,6 +459,7 @@ func resourceArmKubernetesCluster() *schema.Resource { "admin_username": { Type: schema.TypeString, Required: true, + ForceNew: true, }, "admin_password": { Type: schema.TypeString, diff --git a/azurerm/resource_arm_kubernetes_cluster_other_test.go b/azurerm/resource_arm_kubernetes_cluster_other_test.go index 8dc44248542d..881d23ed81eb 100644 --- a/azurerm/resource_arm_kubernetes_cluster_other_test.go +++ b/azurerm/resource_arm_kubernetes_cluster_other_test.go @@ -296,7 +296,7 @@ func TestAccAzureRMKubernetesCluster_windowsProfile(t *testing.T) { CheckDestroy: testCheckAzureRMKubernetesClusterDestroy, Steps: []resource.TestStep{ { - Config: testAccAzureRMKubernetesCluster_windowsProfile(ri, clientId, clientSecret, location, "azureuser"), + Config: testAccAzureRMKubernetesCluster_windowsProfile(ri, clientId, clientSecret, location), Check: resource.ComposeTestCheckFunc( testCheckAzureRMKubernetesClusterExists(resourceName), resource.TestCheckResourceAttrSet(resourceName, "kube_config.0.client_key"), @@ -319,21 +319,6 @@ func TestAccAzureRMKubernetesCluster_windowsProfile(t *testing.T) { "service_principal.0.client_secret", }, }, - { - Config: testAccAzureRMKubernetesCluster_windowsProfile(ri, clientId, clientSecret, location, "ricksanchez"), - Check: resource.ComposeTestCheckFunc( - testCheckAzureRMKubernetesClusterExists(resourceName), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - ImportStateVerifyIgnore: []string{ - "windows_profile.0.admin_password", - "service_principal.0.client_secret", - }, - }, }, }) } @@ -609,7 +594,7 @@ resource "azurerm_kubernetes_cluster" "test" { `, rInt, location, rInt, rInt, version, rInt, clientId, clientSecret) } -func testAccAzureRMKubernetesCluster_windowsProfile(rInt int, clientId, clientSecret, location, username string) string { +func testAccAzureRMKubernetesCluster_windowsProfile(rInt int, clientId, clientSecret, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { name = "acctestRG-%d" @@ -631,7 +616,7 @@ resource "azurerm_kubernetes_cluster" "test" { } windows_profile { - admin_username = "%s" + admin_username = "azureuser" admin_password = "P@55W0rd1234!" } @@ -655,5 +640,5 @@ resource "azurerm_kubernetes_cluster" "test" { service_cidr = "10.10.0.0/16" } } -`, rInt, location, rInt, rInt, rInt, username, clientId, clientSecret) +`, rInt, location, rInt, rInt, rInt, clientId, clientSecret) } diff --git a/website/docs/r/kubernetes_cluster.html.markdown b/website/docs/r/kubernetes_cluster.html.markdown index 1868c5c1036c..44d15afafefa 100644 --- a/website/docs/r/kubernetes_cluster.html.markdown +++ b/website/docs/r/kubernetes_cluster.html.markdown @@ -171,7 +171,7 @@ A `agent_pool_profile` block supports the following: * `enable_auto_scaling` - (Optional) Whether to enable [auto-scaler](https://docs.microsoft.com/en-us/azure/aks/cluster-autoscaler). Note that auto scaling feature requires the that the `type` is set to `VirtualMachineScaleSets` -* `enable_node_public_ip` - (Optional) Should each node have a Public IP Address? +* `enable_node_public_ip` - (Optional) Should each node have a Public IP Address? Changing this forces a new resource to be created. * `min_count` - (Optional) Minimum number of nodes for auto-scaling.