Skip to content

Import of Container App Environment having problem with workload_profile #27057

Description

@elesandroo

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 comments along the lines of "+1", "me too" or "any updates", 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 and review the contribution guide to help.

Terraform Version

1.8.5

AzureRM Provider Version

3.108.0

Affected Resource(s)/Data Source(s)

azurerm_container_app_environment

Terraform Configuration Files

resource "azurerm_container_app_environment" "example" {
  name                               = "sey-cae01"
  location                           = azurerm_resource_group.example.location
  resource_group_name                = azurerm_resource_group.example.name
  infrastructure_resource_group_name = "${azurerm_resource_group.example.name}-dyn"
  infrastructure_subnet_id           = azurerm_subnet.subnet.id
  internal_load_balancer_enabled     = true
  zone_redundancy_enabled            = false
  workload_profile {
    name                  = "Consumption"
    workload_profile_type = "Consumption"
  }
}

import {
  to = azurerm_container_app_environment.example
  id = "/subscriptions/<subscription-id>/resourceGroups/<resource-group-name>/providers/Microsoft.App/managedEnvironments/sey-cae01"
}

Debug Output/Panic Output

# azurerm_container_app_environment.example must be replaced
  # (imported from "/subscriptions/xxx/resourceGroups/sey-cae-rg01/providers/Microsoft.App/managedEnvironments/sey-cae01")
  # Warning: this will destroy the imported resource
-/+ resource "azurerm_container_app_environment" "example" {
      
      + workload_profile { # forces replacement
          + name                  = "Consumption"
          + workload_profile_type = "Consumption"
        }
    }

Expected Behaviour

I would expect the terraform import to run without any changes. If you deploy this code instead of importing it, it completes successfully.

Actual Behaviour

Terraform plan tries to replace the resource because of workload_profile. If I remove it from the configuration, I get another error:

Error: Missing required argument
│ 
│   with azurerm_container_app_environment.example,
│   on main.tf line 39, in resource "azurerm_container_app_environment" "example":
│   39:   infrastructure_resource_group_name = "${azurerm_resource_group.example.name}-dyn"
│ 
│ "infrastructure_resource_group_name": all of `infrastructure_resource_group_name,workload_profile` must be specified

Steps to Reproduce

  1. Deploy the code provided in the Terraform Configuration Files without the import command
  2. Delete TF state files
  3. Run terraform import of the Container App Environment

Important Factoids

No response

References

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions