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

Notification Hub keeps applying namespace_type=notificationhub #14541

Open
adamcarter81 opened this issue Dec 8, 2021 · 2 comments
Open

Notification Hub keeps applying namespace_type=notificationhub #14541

adamcarter81 opened this issue Dec 8, 2021 · 2 comments
Labels
bug service/notifications upstream/microsoft/waiting-on-service-team This label is applicable when waiting on the Microsoft Service Team v/2.x (legacy)

Comments

@adamcarter81
Copy link

adamcarter81 commented Dec 8, 2021

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, 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

Terraform (and AzureRM Provider) Version

Terraform v1.0.11
on windows_amd64

azurerm = {
source = "hashicorp/azurerm"
version = "~>2.71.0"
}

Affected Resource(s)

azurerm_notification_hub_namespace

Terraform Configuration Files

resource "azurerm_notification_hub_namespace" "notification-hub-ns" {
for_each = var.application_environments
  name                        = join("-", ["ntfns",var.Location-short,each.value])
  location                    = azurerm_resource_group.rg.location
  resource_group_name         = azurerm_resource_group.rg.name

  namespace_type      = "notificationhub"
  sku_name            = "Basic"

  tags = {
    AppEnvironment = each.value     # application environment
    Environment = var.Production
    CreatedBy = var.CreatedBy
    MainContact = var.MainContact
    Location = var.Location-short
  }
}

Debug Output

Panic Output

Expected Behaviour

When running terraform plan after resource creation and no out of band changes have been made, it should not request to add a setting to the notification hub.

Actual Behaviour

Notification Hub Resource was imported into Terraform. Resource then deleted and created via Terraform to confirm the same behaviour. Every time a terraform plan is run, it asks to update the notification hub:

 # azurerm_notification_hub_namespace.notification-hub-ns will be updated in-place
  ~ resource "azurerm_notification_hub_namespace" "notification-hub-ns" {
        id                  = "/subscriptions/xxx/resourceGroups/rg/providers/Microsoft.NotificationHubs/namespaces/ntfns"
        name                = "ntfns"
      + namespace_type      = "notificationhub"
        tags                = {
            "AppEnvironment" = "###"
            "CreatedBy"      = "###"
            "Environment"    = "###"
            "Location"       = "###"
            "MainContact"    = "###"
        }
        # (5 unchanged attributes hidden)
    }

Inspection of the state:

terraform state show 'azurerm_notification_hub_namespace.notification-hub-ns
# azurerm_notification_hub_namespace.notification-hub-ns]:
resource "azurerm_notification_hub_namespace" "notification-hub-ns" {
    enabled             = true
    id                  = "/subscriptions/xxx/resourceGroups/rg-aks-weu-non-prod/providers/Microsoft.NotificationHubs/namespaces/ntfns"
    location            = "westeurope"
    name                = "ntfns"
    resource_group_name = "rg"
    servicebus_endpoint = "https://ntfns.servicebus.windows.net:443/"
    sku_name            = "Basic"
    tags                = {
        "AppEnvironment" = "###"
        "CreatedBy"      = "###"
        "Environment"    = "###"
        "Location"       = "###"
        "MainContact"    = "###"
    }
}

(sensitive info redacted)

Steps to Reproduce

  1. terraform apply
  2. Observe output to change resource
  3. Accept change
  4. Run terraform apply again and back to step 2
  5. Repeat

Important Factoids

References

  • #0000
@tombuildsstuff
Copy link
Contributor

As mentioned in #14828 this is an upstream API issue being tracked in Azure/azure-rest-api-specs#17277

@HaroldH76
Copy link

Workaround:

resource "azurerm_notification_hub_namespace" "myhub" {
  name                = "myhub-notification-hub-${var.environment}"
  resource_group_name = azurerm_resource_group.workspace_product.name
  location            = azurerm_resource_group.workspace_product.location
  namespace_type      = "NotificationHub"

  sku_name = var.notification_hub_sku

  lifecycle {
      ignore_changes = [
        # ignore namespace_type because of a bug in Azure: https://github.com/Azure/azure-rest-api-specs/issues/17277
        namespace_type
      ]
    }
}

@rcskosir rcskosir added v/2.x (legacy) upstream/microsoft/waiting-on-service-team This label is applicable when waiting on the Microsoft Service Team and removed upstream/microsoft Indicates that there's an upstream issue blocking this issue/PR labels Mar 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug service/notifications upstream/microsoft/waiting-on-service-team This label is applicable when waiting on the Microsoft Service Team v/2.x (legacy)
Projects
None yet
Development

No branches or pull requests

5 participants