hashicorp / terraform-provider-azurerm

Terraform provider for Azure Resource Manager
https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs
Mozilla Public License 2.0
4.62k stars 4.65k forks source link

data_factory redeploy removes parameter within data_factory #11659

Open thesutex opened 3 years ago

thesutex commented 3 years ago

Community Note

Terraform (and AzureRM Provider) Version

Terraform 15.1 Azurerm 2.57

Affected Resource(s)

Terraform Configuration Files

resource "azurerm_data_factory" "datafactory" {
  # oparulesv1: "azurerm_data_factory": {"delete": 100, "create": 10, "modify": 1}
  name                = var.data_factory_name == null ? module.datafactoryname.azurecaf_name_result : var.data_factory_name
  location            = var.region
  resource_group_name = var.resource_group_name
  tags                = merge(var.extra_tags, var.service_tags, local.common_tags)

  identity {
    type = var.data_factory_identity_type
  }
}

Debug Output

Panic Output

Expected Behaviour

We are creating datafactory with tags (works great), and the dev team is publishing datafactory content using git connection and azdevops pipelines. These pipelines removes the tags unfortunatly, but this is not the issue

On redeploy of terraform it says the tags are removes and adds them

# azurerm_data_factory.datafactory will be updated in-place
  ~ resource "azurerm_data_factory" "datafactory" {
        id                     = "/subscriptions/*****"
        name                   = "adf-****"
      ~ tags                   = {
          + "Application" = "1"
          + "CloudType"   = "2"
          + "DebitCode"   = "3"
          + "Environment" = "4"
          + "Region"      = "5"
          + "SLA"         = "6"
        }
        # (3 unchanged attributes hidden)

        # (1 unchanged block hidden)
    }

Actual Behaviour

Tags are added fine, BUT it also removes all globalParameters within the azure datafactory. not sure if this is terraform of azure behavior, but it lists the changes in activity log from my account during terraform redeploy of tags

Steps to Reproduce

  1. terraform apply

On subsequent datafactories that are pushed to via azdevops pipelines (which removes tags in arm template deployment)

Important Factoids

References

thesutex commented 3 years ago

image see log from Azure when terraform adds tags

markhoiland commented 3 years ago

This is a major bug that breaks production ETL processes in ADF workspaces maintained by the CI/CD process.

The azurerm_data_factory resource should not touch the globalParameters properties in ADF workspaces that don't have git configuration enabled, but every apply currently wipes out all globalParameters completely.