From 3ba00eef41ae459408c059b4d0c8bdb602bf2b11 Mon Sep 17 00:00:00 2001 From: hezijie Date: Thu, 4 Jul 2024 14:07:35 +0800 Subject: [PATCH] update to meet avm spec --- README.md | 2 +- examples/acr/README.md | 8 ++++---- examples/acr/main.tf | 8 ++++---- examples/acr/versions.tf | 6 +++++- examples/init-container/README.md | 10 +++++----- examples/init-container/main.tf | 10 +++++----- examples/init-container/versions.tf | 6 +++++- examples/startup/README.md | 20 ++++++++++---------- examples/startup/main.tf | 20 ++++++++++---------- examples/startup/versions.tf | 6 +++++- examples/vnet/README.md | 20 ++++++++++---------- examples/vnet/main.tf | 20 ++++++++++---------- examples/vnet/versions.tf | 6 +++++- main.tf | 2 +- variables.tf | 2 +- 15 files changed, 81 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index cfb157a..0942679 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ The following resources are used by this module: The following input variables are required: -### [container\_app\_environment\_id](#input\_container\_app\_environment\_id) +### [container\_app\_environment\_resource\_id](#input\_container\_app\_environment\_resource\_id) Description: The ID of the Container App Environment to host this Container App. diff --git a/examples/acr/README.md b/examples/acr/README.md index ef38b08..aa4c30c 100644 --- a/examples/acr/README.md +++ b/examples/acr/README.md @@ -214,10 +214,10 @@ resource "azurerm_container_app_environment" "example" { module "container_apps" { source = "../.." - resource_group_name = azurerm_resource_group.test.name - container_app_environment_id = azurerm_container_app_environment.example.id - name = "nginx" - revision_mode = "Single" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = "nginx" + revision_mode = "Single" template = { containers = [ { diff --git a/examples/acr/main.tf b/examples/acr/main.tf index 77d46cd..052407b 100644 --- a/examples/acr/main.tf +++ b/examples/acr/main.tf @@ -208,10 +208,10 @@ resource "azurerm_container_app_environment" "example" { module "container_apps" { source = "../.." - resource_group_name = azurerm_resource_group.test.name - container_app_environment_id = azurerm_container_app_environment.example.id - name = "nginx" - revision_mode = "Single" + resource_group_name = azurerm_resource_group.test.name + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = "nginx" + revision_mode = "Single" template = { containers = [ { diff --git a/examples/acr/versions.tf b/examples/acr/versions.tf index da348c1..1a83670 100644 --- a/examples/acr/versions.tf +++ b/examples/acr/versions.tf @@ -22,5 +22,9 @@ terraform { } provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } } diff --git a/examples/init-container/README.md b/examples/init-container/README.md index 0c1bf9b..a63f3d9 100644 --- a/examples/init-container/README.md +++ b/examples/init-container/README.md @@ -28,11 +28,11 @@ resource "azurerm_container_app_environment" "example" { } module "container_apps" { - source = "../.." - resource_group_name = azurerm_resource_group.test.name - container_app_environment_id = azurerm_container_app_environment.example.id - name = "app-with-init-container-${random_id.container_name.hex}" - revision_mode = "Single" + source = "../.." + resource_group_name = azurerm_resource_group.test.name + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = "app-with-init-container-${random_id.container_name.hex}" + revision_mode = "Single" template = { init_containers = [ { diff --git a/examples/init-container/main.tf b/examples/init-container/main.tf index b21a264..f85e9f6 100644 --- a/examples/init-container/main.tf +++ b/examples/init-container/main.tf @@ -22,11 +22,11 @@ resource "azurerm_container_app_environment" "example" { } module "container_apps" { - source = "../.." - resource_group_name = azurerm_resource_group.test.name - container_app_environment_id = azurerm_container_app_environment.example.id - name = "app-with-init-container-${random_id.container_name.hex}" - revision_mode = "Single" + source = "../.." + resource_group_name = azurerm_resource_group.test.name + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = "app-with-init-container-${random_id.container_name.hex}" + revision_mode = "Single" template = { init_containers = [ { diff --git a/examples/init-container/versions.tf b/examples/init-container/versions.tf index d52a40c..b3e58a4 100644 --- a/examples/init-container/versions.tf +++ b/examples/init-container/versions.tf @@ -14,5 +14,9 @@ terraform { } provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } } \ No newline at end of file diff --git a/examples/startup/README.md b/examples/startup/README.md index d5e7e11..c19167a 100644 --- a/examples/startup/README.md +++ b/examples/startup/README.md @@ -33,11 +33,11 @@ resource "azurerm_container_app_environment" "example" { } module "counting" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.counting_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.counting_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { @@ -66,11 +66,11 @@ module "counting" { } module "dashboard" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.dashboard_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.dashboard_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { diff --git a/examples/startup/main.tf b/examples/startup/main.tf index a95eeba..3f2193b 100644 --- a/examples/startup/main.tf +++ b/examples/startup/main.tf @@ -27,11 +27,11 @@ resource "azurerm_container_app_environment" "example" { } module "counting" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.counting_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.counting_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { @@ -60,11 +60,11 @@ module "counting" { } module "dashboard" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.dashboard_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.dashboard_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { diff --git a/examples/startup/versions.tf b/examples/startup/versions.tf index cdc7ad0..cc7c488 100644 --- a/examples/startup/versions.tf +++ b/examples/startup/versions.tf @@ -14,5 +14,9 @@ terraform { } provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } } \ No newline at end of file diff --git a/examples/vnet/README.md b/examples/vnet/README.md index 8266061..15d6211 100644 --- a/examples/vnet/README.md +++ b/examples/vnet/README.md @@ -68,11 +68,11 @@ resource "azurerm_private_dns_a_record" "containerapp_record" { } module "counting" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.counting_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.counting_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { @@ -102,11 +102,11 @@ module "counting" { } module "dashboard" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.dashboard_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.dashboard_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { diff --git a/examples/vnet/main.tf b/examples/vnet/main.tf index a368f17..de39f2e 100644 --- a/examples/vnet/main.tf +++ b/examples/vnet/main.tf @@ -62,11 +62,11 @@ resource "azurerm_private_dns_a_record" "containerapp_record" { } module "counting" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.counting_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.counting_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { @@ -96,11 +96,11 @@ module "counting" { } module "dashboard" { - source = "../.." - container_app_environment_id = azurerm_container_app_environment.example.id - name = local.dashboard_app_name - resource_group_name = azurerm_resource_group.test.name - revision_mode = "Single" + source = "../.." + container_app_environment_resource_id = azurerm_container_app_environment.example.id + name = local.dashboard_app_name + resource_group_name = azurerm_resource_group.test.name + revision_mode = "Single" template = { containers = [ { diff --git a/examples/vnet/versions.tf b/examples/vnet/versions.tf index cdc7ad0..cc7c488 100644 --- a/examples/vnet/versions.tf +++ b/examples/vnet/versions.tf @@ -14,5 +14,9 @@ terraform { } provider "azurerm" { - features {} + features { + resource_group { + prevent_deletion_if_contains_resources = false + } + } } \ No newline at end of file diff --git a/main.tf b/main.tf index ba0f16c..d5e8199 100644 --- a/main.tf +++ b/main.tf @@ -1,5 +1,5 @@ resource "azurerm_container_app" "this" { - container_app_environment_id = var.container_app_environment_id + container_app_environment_id = var.container_app_environment_resource_id name = var.name resource_group_name = var.resource_group_name revision_mode = var.revision_mode diff --git a/variables.tf b/variables.tf index 49cbe73..b2bd33e 100644 --- a/variables.tf +++ b/variables.tf @@ -1,4 +1,4 @@ -variable "container_app_environment_id" { +variable "container_app_environment_resource_id" { type = string description = "The ID of the Container App Environment to host this Container App." nullable = false