Skip to content

Commit

Permalink
Merge pull request #9358 from aristosvo/aks-http-application-route-op…
Browse files Browse the repository at this point in the history
…tional

kubernetes_cluster: http_application_routing ForceNew removed
  • Loading branch information
tombuildsstuff authored Nov 18, 2020
2 parents 1de1352 + 2a78ecf commit c17da92
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 8 deletions.
2 changes: 0 additions & 2 deletions azurerm/internal/services/containers/kubernetes_addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,11 @@ func schemaKubernetesAddOnProfiles() *schema.Schema {
"http_application_routing": {
Type: schema.TypeList,
MaxItems: 1,
ForceNew: true,
Optional: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"enabled": {
Type: schema.TypeBool,
ForceNew: true,
Required: true,
},
"http_application_routing_zone_name": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var kubernetesAddOnTests = map[string]func(t *testing.T){
"addonProfileKubeDashboard": testAccAzureRMKubernetesCluster_addonProfileKubeDashboard,
"addonProfileOMS": testAccAzureRMKubernetesCluster_addonProfileOMS,
"addonProfileOMSToggle": testAccAzureRMKubernetesCluster_addonProfileOMSToggle,
"addonProfileRouting": testAccAzureRMKubernetesCluster_addonProfileRouting,
"addonProfileRouting": testAccAzureRMKubernetesCluster_addonProfileRoutingToggle,
}

func TestAccAzureRMKubernetesCluster_addonProfileAciConnectorLinux(t *testing.T) {
Expand Down Expand Up @@ -244,12 +244,12 @@ func testAccAzureRMKubernetesCluster_addonProfileOMSToggle(t *testing.T) {
})
}

func TestAccAzureRMKubernetesCluster_addonProfileRouting(t *testing.T) {
func TestAccAzureRMKubernetesCluster_addonProfileRoutingToggle(t *testing.T) {
checkIfShouldRunTestsIndividually(t)
testAccAzureRMKubernetesCluster_addonProfileRouting(t)
testAccAzureRMKubernetesCluster_addonProfileRoutingToggle(t)
}

func testAccAzureRMKubernetesCluster_addonProfileRouting(t *testing.T) {
func testAccAzureRMKubernetesCluster_addonProfileRoutingToggle(t *testing.T) {
data := acceptance.BuildTestData(t, "azurerm_kubernetes_cluster", "test")

resource.ParallelTest(t, resource.TestCase{
Expand All @@ -262,7 +262,18 @@ func testAccAzureRMKubernetesCluster_addonProfileRouting(t *testing.T) {
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMKubernetesClusterExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "addon_profile.0.http_application_routing.#", "1"),
resource.TestCheckResourceAttrSet(data.ResourceName, "addon_profile.0.http_application_routing.0.enabled"),
resource.TestCheckResourceAttr(data.ResourceName, "addon_profile.0.http_application_routing.0.enabled", "true"),
resource.TestCheckResourceAttrSet(data.ResourceName, "addon_profile.0.http_application_routing.0.http_application_routing_zone_name"),
resource.TestCheckResourceAttr(data.ResourceName, "addon_profile.0.oms_agent.#", "0"),
),
},
data.ImportStep(),
{
Config: testAccAzureRMKubernetesCluster_addonProfileRoutingConfigDisabled(data),
Check: resource.ComposeTestCheckFunc(
testCheckAzureRMKubernetesClusterExists(data.ResourceName),
resource.TestCheckResourceAttr(data.ResourceName, "addon_profile.0.http_application_routing.#", "1"),
resource.TestCheckResourceAttr(data.ResourceName, "addon_profile.0.http_application_routing.0.enabled", "false"),
resource.TestCheckResourceAttrSet(data.ResourceName, "addon_profile.0.http_application_routing.0.http_application_routing_zone_name"),
resource.TestCheckResourceAttr(data.ResourceName, "addon_profile.0.oms_agent.#", "0"),
),
Expand Down Expand Up @@ -685,6 +696,56 @@ resource "azurerm_kubernetes_cluster" "test" {
http_application_routing {
enabled = true
}
kube_dashboard {
enabled = false
}
}
identity {
type = "SystemAssigned"
}
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger, data.RandomInteger, data.RandomInteger)
}

func testAccAzureRMKubernetesCluster_addonProfileRoutingConfigDisabled(data acceptance.TestData) string {
return fmt.Sprintf(`
provider "azurerm" {
features {}
}
resource "azurerm_resource_group" "test" {
name = "acctestRG-aks-%d"
location = "%s"
}
resource "azurerm_kubernetes_cluster" "test" {
name = "acctestaks%d"
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
dns_prefix = "acctestaks%d"
linux_profile {
admin_username = "acctestuser%d"
ssh_key {
key_data = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCqaZoyiz1qbdOQ8xEf6uEu1cCwYowo5FHtsBhqLoDnnp7KUTEBN+L2NxRIfQ781rxV6Iq5jSav6b2Q8z5KiseOlvKA/RF2wqU0UPYqQviQhLmW6THTpmrv/YkUCuzxDpsH7DUDhZcwySLKVVe0Qm3+5N2Ta6UYH3lsDf9R9wTP2K/+vAnflKebuypNlmocIvakFWoZda18FOmsOoIVXQ8HWFNCuw9ZCunMSN62QGamCe3dL5cXlkgHYv7ekJE15IA9aOJcM7e90oeTqo+7HTcWfdu0qQqPWY5ujyMw/llas8tsXY85LFqRnr3gJ02bAscjc477+X+j/gkpFoN1QEmt [email protected]"
}
}
default_node_pool {
name = "default"
node_count = 1
vm_size = "Standard_DS2_v2"
}
addon_profile {
http_application_routing {
enabled = false
}
kube_dashboard {
enabled = false
}
}
identity {
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/kubernetes_cluster.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ If `enable_auto_scaling` is set to `false`, then the following fields can also b

A `http_application_routing` block supports the following:

* `enabled` (Required) Is HTTP Application Routing Enabled? Changing this forces a new resource to be created.
* `enabled` (Required) Is HTTP Application Routing Enabled?

---

Expand Down

0 comments on commit c17da92

Please sign in to comment.