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.53k stars 4.6k forks source link

Issue when deploy container app environment with default consumption profile under workload profile (without D4..and E4..). #24596

Open nickjangid22 opened 8 months ago

nickjangid22 commented 8 months ago

Is there an existing issue for this?

Community Note

I am trying to deploy container apps environment with terraform. I am using existing subnet for build this container apps environment which subnet have /27 size. I want to use default Consumption profile under environment type Workload profile for environment which can be deploy in /27 size subnet for my environment. I don't want use dedicated workload profile means D4..D8..... and E4...E8...... Now I am able to deploy container apps environment with default Consumption profile under environment type Workload profile but through terraform It is showing error.

Azure Portal environment_type consumption_profile

Terraform aca_environment aca_environment_error

Terraform Version

1.7.0

AzureRM Provider Version

3.88.0

Affected Resource(s)/Data Source(s)

azurerm_container_app_environment

Terraform Configuration Files

resource "azurerm_container_app_environment" "test_environment" {
  name                       = "test-environment"
  location                   = azurerm_resource_group.test_aca_rg.location
  resource_group_name        = azurerm_resource_group.test_aca_rg.name
  infrastructure_subnet_id   = data.azurerm_subnet.test_aca_subnet.id         
  lifecycle {
    ignore_changes = [tags]
  }    
}

Debug Output/Panic Output

│ CreateOrUpdate:
│ managedenvironments.ManagedEnvironmentsClient#CreateOrUpdate: Failure
│ sending request: StatusCode=0 -- Original Error:
│ Code="ManagedEnvironmentInvalidNetworkConfiguration" Message="The
│ environment network configuration is invalid: Provided subnet must have a
│ size of at least /23"

Expected Behaviour

No response

Actual Behaviour

No response

Steps to Reproduce

No response

Important Factoids

No response

References

No response

jiaweitao001 commented 8 months ago

Hi @nickjangid22 , thanks for raising this issue. This the expected behavior of creating container app environment. Please make sure you have a subnet size of at least /23 as the error message prompted. Thanks!

nickjangid22 commented 8 months ago

Hi @jiaweitao001, I am able to create container environment with existing subnet (size /27) through azure portal and configuration which I am select is environment type "Workload Profiles" and default "Consumption" under Workload profiles. I have attached the screenshots also. But same thing if I am doing with terraform, it's showing error for required /23 size subnet.

jiaweitao001 commented 7 months ago

Hi @nickjangid22 , currently users are unable to set Consumption only workload profile with Terraform, this is a known issue, and we already have a fix pending HashiCorp's review. Fix PR: https://github.com/hashicorp/terraform-provider-azurerm/pull/24277

kawahara-titan commented 7 months ago

Hi @nickjangid22 , currently users are unable to set Consumption only workload profile with Terraform, this is a known issue, and we already have a fix pending HashiCorp's review. Fix PR: #24277

@jiaweitao001 - thanks. Just to confirm, does this also address the issue of the subnet incorrectly requiring a /23 cidr range as opposed to /27 - as described here?