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.46k stars 4.54k forks source link

Provider produced inconsistent result after apply #23662

Open buisihung11 opened 8 months ago

buisihung11 commented 8 months ago

Is there an existing issue for this?

Community Note

Terraform Version

1.3.8

AzureRM Provider Version

3.56.0

Affected Resource(s)/Data Source(s)

azurerm_api_management_product_group

Terraform Configuration Files

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "~> 3.56.0"
    }
  }
  backend "azurerm" {}
}

resource "azurerm_api_management_product" "predifined_product_test" {
  product_id            = "predifined-product-test"
  api_management_name   = azurerm_api_management.this.name
  resource_group_name   = var.rg_name
  display_name          = "Global Product"
  description           = "Default product for all APIs"
  subscription_required = false
  approval_required     = false
  published             = true
}

resource "azurerm_api_management_product_group" "default_product_group" {
  product_id          = azurerm_api_management_product.predifined_product_test.product_id
  group_name          = "Guests"
  api_management_name = azurerm_api_management.this.name
  resource_group_name = var.rg_name
}

Debug Output/Panic Output

Provider produced inconsistent result after apply
│ 
│ When applying changes to
│ module.internal_api_management.azurerm_api_management_product_group.default_product_group,
│ provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced
│ an unexpected new value: Root resource was present, but now absent.
│ 
│ This is a bug in the provider, which should be reported in the provider's
│ own issue tracker.

Expected Behaviour

The product is assigned with Guest role

Actual Behaviour

Provider produced inconsistent result after apply │ │ When applying changes to │ module.internal_api_management.azurerm_api_management_product_group.default_product_group, │ provider "provider[\"registry.terraform.io/hashicorp/azurerm\"]" produced │ an unexpected new value: Root resource was present, but now absent. │ │ This is a bug in the provider, which should be reported in the provider's │ own issue tracker.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

elvovsky commented 2 months ago

I have the same error message/issue. Terraform version 1.6.6

kerbou commented 2 months ago

@elvovsky See this comment, it might solve your problem

elvovsky commented 2 months ago

@elvovsky See this comment, it might solve your problem

Thanks @kerbou ! I tested it and it did work with lower case. I am not sure why it does not offer id assignment instead of name :) in case you would want to use data to look it up