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

After upgrade from 3.38 to 3.39 (tested on 3.43 too) the provider try to recreate all azurerm_app_configuration_key resources #20511

Closed
1 task done
Socolin opened this issue Feb 16, 2023 · 3 comments

Comments

@Socolin
Copy link

Socolin commented Feb 16, 2023

Is there an existing issue for this?

  • I have searched the existing issues

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 Version

1.3.9

AzureRM Provider Version

3.39.0

Affected Resource(s)/Data Source(s)

azurerm_app_configuration_key

Terraform Configuration Files

I cannot reproduce with a simple repro, but here a simple version of the configuration I'm using


├── modules
│   └── a
│       └── main.tf
└── staging
    └── main.tf

module/a/main.tf

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

variable "kv_configs" {
  description = "Simple key value configs"
  type        = map(string)
}

variable "config_key_prefix" {
  type = string
}

variable "azure_app_configuration_id" {
  type = string
}

resource "azurerm_app_configuration_key" "app_kv_configs" {
  for_each = var.kv_configs

  configuration_store_id = var.azure_app_configuration_id

  type         = "kv"
  content_type = ""
  key          = "${var.config_key_prefix}:${each.key}"
  value        = each.value
}

staging/main.tf

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

provider "azurerm" {
  features {}
  subscription_id = "xxxxxxxxxxxxxxxxxxxxxxxxx"
}

data "azurerm_client_config" "current" {}
data "azurerm_subscription" "current" {}


module "app-config" {
  source = "../modules/a"

  azure_app_configuration_id = azurerm_app_configuration.appconf.id

  config_key_prefix = "SomePrefix"

  kv_configs = {
    "SomeKey"                     = "SomeValue"
  }
}

resource "azurerm_resource_group" "repro_bug" {
  name     = "repro_bug"
  location = "eastus"
}

resource "azurerm_app_configuration" "appconf" {
  name                = "app-config-repro-bug-use"
  resource_group_name = azurerm_resource_group.repro_bug.name
  location            = azurerm_resource_group.repro_bug.location
}

Debug Output/Panic Output

# module.MODULE_NAME.azurerm_app_configuration_key.app_kv_configs["SomeKey"] will be created
  + resource "azurerm_app_configuration_key" "app_kv_configs" {
      + configuration_store_id = "/subscriptions/...."
      + content_type           = (known after apply)
      + etag                   = (known after apply)
      + id                     = (known after apply)
      + key                    = "SomePrefix:SomeKey"
      + locked                 = false
      + type                   = "kv"
      + value                  = "1"
    }

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

Expected Behaviour

It should not try to recreate those resource

Actual Behaviour

The resources are marked to be created, even tha they exists in the state with the exact same value

in state:

  {
      "module": "module.MODULE_NAME",
      "mode": "managed",
      "type": "azurerm_app_configuration_key",
      "name": "app_kv_configs",
      "provider": "provider[\"registry.terraform.io/hashicorp/azurerm\"]",
      "instances": [
        {
          "index_key": "Sentinel",
          "schema_version": 1,
          "attributes": {
            "configuration_store_id": "/subscriptions/xxxxxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxxxxxxxxxxx/providers/Microsoft.AppConfiguration/configurationStores/xxxxxxxxxxxxxxxxxxxx",
            "content_type": "",
            "etag": "s1BNN2JeQ70glS9AhKW9t9hqJFV",
            "id": "/subscriptions/xxxxxxxxxxxxxxxxxx/resourceGroups/xxxxxxxxxxxxxx/providers/Microsoft.AppConfiguration/configurationStores/xxxxxxxxxxxxxxxxxxxx/AppConfigurationKey/SomePrefix:SomeKey/Label/\u0000",
            "key": "SomePrefix:SomeKey",
            "label": "",
            "locked": false,
            "tags": {},
            "timeouts": null,
            "type": "kv",
            "value": "1",
            "vault_key_reference": ""
          },
          "sensitive_attributes": [],
          "private": "xxxxxxxxxxxxxxxxxxxxxxxxxxx",
          "dependencies": [
            "azurerm_app_configuration.config",
            "azurerm_resource_group.web"
          ]
        }
      ]
    },

When I use terraform state list the resources that it try to create are listed

Steps to Reproduce

  • Upgrade from 3.38 -> 3.39
  • terraform init
  • terraform apply

Important Factoids

No response

References

No response

@tombuildsstuff
Copy link
Contributor

hey @Socolin

Thanks for opening this issue.

Taking a look through here this is the same root-cause as #20531 - I've been taking a look into this regression and have opened #20539 (and #20536) to fix this (which has since been merged), which'll will ship in a patch release (v3.44.1) - apologies for any inconvenience caused, but you should be able to pin to last weeks release (v3.43.0) in the interim.

Since the fix for this has been merged I'm going to close this issue for the moment, but since this issue is included in the v3.44.1 milestone, a comment will be added here once the patch release becomes available.

Thanks!

@tombuildsstuff tombuildsstuff closed this as not planned Won't fix, can't repro, duplicate, stale Feb 17, 2023
@github-actions
Copy link

This functionality has been released in v3.44.1 of the Terraform Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants