diff --git a/azurerm/data_source_eventhub_namespace_test.go b/azurerm/data_source_eventhub_namespace_test.go index 5d6b44d01f76..2767f11a64ee 100644 --- a/azurerm/data_source_eventhub_namespace_test.go +++ b/azurerm/data_source_eventhub_namespace_test.go @@ -42,7 +42,6 @@ func TestAccDataSourceAzureRMEventHubNamespace_complete(t *testing.T) { resource.TestCheckResourceAttr(dataSourceName, "sku", "Standard"), resource.TestCheckResourceAttr(dataSourceName, "capacity", "2"), resource.TestCheckResourceAttr(dataSourceName, "auto_inflate_enabled", "true"), - resource.TestCheckResourceAttr(dataSourceName, "kafka_enabled", "true"), resource.TestCheckResourceAttr(dataSourceName, "maximum_throughput_units", "20"), ), }, @@ -85,7 +84,6 @@ resource "azurerm_eventhub_namespace" "test" { sku = "Standard" capacity = "2" auto_inflate_enabled = true - kafka_enabled = true maximum_throughput_units = 20 } diff --git a/azurerm/resource_arm_eventhub_namespace.go b/azurerm/resource_arm_eventhub_namespace.go index 12250ecf71e7..bb2c3cdbae92 100644 --- a/azurerm/resource_arm_eventhub_namespace.go +++ b/azurerm/resource_arm_eventhub_namespace.go @@ -78,10 +78,10 @@ func resourceArmEventHubNamespace() *schema.Resource { }, "kafka_enabled": { - Type: schema.TypeBool, - Optional: true, - Default: false, - ForceNew: true, + Type: schema.TypeBool, + Optional: true, + Computed: true, + Deprecated: "This field is now automatically set depending on the SKU used - as such it's no longer used and will be removed in 2.0 of the Azure Provider", }, "maximum_throughput_units": { @@ -216,7 +216,6 @@ func resourceArmEventHubNamespaceCreateUpdate(d *schema.ResourceData, meta inter capacity := int32(d.Get("capacity").(int)) t := d.Get("tags").(map[string]interface{}) autoInflateEnabled := d.Get("auto_inflate_enabled").(bool) - kafkaEnabled := d.Get("kafka_enabled").(bool) parameters := eventhub.EHNamespace{ Location: &location, @@ -227,7 +226,6 @@ func resourceArmEventHubNamespaceCreateUpdate(d *schema.ResourceData, meta inter }, EHNamespaceProperties: &eventhub.EHNamespaceProperties{ IsAutoInflateEnabled: utils.Bool(autoInflateEnabled), - KafkaEnabled: utils.Bool(kafkaEnabled), }, Tags: tags.Expand(t), } @@ -314,8 +312,10 @@ func resourceArmEventHubNamespaceRead(d *schema.ResourceData, meta interface{}) if props := resp.EHNamespaceProperties; props != nil { d.Set("auto_inflate_enabled", props.IsAutoInflateEnabled) - d.Set("kafka_enabled", props.KafkaEnabled) d.Set("maximum_throughput_units", int(*props.MaximumThroughputUnits)) + + // TODO: remove me in 2.0 + d.Set("kafka_enabled", props.KafkaEnabled) } ruleset, err := client.GetNetworkRuleSet(ctx, resGroup, name) diff --git a/azurerm/resource_arm_eventhub_namespace_test.go b/azurerm/resource_arm_eventhub_namespace_test.go index d069a9cd2b2e..3a178842527c 100644 --- a/azurerm/resource_arm_eventhub_namespace_test.go +++ b/azurerm/resource_arm_eventhub_namespace_test.go @@ -66,31 +66,6 @@ func TestAccAzureRMEventHubNamespace_requiresImport(t *testing.T) { }) } -func TestAccAzureRMEventHubNamespace_KafkaEnabled(t *testing.T) { - resourceName := "azurerm_eventhub_namespace.test" - ri := tf.AccRandTimeInt() - - resource.ParallelTest(t, resource.TestCase{ - PreCheck: func() { testAccPreCheck(t) }, - Providers: testAccProviders, - CheckDestroy: testCheckAzureRMEventHubNamespaceDestroy, - Steps: []resource.TestStep{ - { - Config: testAccAzureRMEventHubNamespace_KafkaEnabled(ri, testLocation()), - Check: resource.ComposeTestCheckFunc( - testCheckAzureRMEventHubNamespaceExists(resourceName), - resource.TestCheckResourceAttr(resourceName, "kafka_enabled", "true"), - ), - }, - { - ResourceName: resourceName, - ImportState: true, - ImportStateVerify: true, - }, - }, - }) -} - func TestAccAzureRMEventHubNamespace_standard(t *testing.T) { resourceName := "azurerm_eventhub_namespace.test" ri := tf.AccRandTimeInt() @@ -478,23 +453,6 @@ resource "azurerm_eventhub_namespace" "import" { `, template) } -func testAccAzureRMEventHubNamespace_KafkaEnabled(rInt int, location string) string { - return fmt.Sprintf(` -resource "azurerm_resource_group" "test" { - name = "acctestRG-%d" - location = "%s" -} - -resource "azurerm_eventhub_namespace" "test" { - name = "acctesteventhubnamespace-%d" - location = "${azurerm_resource_group.test.location}" - resource_group_name = "${azurerm_resource_group.test.name}" - sku = "Standard" - kafka_enabled = true -} -`, rInt, location, rInt) -} - func testAccAzureRMEventHubNamespace_standard(rInt int, location string) string { return fmt.Sprintf(` resource "azurerm_resource_group" "test" { diff --git a/website/docs/guides/2.0-upgrade-guide.html.markdown b/website/docs/guides/2.0-upgrade-guide.html.markdown index dd34dfb2045c..8e03f29bfa1e 100644 --- a/website/docs/guides/2.0-upgrade-guide.html.markdown +++ b/website/docs/guides/2.0-upgrade-guide.html.markdown @@ -276,6 +276,8 @@ The deprecated `location` field will be removed, since this is no longer used. ## Resource: `azurerm_eventhub_namespace` +The deprecated `kafka_enabled` field will be removed, since this is no longer used. + The deprecated `location` field will be removed, since this is no longer used. ### Resource: `azurerm_firewall` diff --git a/website/docs/r/eventhub_namespace.html.markdown b/website/docs/r/eventhub_namespace.html.markdown index 4ad63327b907..9e1a44b91cb7 100644 --- a/website/docs/r/eventhub_namespace.html.markdown +++ b/website/docs/r/eventhub_namespace.html.markdown @@ -14,12 +14,12 @@ Manages an EventHub Namespace. ```hcl resource "azurerm_resource_group" "test" { - name = "resourceGroup1" - location = "West US" + name = "example-resources" + location = "West Europe" } resource "azurerm_eventhub_namespace" "test" { - name = "acceptanceTestEventHubNamespace" + name = "example-namespace" location = "${azurerm_resource_group.test.location}" resource_group_name = "${azurerm_resource_group.test.name}" sku = "Standard" @@ -49,7 +49,9 @@ The following arguments are supported: * `maximum_throughput_units` - (Optional) Specifies the maximum number of throughput units when Auto Inflate is Enabled. Valid values range from `1` - `20`. -* `kafka_enabled` - (Optional) Is Kafka enabled for the EventHub Namespace? Defaults to `false`. Changing this forces a new resource to be created. +* `kafka_enabled` - (Optional / **Deprecated**) Is Kafka enabled for the EventHub Namespace? Defaults to `false`. + +-> **NOTE:** `kafka_enabled` is now configured depending on the `sku` being provisioned, where this is Disabled for a `Basic` sku and Enabled for a Standard sku. * `tags` - (Optional) A mapping of tags to assign to the resource.