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_servicebus_namespace - add support for local_auth_enabled #16268

Merged
merged 1 commit into from
Apr 7, 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
16 changes: 14 additions & 2 deletions internal/services/servicebus/servicebus_namespace_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,12 @@ func resourceServiceBusNamespace() *pluginsdk.Resource {
},
},

"local_auth_enabled": {
Type: pluginsdk.TypeBool,
Optional: true,
Default: true,
},

"default_primary_connection_string": {
Type: pluginsdk.TypeString,
Computed: true,
Expand Down Expand Up @@ -203,8 +209,9 @@ func resourceServiceBusNamespaceCreateUpdate(d *pluginsdk.ResourceData, meta int
Tier: servicebus.SkuTier(sku),
},
SBNamespaceProperties: &servicebus.SBNamespaceProperties{
ZoneRedundant: utils.Bool(d.Get("zone_redundant").(bool)),
Encryption: expandServiceBusNamespaceEncryption(d.Get("customer_managed_key").([]interface{})),
ZoneRedundant: utils.Bool(d.Get("zone_redundant").(bool)),
Encryption: expandServiceBusNamespaceEncryption(d.Get("customer_managed_key").([]interface{})),
DisableLocalAuth: utils.Bool(!d.Get("local_auth_enabled").(bool)),
},
Tags: tags.Expand(t),
}
Expand Down Expand Up @@ -281,6 +288,11 @@ func resourceServiceBusNamespaceRead(d *pluginsdk.ResourceData, meta interface{}
if customerManagedKey, err := flattenServiceBusNamespaceEncryption(properties.Encryption); err == nil {
d.Set("customer_managed_key", customerManagedKey)
}
localAuthEnabled := true
if properties.DisableLocalAuth != nil {
localAuthEnabled = !*properties.DisableLocalAuth
}
d.Set("local_auth_enabled", localAuthEnabled)
}

keys, err := clientStable.ListKeys(ctx, id.ResourceGroup, id.Name, serviceBusNamespaceDefaultAuthorizationRule)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ resource "azurerm_servicebus_namespace" "test" {
location = azurerm_resource_group.test.location
resource_group_name = azurerm_resource_group.test.name
sku = "Basic"
local_auth_enabled = false
tags = {
ENV = "Test"
}
Expand Down
2 changes: 2 additions & 0 deletions website/docs/r/servicebus_namespace.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ The following arguments are supported:

* `customer_managed_key` - (Optional) An `customer_managed_key` block as defined below.

* `local_auth_enabled` - (Optional) Whether or not SAS authentication is enabled for the Service Bus namespace. Defaults to `true`.

* `zone_redundant` - (Optional) Whether or not this resource is zone redundant. `sku` needs to be `Premium`. Defaults to `false`.

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