From ce70ca85888b7c0c3876b039ddabbb5176310d18 Mon Sep 17 00:00:00 2001 From: magodo Date: Wed, 10 Jun 2020 10:34:02 +0800 Subject: [PATCH] `azurerm_hdinsight_cluster` deprecate `min_instance_count` This address part of terraform-providers/terraform-provider-azurerm#7067. min_instance_count has no effect during resource creation for hdinsight cluster resource set. Besides, it actually cause plan skew if user specified it to a non-zero value. --- azurerm/helpers/azure/hdinsight.go | 3 +++ .../hdinsight/tests/hdinsight_hbase_cluster_resource_test.go | 1 - .../tests/hdinsight_interactive_query_cluster_resource_test.go | 1 - .../hdinsight/tests/hdinsight_kafka_cluster_resource_test.go | 1 - .../tests/hdinsight_ml_services_cluster_resource_test.go | 1 - .../hdinsight/tests/hdinsight_rserver_cluster_resource_test.go | 1 - .../hdinsight/tests/hdinsight_spark_cluster_resource_test.go | 1 - .../hdinsight/tests/hdinsight_storm_cluster_resource_test.go | 1 - website/docs/r/hdinsight_hadoop_cluster.html.markdown | 2 +- website/docs/r/hdinsight_hbase_cluster.html.markdown | 2 +- .../docs/r/hdinsight_interactive_query_cluster.html.markdown | 2 +- website/docs/r/hdinsight_kafka_cluster.html.markdown | 2 +- website/docs/r/hdinsight_ml_services_cluster.html.markdown | 2 +- website/docs/r/hdinsight_rserver_cluster.html.markdown | 2 +- website/docs/r/hdinsight_spark_cluster.html.markdown | 2 +- website/docs/r/hdinsight_storm_cluster.html.markdown | 2 +- 16 files changed, 11 insertions(+), 15 deletions(-) diff --git a/azurerm/helpers/azure/hdinsight.go b/azurerm/helpers/azure/hdinsight.go index ca129004101e..19c23aaaab08 100644 --- a/azurerm/helpers/azure/hdinsight.go +++ b/azurerm/helpers/azure/hdinsight.go @@ -665,10 +665,13 @@ func SchemaHDInsightNodeDefinition(schemaLocation string, definition HDInsightNo } if definition.CanSpecifyInstanceCount { + // TODO 3.0: remove this property result["min_instance_count"] = &schema.Schema{ Type: schema.TypeInt, Optional: true, ForceNew: true, + Computed: true, + Deprecated: "this has been deprecated from the API and will be removed in version 3.0 of the provider", ValidateFunc: validation.IntBetween(definition.MinInstanceCount, definition.MaxInstanceCount), } result["target_instance_count"] = &schema.Schema{ diff --git a/azurerm/internal/services/hdinsight/tests/hdinsight_hbase_cluster_resource_test.go b/azurerm/internal/services/hdinsight/tests/hdinsight_hbase_cluster_resource_test.go index ff1def15af2b..19ac97b8ae83 100644 --- a/azurerm/internal/services/hdinsight/tests/hdinsight_hbase_cluster_resource_test.go +++ b/azurerm/internal/services/hdinsight/tests/hdinsight_hbase_cluster_resource_test.go @@ -382,7 +382,6 @@ resource "azurerm_hdinsight_hbase_cluster" "import" { dynamic "worker_node" { for_each = lookup(roles.value, "worker_node", []) content { - min_instance_count = lookup(worker_node.value, "min_instance_count", null) password = lookup(worker_node.value, "password", null) ssh_keys = lookup(worker_node.value, "ssh_keys", null) subnet_id = lookup(worker_node.value, "subnet_id", null) diff --git a/azurerm/internal/services/hdinsight/tests/hdinsight_interactive_query_cluster_resource_test.go b/azurerm/internal/services/hdinsight/tests/hdinsight_interactive_query_cluster_resource_test.go index 67db177e9c21..ed26c92c393a 100644 --- a/azurerm/internal/services/hdinsight/tests/hdinsight_interactive_query_cluster_resource_test.go +++ b/azurerm/internal/services/hdinsight/tests/hdinsight_interactive_query_cluster_resource_test.go @@ -384,7 +384,6 @@ resource "azurerm_hdinsight_interactive_query_cluster" "import" { dynamic "worker_node" { for_each = lookup(roles.value, "worker_node", []) content { - min_instance_count = lookup(worker_node.value, "min_instance_count", null) password = lookup(worker_node.value, "password", null) ssh_keys = lookup(worker_node.value, "ssh_keys", null) subnet_id = lookup(worker_node.value, "subnet_id", null) diff --git a/azurerm/internal/services/hdinsight/tests/hdinsight_kafka_cluster_resource_test.go b/azurerm/internal/services/hdinsight/tests/hdinsight_kafka_cluster_resource_test.go index 435d7dd7df0d..be9e082c04c3 100644 --- a/azurerm/internal/services/hdinsight/tests/hdinsight_kafka_cluster_resource_test.go +++ b/azurerm/internal/services/hdinsight/tests/hdinsight_kafka_cluster_resource_test.go @@ -389,7 +389,6 @@ resource "azurerm_hdinsight_kafka_cluster" "import" { dynamic "worker_node" { for_each = lookup(roles.value, "worker_node", []) content { - min_instance_count = lookup(worker_node.value, "min_instance_count", null) number_of_disks_per_node = worker_node.value.number_of_disks_per_node password = lookup(worker_node.value, "password", null) ssh_keys = lookup(worker_node.value, "ssh_keys", null) diff --git a/azurerm/internal/services/hdinsight/tests/hdinsight_ml_services_cluster_resource_test.go b/azurerm/internal/services/hdinsight/tests/hdinsight_ml_services_cluster_resource_test.go index 8cd5a81ed80f..0e42059044de 100644 --- a/azurerm/internal/services/hdinsight/tests/hdinsight_ml_services_cluster_resource_test.go +++ b/azurerm/internal/services/hdinsight/tests/hdinsight_ml_services_cluster_resource_test.go @@ -334,7 +334,6 @@ resource "azurerm_hdinsight_ml_services_cluster" "import" { dynamic "worker_node" { for_each = lookup(roles.value, "worker_node", []) content { - min_instance_count = lookup(worker_node.value, "min_instance_count", null) password = lookup(worker_node.value, "password", null) ssh_keys = lookup(worker_node.value, "ssh_keys", null) subnet_id = lookup(worker_node.value, "subnet_id", null) diff --git a/azurerm/internal/services/hdinsight/tests/hdinsight_rserver_cluster_resource_test.go b/azurerm/internal/services/hdinsight/tests/hdinsight_rserver_cluster_resource_test.go index 003b122d44ec..00fbc4610350 100644 --- a/azurerm/internal/services/hdinsight/tests/hdinsight_rserver_cluster_resource_test.go +++ b/azurerm/internal/services/hdinsight/tests/hdinsight_rserver_cluster_resource_test.go @@ -334,7 +334,6 @@ resource "azurerm_hdinsight_rserver_cluster" "import" { dynamic "worker_node" { for_each = lookup(roles.value, "worker_node", []) content { - min_instance_count = lookup(worker_node.value, "min_instance_count", null) password = lookup(worker_node.value, "password", null) ssh_keys = lookup(worker_node.value, "ssh_keys", null) subnet_id = lookup(worker_node.value, "subnet_id", null) diff --git a/azurerm/internal/services/hdinsight/tests/hdinsight_spark_cluster_resource_test.go b/azurerm/internal/services/hdinsight/tests/hdinsight_spark_cluster_resource_test.go index 369e48428eff..83b76fc41748 100644 --- a/azurerm/internal/services/hdinsight/tests/hdinsight_spark_cluster_resource_test.go +++ b/azurerm/internal/services/hdinsight/tests/hdinsight_spark_cluster_resource_test.go @@ -384,7 +384,6 @@ resource "azurerm_hdinsight_spark_cluster" "import" { dynamic "worker_node" { for_each = lookup(roles.value, "worker_node", []) content { - min_instance_count = lookup(worker_node.value, "min_instance_count", null) password = lookup(worker_node.value, "password", null) ssh_keys = lookup(worker_node.value, "ssh_keys", null) subnet_id = lookup(worker_node.value, "subnet_id", null) diff --git a/azurerm/internal/services/hdinsight/tests/hdinsight_storm_cluster_resource_test.go b/azurerm/internal/services/hdinsight/tests/hdinsight_storm_cluster_resource_test.go index 18b8bdea2338..af62f1de8d98 100644 --- a/azurerm/internal/services/hdinsight/tests/hdinsight_storm_cluster_resource_test.go +++ b/azurerm/internal/services/hdinsight/tests/hdinsight_storm_cluster_resource_test.go @@ -304,7 +304,6 @@ resource "azurerm_hdinsight_storm_cluster" "import" { dynamic "worker_node" { for_each = lookup(roles.value, "worker_node", []) content { - min_instance_count = lookup(worker_node.value, "min_instance_count", null) password = lookup(worker_node.value, "password", null) ssh_keys = lookup(worker_node.value, "ssh_keys", null) subnet_id = lookup(worker_node.value, "subnet_id", null) diff --git a/website/docs/r/hdinsight_hadoop_cluster.html.markdown b/website/docs/r/hdinsight_hadoop_cluster.html.markdown index 1b34c1a67dd5..709497f4f098 100644 --- a/website/docs/r/hdinsight_hadoop_cluster.html.markdown +++ b/website/docs/r/hdinsight_hadoop_cluster.html.markdown @@ -200,7 +200,7 @@ A `worker_node` block supports the following: * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Changing this forces a new resource to be created. -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_hbase_cluster.html.markdown b/website/docs/r/hdinsight_hbase_cluster.html.markdown index 449538d3215e..7a71f426d9cf 100644 --- a/website/docs/r/hdinsight_hbase_cluster.html.markdown +++ b/website/docs/r/hdinsight_hbase_cluster.html.markdown @@ -196,7 +196,7 @@ A `worker_node` block supports the following: * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Changing this forces a new resource to be created. -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_interactive_query_cluster.html.markdown b/website/docs/r/hdinsight_interactive_query_cluster.html.markdown index e1fbd7814ab6..4750ee649b4a 100644 --- a/website/docs/r/hdinsight_interactive_query_cluster.html.markdown +++ b/website/docs/r/hdinsight_interactive_query_cluster.html.markdown @@ -199,7 +199,7 @@ A `worker_node` block supports the following: -> **NOTE:** High memory instances must be specified for the Head Node (Azure suggests a `Standard_D14_V2`). -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_kafka_cluster.html.markdown b/website/docs/r/hdinsight_kafka_cluster.html.markdown index dfc32e10286f..ee8ac2770164 100644 --- a/website/docs/r/hdinsight_kafka_cluster.html.markdown +++ b/website/docs/r/hdinsight_kafka_cluster.html.markdown @@ -199,7 +199,7 @@ A `worker_node` block supports the following: * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Changing this forces a new resource to be created. -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_ml_services_cluster.html.markdown b/website/docs/r/hdinsight_ml_services_cluster.html.markdown index 993d2066838a..4333b3106908 100644 --- a/website/docs/r/hdinsight_ml_services_cluster.html.markdown +++ b/website/docs/r/hdinsight_ml_services_cluster.html.markdown @@ -197,7 +197,7 @@ A `worker_node` block supports the following: * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Changing this forces a new resource to be created. -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_rserver_cluster.html.markdown b/website/docs/r/hdinsight_rserver_cluster.html.markdown index c28e51fa3e1d..c8923aa5cd47 100644 --- a/website/docs/r/hdinsight_rserver_cluster.html.markdown +++ b/website/docs/r/hdinsight_rserver_cluster.html.markdown @@ -195,7 +195,7 @@ A `worker_node` block supports the following: * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Changing this forces a new resource to be created. -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_spark_cluster.html.markdown b/website/docs/r/hdinsight_spark_cluster.html.markdown index 64dcd7874845..9c95b377888a 100644 --- a/website/docs/r/hdinsight_spark_cluster.html.markdown +++ b/website/docs/r/hdinsight_spark_cluster.html.markdown @@ -196,7 +196,7 @@ A `worker_node` block supports the following: * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Changing this forces a new resource to be created. -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created. diff --git a/website/docs/r/hdinsight_storm_cluster.html.markdown b/website/docs/r/hdinsight_storm_cluster.html.markdown index f66d8fd5ce2f..b5a86ffe86c8 100644 --- a/website/docs/r/hdinsight_storm_cluster.html.markdown +++ b/website/docs/r/hdinsight_storm_cluster.html.markdown @@ -182,7 +182,7 @@ A `worker_node` block supports the following: * `vm_size` - (Required) The Size of the Virtual Machine which should be used as the Worker Nodes. Changing this forces a new resource to be created. -* `min_instance_count` - (Optional) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. +* `min_instance_count` - (Optional / **Deprecated** ) The minimum number of instances which should be run for the Worker Nodes. Changing this forces a new resource to be created. * `password` - (Optional) The Password associated with the local administrator for the Worker Nodes. Changing this forces a new resource to be created.