Terraform 在 Azure 容器应用环境中指定计划的属性

huangapple go评论61阅读模式
英文:

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 = []
  }
]

Terraform 在 Azure 容器应用环境中指定计划的属性

英文:

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 = []
  }
]

Terraform 在 Azure 容器应用环境中指定计划的属性

答案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 .

huangapple
  • 本文由 发表于 2023年6月5日 22:14:55
  • 转载请务必保留本文链接:https://go.coder-hub.com/76407342.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定