英文:
Terraform property for specifying the plan in Azure Container Apps Environment
问题
如何在使用 terraform 3.49.0
创建 Azure 容器应用环境时指定计划类型为“消耗和专用工作负载配置”。我正在使用以下代码片段:
# main.tf
resource "azurerm_container_app_environment" "aca_env" {
for_each = { for aca_env in var.aca_envs : aca_env.name => aca_env}
name = each.value.name
...
}
# .tfvars
aca_envs = [
{
name = "myacaenv"
resource_group_name = "myrg"
location = "West Europe"
subnet_id = "mysubnet"
internal_load_balancer_enabled = true
tags = {}
roles = []
}
]
英文:
How to specify plan type = Consumption and Dedicated workload profiles
for Azure Container Apps Environment using terraform 3.49.0
. I am using below snippet:
# main.tf
resource "azurerm_container_app_environment" "aca_env" {
for_each = { for aca_env in var.aca_envs : aca_env.name => aca_env}
name = each.value.name
...
}
# .tfvars
aca_envs = [
{
name = "myacaenv"
resource_group_name = "myrg"
location = "West Europe"
subnet_id = "mysubnet"
internal_load_balancer_enabled = true
tags = {}
roles = []
}
]
答案1
得分: 0
Terraform目前还不支持此功能(请参阅相关问题GitHub)。您可以使用azapi提供程序来部署带有预览计划的容器应用:
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
resource "azapi_resource" "aca_env" {
type = "Microsoft.App/managedEnvironments@2022-11-01-preview"
parent_id = azurerm_resource_group.rg.id
location = azurerm_resource_group.rg.location
name = "my-aca-env-name"
body = jsonencode({
properties = {
appLogsConfiguration = {
...
}
workloadProfiles = [
{
name = "workload-profile-name"
workloadProfileType = "workload-profile-type"
}
]
...
}
})
}
有关容器应用环境的Bicep/ARM文档可以在此处找到。
英文:
Terraform does not support it yet (see related issue on github).
You could use the azapi provider to deploy a container app with a preview plan:
terraform {
required_providers {
azapi = {
source = "Azure/azapi"
}
}
}
resource "azapi_resource" "aca_env" {
type = "Microsoft.App/managedEnvironments@2022-11-01-preview"
parent_id = azurerm_resource_group.rg.id
location = azurerm_resource_group.rg.location
name = "my-aca-env-name"
body = jsonencode({
properties = {
appLogsConfiguration = {
...
}
workloadProfiles = [
{
name = "workload-profile-name"
workloadProfileType = "workload-profile-type"
}
]
...
}
})
}
Bicep/ARM documentation for container app environment can be found here .
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论