Open rem-aj opened 1 year ago
Hi @rem-aj thanks for opening this issue. Could you please provide the value of namespace_type
while updating the tags of azurerm_notification_hub
? Also, Since I could not reproduce this issue using the following tf config and steps, is it possible to provide the repro steps and terraform log to help reproduce/troubleshoot ?
provider "azurerm" {
features {}
}
terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "=3.39.0" } } } resource "azurerm_resource_group" "test" { name = "acctestRGpol-0823" location = "eastus" }
resource "azurerm_notification_hub_namespace" "test" { name = "acctestnhn-0823" resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location namespace_type = "NotificationHub" sku_name = "Free" }
resource "azurerm_notification_hub" "test" { name = "acctestnh-0823" namespace_name = azurerm_notification_hub_namespace.test.name resource_group_name = azurerm_resource_group.test.name location = azurerm_resource_group.test.location
tags = { env = "Test" } }
2. Update tags of `azurerm_notification_hub` with follows, then run `terraform apply`
tags = { env = "Test" engcontact = "test2" }
Result:
![image](https://github.com/hashicorp/terraform-provider-azurerm/assets/39109137/76c492c9-d336-4aa2-b30e-78b3a24d6f86)
Hi @sinbai here's the value of the namespace type.
"NotificationHub"
By the way this value was already there, it wasn't added as part of this change, this change was simply a tag update. I provided the error logs earlier, are you looking for something different?
Thanks!
Hi @rem-aj thanks for the reply. Per the provided error logs, It seems that the value of namespace_type
that is actually passed to the API is not "NotificationHub". So, is it possible to provide the Terraform Log to help with troubleshooting? Also, could you reproduce this issue with the tf configuration and steps I provided above?
Hi @sinbai if you observe the comments in the code, the namespace attribute is actually set to be ignored using lifecycle flag due to the github issues mentioned there which I will post again below. These issues have not been resolved, so by using ignore lifecycle we are able to workaround those specific issues.
Is there an existing issue for this?
Community Note
Terraform Version
1.0.8
AzureRM Provider Version
3.39.0
Affected Resource(s)/Data Source(s)
azurerm_notification_hub_namespace
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
The code change was one line invoking a terraform module to add a new set of tags to to common_tags variable
common_tags = merge(var.common_tags, local.project_tags_essentials)
All should have happened is that the 2 extra value tags should have been merged with common_tags variable and the notification would then contain a couple of extra tags.
Actual Behaviour
module.namespacehub.azurerm_notification_hub_namespace.hub_ns: Modifying... ╷ │ Error: creating/updating Namespace (Subscription: "XXXXXXXX" │ Resource Group Name: "UE2pscDcommon" │ Namespace Name: "ue2psc-dnotif-hub-ns"): namespaces.NamespacesClient#CreateOrUpdate: Failure responding to request: StatusCode=400 -- Original Error: autorest/azure: Service returned an error. Status=400 Code="BadRequest" Message="The JSON value could not be converted to System.Nullable`1[Microsoft.NotificationHubs.Contracts.Arm.NamespaceType]. Path: $.properties.namespaceType | LineNumber: 0 | BytePositionInLine: 69." │ │ with module.namespacehub.azurerm_notification_hub_namespace.hub_ns, │ on ../modules/namespace_hub/main.tf line 1, in resource "azurerm_notification_hub_namespace" "hub_ns": │ 1: resource "azurerm_notification_hub_namespace" "hub_ns" { │
Steps to Reproduce
Create a notification hub with a set of tags, try to append extra tags to those existing tags.
Important Factoids
No response
References
No response