terraform-provider-random icon indicating copy to clipboard operation
terraform-provider-random copied to clipboard

Azurerm network subnet change is not correctly planned

Open Ivasan7 opened this issue 4 years ago • 3 comments

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.12.19

  • provider.azurerm v1.41.0
  • provider.random v2.2.1

Affected Resource(s)

  • azurerm_application_security_group
  • azurerm_virtual_network
  • azurerm_network_security_group
  • random_id.randomIdLogstore[0]

Terraform Configuration Files

resource "azurerm_resource_group" "batch-rg" {
  location = var.azure-region
  name     = "a-bcdef-dev-rg"
  tags = var.default_tags
}

Debug Output

Expected Behavior

Rename the resource group

Rename of resources.

Error: Provider produced inconsistent final plan

When expanding the plan for
module.workspace-batch.random_id.randomIdLogstore[0] to include new values
learned so far during apply, provider "registry.terraform.io/-/random"
produced an invalid new value for .keepers["resource_group"]: was
cty.StringVal("pbl-geodms-d-rg"), but now cty.StringVal("pbl-GeoDMS-d-rg").

This is a bug in the provider, which should be reported in the provider's own
issue tracker.

Steps to Reproduce

Rename any azurerm resource by only changing the capitalization, e.g., name = a-BCDef-dev-rg

  1. terraform plan
  2. terraform apply

Ivasan7 avatar Jan 23 '20 11:01 Ivasan7

hey @Ivasan7

Thanks for opening this issue.

Taking a look into this it appears this is an issue with the random provider:

When expanding the plan for module.workspace-batch.random_id.randomIdLogstore[0] to include new values learned so far during apply, provider "registry.terraform.io/-/random" produced an invalid new value for .keepers["resource_group"]: was cty.StringVal("pbl-geodms-d-rg"), but now cty.StringVal("pbl-GeoDMS-d-rg").

Rather than something specific to Azure - as such I'm going to transfer this to that repository so that it can be looked at - I hope you don't mind

Thanks!

tombuildsstuff avatar Jan 23 '20 13:01 tombuildsstuff

hello @tombuildsstuff ,

For me no problem, tbh I am using this provider and I can not test it with other providers at the moment. I opened it as general because I am not sure where this check is happening in the stack, assumed the possibility that maybe on a more general level so I rely on your in-depth knowledge to see this through. Thanks, Sandor

Ivasan7 avatar Jan 23 '20 13:01 Ivasan7

Hi @Ivasan7 👋 Are you still having this issue? If so, can you please provide a reproduction configuration?

The Terraform Provider produced inconsistent final plan error is very tricky in that Terraform has strict data consistency requirements (e.g. no changing of case of the configured value when storing it into state) that providers should adhere to, but providers built using the older terraform-plugin-sdk have a special opt-out. What can happen in those cases is that an upstream resource value might errantly change a configuration value when saving to state, but Terraform will only produce a warning log instead of an error diagnostic that would prevent further operations. When that unexpectedly changed value reaches the downstream resource, in this case the random_id resource, it too (unavoidably) will now cause an unexpected value change that Terraform then reports the error. You can typically see these by running Terraform with the TF_LOG environment variable set to WARN or lower.

bflad avatar Feb 26 '24 20:02 bflad

Closing due to lack of response.

bflad avatar May 21 '24 18:05 bflad