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

azurerm_api_management stores subnet id as a lowercase string? meaning it prompts for modification even when there is none to be done #18399

Closed
1 task done
nmiddleton opened this issue Sep 15, 2022 · 1 comment · Fixed by #18988
Labels

Comments

@nmiddleton
Copy link

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

AzureRM Provider Version

3.21.1

Affected Resource(s)/Data Source(s)

azurerm_api_management

Terraform Configuration Files

resource "azurerm_resource_group" "example" {
  name     = "example-RESOURCES"
  location = "West Europe"
}
resource "azurerm_virtual_network" "example" {
  name                = "EXAMPLE"
  resource_group_name = azurerm_resource_group.example.name
  location            = azurerm_resource_group.example.location
  address_space       = ["10.0.1.0/27"]
}
resource "azurerm_subnet" "example" {
  name                 = "EXAMPLE"
  resource_group_name  = azurerm_resource_group.example.name
  virtual_network_name = azurerm_virtual_network.example.name
  address_prefixes     = ["10.170.1.0/28"]
  service_endpoints    = ["Microsoft.Web"]
}
resource "azurerm_api_management" "example" {
  name                = "example-apim"
  location            = azurerm_resource_group.example.location
  resource_group_name = azurerm_resource_group.example.name
  publisher_name      = "My Company"
  publisher_email     = "company@terraform.io"

  sku_name = "Developer_1"
  virtual_network_type = "Internal"
  virtual_network_configuration {
    subnet_id = azurerm_subnet.example.id
  }
}

Debug Output/Panic Output

# azurerm_api_management.example[0] will be updated in-place
  ~ resource "azurerm_api_management" "product-apim-service" {
        id                            = "/subscriptions/*********/resourceGroups/example-RESOURCES/providers/Microsoft.ApiManagement/service/example-apim"
        name                          = "example-apim"
           # (21 unchanged attributes hidden)

      ~ virtual_network_configuration {
          ~ subnet_id = "/subscriptions/*********/resourcegroups/example-resources/providers/microsoft.network/virtualnetworks/example/subnets/EXAMPLE" -> "/subscriptions/*********/resourceGroups/example-RESOURCES/providers/Microsoft.Network/virtualNetworks/EXAMPLE/subnets/EXAMPLE"
        }

   # (8 unchanged blocks hidden)
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

azurerm_api_management.example[0]: Modifying... [id=/subscriptions//*********/resourceGroups/example-RESOURCES/providers/Microsoft.ApiManagement/service/example-APIM]
...

Expected Behaviour

its the same ID for subnet in the state as it is for the id of the subnet in the plan. so should not prompt for modification every time we run plan or apply.

Actual Behaviour

every time apply is executed, prompted for modification to the subnet id of the apim. Possibly because of case sensitivity. It seems the state stores much of the resource id as lowercase

~ subnet_id = 
"/subscriptions/---------/resourcegroups/**example-resources**/providers/microsoft.network/virtualnetworks/**example**/subnets/EXAMPLE" 
"/subscriptions/---------/resourceGroups/**example-RESOURCES**/providers/Microsoft.Network/virtualNetworks/**EXAMPLE**/subnets/EXAMPLE"
Whereas my resources contain some uppercase chars.

Steps to Reproduce

No response

Important Factoids

No response

References

No response

@github-actions
Copy link

github-actions bot commented Dec 3, 2022

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 Dec 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants