terraform-provider-azurerm icon indicating copy to clipboard operation
terraform-provider-azurerm copied to clipboard

`azurerm_servicebus_namespace`: `default_primary_connection_string` is `null` even though `RootManageSharedAccessKey` exists

Open isaac-s opened this issue 4 months ago • 0 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Community Note

  • Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.

Terraform Version

1.9.5

AzureRM Provider Version

4.4.0

Affected Resource(s)/Data Source(s)

azurerm_servicebus_namespace

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "4.4.0"
    }
  }
}

variable "subscription_id" {
  type = string
}

variable "resource_group" {
  type = string
}

provider "azurerm" {
  subscription_id = var.subscription_id
  features {}
}

resource "azurerm_servicebus_namespace" "test" {
  resource_group_name = var.resource_group
  location            = "westus"
  name                = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  sku                 = "Basic"
}

output "key" {
  value = nonsensitive(azurerm_servicebus_namespace.test.default_primary_connection_string)
}

Debug Output/Panic Output

(Resource created with no errors)

Expected Behaviour

The resource is created without an error, and the output shows.

Actual Behaviour

The resource is created without an error, however the output doesn't show.

When using debug output, the following appears:

{"error":{"code":"AuthorizationFailed","message":"The client 'xxxxxxxxxx' with object id 'xxxxxxxxxxx' does not have authorization to perform action 'Microsoft.ServiceBus/namespaces/authorizationRules/listKeys/action' over scope '/subscriptions/xxxxxx/resourceGroups/xxxxxx/providers/Microsoft.ServiceBus/namespaces/xxxxxxx/authorizationRules/RootManageSharedAccessKey' or the scope is invalid. If access was recently granted, please refresh your credentials."}}

It looks like this error is ignored during apply/refresh.

At the least, a warning should be emitted.

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

isaac-s avatar Oct 06 '24 15:10 isaac-s