Repository: hashicorp/terraform-provider-azurerm

Issue #12061: eventhub resources keep re-applying tags since v2.61.0
Created: 2021-06-04T10:00:12Z
# module.eventhub["secondary"].azurerm_eventhub_namespace.this["test"] will be updated in-place
  ~ resource "azurerm_eventhub_namespace" "this" {
        id                                  = "/subscriptions/xxxx/resourceGroups/xxxx/providers/Microsoft.EventHub/namespaces/xxxx"
        name                                = "xxxx"
      ~ tags                                = {
          ~ "created-by"       = "terraform-azurerm-eventhub" -> "terraform"
          ~ "eai"              = "terraform-azurerm-eventhub" -> "some value"
          ~ "first"            = "terraform-azurerm-eventhub" -> "some other value"
          ~ "another value"          = "terraform-azurerm-eventhub" -> "value"
          ~ "it-owner"         = "terraform-azurerm-eventhub" -> "proper value"
          ~ "itowner"          = "terraform-azurerm-eventhub" -> "good value"
          ~ "terraform-plan"   = "terraform-azurerm-eventhub" -> "fdx-xxxs/xxxs-terraform/nonprod"
            # (1 unchanged element hidden)
        }
        # (13 unchanged attributes hidden)
        # (1 unchanged block hidden)
    }

All tags in Read are assigned the value of the last tag on the list. Actual tags aren't removed/changed, but each apply incorrectly assumes that they need to be fixed and re-applies them.

Duplicate issue #12130: Event Hub Tagging not applying after upgrade from 2.60.0 to 2.62.1 azurerm provider
Created: 2021-06-09T06:43:38Z
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 v0.14.11
+ provider registry.terraform.io/hashicorp/azuread v1.5.0
+ provider registry.terraform.io/hashicorp/azurerm v2.62.1
+ provider registry.terraform.io/hashicorp/vault v2.20.0

Affected Resource(s)


azurerm_eventhub_namespace

Terraform Configuration Files

resource "azurerm_eventhub_namespace" "xxx-xxx" {
  name                     = "xxx"
  location                 = var.location
  resource_group_name      = azurerm_resource_group.xxx.name
  sku                      = var.event-hub-sku
  capacity                 = var.event-hub-capacity
  auto_inflate_enabled     = true
  maximum_throughput_units = var.event-hub-max-capacity

  tags = {
    environment         = var.environment
    business-unit       = var.business-unit
    classification      = var.classification
    data-classification = var.data-classification
    operational-unit    = var.operational-unit
  }
}
Expected Behaviour
Upgrade from 2.60.0 to 2.62.1: Nothing changed. When I run terraform plan or apply I expect nothing to change.
Actual Behaviour
It wants to change all the tags to different values.
An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # azurerm_eventhub_namespace.xxx will be updated in-place
  ~ resource "azurerm_eventhub_namespace" "xxx" {
        id                                  = "/subscriptions/xxx/resourceGroups/xxx/providers/Microsoft.EventHub/namespaces/xxx"
        name                                = "xxx"
      ~ tags                                = {
          ~ "business-unit"       = "xxx" -> "123"
          ~ "classification"      = "xxx" -> "123"
          ~ "data-classification" = "xxx" -> "123"
          ~ "environment"         = "xxx" -> "123"
            # (1 unchanged element hidden)
        }
        # (12 unchanged attributes hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce


Use provider 2.60.0
Run terraform plan and terraform apply no changes required
Use provider 2.62.1
Run terraform plan and changes to all tags are required
Check azure portal and tags are correct however terraform state shows incorrect tags and wants to change with every plan and apply
Removed tags argument from terraform to apply and then added the argument back to apply tags again and subsequent plan wants changes.

Closing comment (2021-06-09T10:18:24Z): Hi there, thank you for reporting this. This is duplicate of #12061, fix is merged, will be released this week. Therefore I'll close this issue to keep the discussion in one place.