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

azurerm_eventhub_namespace - fix zone_redundant property for namespace #19164

Merged
merged 1 commit into from
Nov 15, 2022
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
7 changes: 5 additions & 2 deletions internal/services/eventhub/eventhub_namespace_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func resourceEventHubNamespace() *pluginsdk.Resource {
Default: false,
},

// zone redundant is computed by service based on the availability of availability zone feature.
// for premium namespace, zone redundant is computed by service based on the availability of availability zone feature.
"zone_redundant": {
Type: pluginsdk.TypeBool,
Optional: true,
Computed: true,
ForceNew: true,
},

"dedicated_cluster_id": {
Expand Down Expand Up @@ -343,7 +345,8 @@ func resourceEventHubNamespaceCreate(d *pluginsdk.ResourceData, meta interface{}
Tags: tags.Expand(t),
}

if !features.FourPointOhBeta() {
// for premium namespace, the zone_redundant is computed based on the region, user's input will be overridden
if sku != string(namespaces.SkuNamePremium) {
parameters.Properties.ZoneRedundant = utils.Bool(d.Get("zone_redundant").(bool))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ resource "azurerm_eventhub_namespace" "test" {
resource_group_name = azurerm_resource_group.test.name
sku = "Premium"
capacity = "1"
zone_redundant = true
}
`, data.RandomInteger, data.Locations.Primary, data.RandomInteger)
}
Expand Down
2 changes: 1 addition & 1 deletion website/docs/r/eventhub_namespace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ The following arguments are supported:

* `zone_redundant` - (Optional) Specifies if the EventHub Namespace should be Zone Redundant (created across Availability Zones). Changing this forces a new resource to be created. Defaults to `false`.

~> **Note:** `zone_redundant` is computed by api based on the availability zone in each region. User's input will be overridden. It will turn into a computed property in 4.0 provider.
~> **Note:** For eventhub premium namespace, `zone_redundant` is computed by api based on the availability zone feature in each region. User's input will be overridden. Please explicitly sets the property to `true` when creating the premium namespace in a region that supports availability zone since the default value is `false` in 3.0 provider.

* `tags` - (Optional) A mapping of tags to assign to the resource.

Expand Down