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_spring_cloud_service id attribute seems inconsistent with actual id #19858

Open
1 task done
jorsmatthys opened this issue Jan 4, 2023 · 0 comments
Open
1 task done

Comments

@jorsmatthys
Copy link

jorsmatthys commented Jan 4, 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.6

AzureRM Provider Version

3.37.0

Affected Resource(s)/Data Source(s)

azurerm_spring_cloud_service

Terraform Configuration Files

resource "azurerm_spring_cloud_service" "spring_cloud_service" {
  for_each            = var.asc_cluster_topology
  name                = "${each.key}-${var.env_shortcode}"
  resource_group_name = "rg-${each.key}-${var.env_shortcode}"
  location            = local.location
  sku_name            = local.spring_cloud_sku
  
  # ...
 }


resource "azapi_resource" "elastic" {
  for_each  = var.asc_cluster_topology
  type      = "microsoft.insights/diagnosticSettings@2021-05-01-preview"
  name      = "elastic"
  parent_id = azurerm_spring_cloud_service.spring_cloud_service[each.key].id
  body = jsonencode({ ... })
}

resource "azurerm_role_assignment" "..." {
  for_each             = var.asc_cluster_topology
  scope                = azurerm_spring_cloud_service.spring_cloud_service[each.key].id
  role_definition_name = "Contributor"
  principal_id         = ...
}

resource "azurerm_monitor_diagnostic_setting" "diag" {
  for_each                   = var.asc_cluster_topology
  name                       = "monitoring"
  target_resource_id         = azurerm_spring_cloud_service.spring_cloud_service[each.key].id
  log_analytics_workspace_id = ...
  storage_account_id         = module.storage-account-base[each.key].storage_account_id

  dynamic "log" {...}
  }

Debug Output/Panic Output

NA (we didn't execute the plan)

Expected Behaviour

When upgrading our azurerm provider to version 3.37.0 we expected no changes when rerunning our provisioning.

Actual Behaviour

We got changes that force the replacement of three resources that depend on our azurerm_spring_cloud_service because the id attribute of that resource supposedly changed.

Strangely enough, the terraform plan shows no changes at all for the azurerm_spring_cloud_service resource itself and if we check the id of this resource (in the Azure portal) it still shows the "old" version of the id with *\Spring* instead of **\spring**.

Terraform plan output

azapi_resource.elastic["asc-cmn"] must be replaced
-/+ resource "azapi_resource" "elastic" {
      ~ id                        = "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/Spring/asc-cmn-dev/providers/microsoft.insights/diagnosticSettings/elastic" -> (known after apply)
         ...
      ~ parent_id                 = "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/Spring/asc-cmn-dev" -> "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/spring/asc-cmn-dev" # forces replacement
...
    }

azurerm_monitor_diagnostic_setting.diag["asc-cmn"] must be replaced
-/+ resource "azurerm_monitor_diagnostic_setting" "diag" {
      ~ id                         = "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/Spring/asc-cmn-dev|monitoring" -> (known after apply)
      ~ target_resource_id         = "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/Spring/asc-cmn-dev" -> "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/spring/asc-cmn-dev" # forces replacement
 ...
    }

azurerm_role_assignment.<...>["asc-cmn"] must be replaced
-/+ resource "azurerm_role_assignment" "..." {

      ~ scope                            = "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/Spring/asc-cmn-dev" -> "/subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/spring/asc-cmn-dev" # forces replacement

    }

Only the dependent resources get changes and not the azurerm_spring_cloud_service. As far as we see the id of the service (in the azure portal) is: /subscriptions/.../resourceGroups/rg-asc-cmn-dev/providers/Microsoft.AppPlatform/Spring/asc-cmn-dev

Steps to Reproduce

  1. Set up an azurerm_spring_cloud_service and related azurerm_monitor_diagnostic_setting (or one of the two other dependent resources mentionned) using a version of the azurerm provider < 3.35.0.
  2. Rerun terraform apply for the above project using provider version 3.37.0

Important Factoids

No response

References

We believe the issue we are experiencing might be related to:
#19564

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants