Azure Container appをTerraformで実現できたので、メモ。
az Loginをしてsubscription_idを取得
そのあと
az provider register --namespace Microsoft.App --subscription YOUR_SUBSCRIPTION_ID
を実行
cpu = 1
memory = "2Gi"
の変更であとは公式でいけるはずです。
main.tf
provider "azurerm" {
subscription_id=""
features {}
}
resource "azurerm_resource_group" "example" {
name = "example-resources"
location = "West Europe"
}
resource "azurerm_log_analytics_workspace" "example" {
name = "new-workspace-name"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
sku = "PerGB2018"
retention_in_days = 30
}
resource "azurerm_container_app_environment" "example" {
name = "Example-Environment"
location = azurerm_resource_group.example.location
resource_group_name = azurerm_resource_group.example.name
log_analytics_workspace_id = azurerm_log_analytics_workspace.example.id
}
resource "azurerm_container_app" "example" {
name = "example-app"
container_app_environment_id = azurerm_container_app_environment.example.id
resource_group_name = azurerm_resource_group.example.name
revision_mode = "Single"
template {
container {
name = "examplecontainerapp"
image = "mcr.microsoft.com/k8se/quickstart:latest"
cpu = 1
memory = "2Gi"
}
}
}