Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

r/eventhub_namespace: deprecating kafka_enabled since this is now managed by Azure #4743

Merged
merged 1 commit into from
Oct 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions azurerm/data_source_eventhub_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
),
},
Expand Down Expand Up @@ -85,7 +84,6 @@ resource "azurerm_eventhub_namespace" "test" {
sku = "Standard"
capacity = "2"
auto_inflate_enabled = true
kafka_enabled = true
maximum_throughput_units = 20
}

Expand Down
14 changes: 7 additions & 7 deletions azurerm/resource_arm_eventhub_namespace.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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,
Expand All @@ -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),
}
Expand Down Expand Up @@ -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)
Expand Down
42 changes: 0 additions & 42 deletions azurerm/resource_arm_eventhub_namespace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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" {
Expand Down
2 changes: 2 additions & 0 deletions website/docs/guides/2.0-upgrade-guide.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 6 additions & 4 deletions website/docs/r/eventhub_namespace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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.

Expand Down