From 955821d9403b9aafa1c79248b231ad23f97003cd Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 2 Jul 2024 14:48:49 +0000 Subject: [PATCH 1/7] Apply terraform fmt --- .../configuration.tfvars | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars b/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars index 79f8ab921a..62c98ec3e1 100644 --- a/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars +++ b/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars @@ -27,14 +27,14 @@ cognitive_services_account = { # lz_key = "examples" key = "test-rg" } - name = "cs-test-1" - kind = "OpenAI" - sku_name = "S0" + name = "cs-test-1" + kind = "OpenAI" + sku_name = "S0" public_network_access_enabled = true identity = { type = "SystemAssigned, UserAssigned" // Can be "SystemAssigned, UserAssigned" or "SystemAssigned" or "UserAssigned" - key = "cognitive_msi" // A must with "SystemAssigned, UserAssigned" and "UserAssigned" + key = "cognitive_msi" // A must with "SystemAssigned, UserAssigned" and "UserAssigned" } tags = { From 79b2fdb48e53fb20a16a3349b52ecdad13f21216 Mon Sep 17 00:00:00 2001 From: kevindelmont <133667252+kevindelmont@users.noreply.github.com> Date: Mon, 8 Jul 2024 11:29:42 +0200 Subject: [PATCH 2/7] add public_network_access_enabled for azurerm_postgresql_flexible_server (#21) add new argument public_network_access_enabled = try(var.settings.public_network_access_enabled, null) --- modules/databases/postgresql_flexible_server/server.tf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/databases/postgresql_flexible_server/server.tf b/modules/databases/postgresql_flexible_server/server.tf index 5a97256436..d912bdd8f8 100644 --- a/modules/databases/postgresql_flexible_server/server.tf +++ b/modules/databases/postgresql_flexible_server/server.tf @@ -17,6 +17,8 @@ resource "azurerm_postgresql_flexible_server" "postgresql" { zone = try(var.settings.zone, null) storage_mb = try(var.settings.storage_mb, null) + public_network_access_enabled = try(var.settings.public_network_access_enabled, null) + delegated_subnet_id = var.remote_objects.subnet_id private_dns_zone_id = var.remote_objects.private_dns_zone_id From 9b057facff6f7094e95c21b1ed1edbf280193715 Mon Sep 17 00:00:00 2001 From: kevindelmont <133667252+kevindelmont@users.noreply.github.com> Date: Mon, 8 Jul 2024 15:37:59 +0200 Subject: [PATCH 3/7] =?UTF-8?q?Revert=20"add=20public=5Fnetwork=5Faccess?= =?UTF-8?q?=5Fenabled=20for=20azurerm=5Fpostgresql=5Fflexible=5Fser?= =?UTF-8?q?=E2=80=A6"=20(#25)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 79b2fdb48e53fb20a16a3349b52ecdad13f21216. --- modules/databases/postgresql_flexible_server/server.tf | 2 -- 1 file changed, 2 deletions(-) diff --git a/modules/databases/postgresql_flexible_server/server.tf b/modules/databases/postgresql_flexible_server/server.tf index d912bdd8f8..5a97256436 100644 --- a/modules/databases/postgresql_flexible_server/server.tf +++ b/modules/databases/postgresql_flexible_server/server.tf @@ -17,8 +17,6 @@ resource "azurerm_postgresql_flexible_server" "postgresql" { zone = try(var.settings.zone, null) storage_mb = try(var.settings.storage_mb, null) - public_network_access_enabled = try(var.settings.public_network_access_enabled, null) - delegated_subnet_id = var.remote_objects.subnet_id private_dns_zone_id = var.remote_objects.private_dns_zone_id From d415b4baa7437130be0c1254dec4c3dbb6f2dde6 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Tue, 13 Aug 2024 13:11:48 +0000 Subject: [PATCH 4/7] Apply terraform fmt --- .../configuration.tfvars | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars b/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars index 79f8ab921a..62c98ec3e1 100644 --- a/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars +++ b/examples/cognitive_services/101-cognitive-services-account-managed-identity/configuration.tfvars @@ -27,14 +27,14 @@ cognitive_services_account = { # lz_key = "examples" key = "test-rg" } - name = "cs-test-1" - kind = "OpenAI" - sku_name = "S0" + name = "cs-test-1" + kind = "OpenAI" + sku_name = "S0" public_network_access_enabled = true identity = { type = "SystemAssigned, UserAssigned" // Can be "SystemAssigned, UserAssigned" or "SystemAssigned" or "UserAssigned" - key = "cognitive_msi" // A must with "SystemAssigned, UserAssigned" and "UserAssigned" + key = "cognitive_msi" // A must with "SystemAssigned, UserAssigned" and "UserAssigned" } tags = { From d1c6e0970166ba26792ba54315c86c5bb0b94df8 Mon Sep 17 00:00:00 2001 From: GitHub Action Date: Wed, 11 Sep 2024 12:06:22 +0000 Subject: [PATCH 5/7] Apply terraform fmt --- .../configuration.tfvars | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/azuread/107-azuread-application-with-single-page-application/configuration.tfvars b/examples/azuread/107-azuread-application-with-single-page-application/configuration.tfvars index be32857be7..a8a7b91a7e 100644 --- a/examples/azuread/107-azuread-application-with-single-page-application/configuration.tfvars +++ b/examples/azuread/107-azuread-application-with-single-page-application/configuration.tfvars @@ -56,8 +56,8 @@ azuread_applications = { admin_consent_description = "Allow to administer app2." admin_consent_display_name = "Administer app2" enabled = true - type = "Admin" - value = "app2" + type = "Admin" + value = "app2" } ] } From a0e7e5bb06631056a4c276c89326f2db877e0640 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20DELMONT?= Date: Thu, 26 Sep 2024 09:47:45 +0200 Subject: [PATCH 6/7] Add automation powershell module --- .github/workflows/standalone-scenarios.json | 1 + automation_modules.tf | 14 +++++++++ .../configuration.tfvars | 30 +++++++++++++++++++ locals.tf | 1 + .../automation_powershell_module/main.tf | 14 +++++++++ .../automation_powershell_module/module.tf | 18 +++++++++++ .../automation_powershell_module/output.tf | 4 +++ .../automation_powershell_module/variables.tf | 15 ++++++++++ 8 files changed, 97 insertions(+) create mode 100644 automation_modules.tf create mode 100644 examples/automation/105-automation-powershell-module/configuration.tfvars create mode 100644 modules/automation/automation_module/automation_powershell_module/main.tf create mode 100644 modules/automation/automation_module/automation_powershell_module/module.tf create mode 100644 modules/automation/automation_module/automation_powershell_module/output.tf create mode 100644 modules/automation/automation_module/automation_powershell_module/variables.tf diff --git a/.github/workflows/standalone-scenarios.json b/.github/workflows/standalone-scenarios.json index 2bd6a3da02..9ca4d90121 100644 --- a/.github/workflows/standalone-scenarios.json +++ b/.github/workflows/standalone-scenarios.json @@ -29,6 +29,7 @@ "automation/102-automation-msi", "automation/103-automation-private-endpoints", "automation/104-automation-schedule-runbook", + "automation/105-automation-powershell-module", "communication/communication_services/101-communication_service", "diagnostics_profiles/100-multiple-destinations", "diagnostics_profiles/100-multiple-destinations", diff --git a/automation_modules.tf b/automation_modules.tf new file mode 100644 index 0000000000..665ff10d3d --- /dev/null +++ b/automation_modules.tf @@ -0,0 +1,14 @@ +module "automation_powershell72_module" { + source = "./modules/automation/automation_module/automation_powershell72_module" + for_each = local.shared_services.automation_powershell72_module + + global_settings = local.global_settings + settings = each.value + client_config = local.client_config + automation_account_id = can(each.value.automation_account_id) ? each.value.automation_account_id : local.combined_objects_automations[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.automation_account_key].id + base_tags = local.global_settings.inherit_tags +} + +output "automation_powershell72_module" { + value = module.automation_powershell72_module +} diff --git a/examples/automation/105-automation-powershell-module/configuration.tfvars b/examples/automation/105-automation-powershell-module/configuration.tfvars new file mode 100644 index 0000000000..e9d34e0790 --- /dev/null +++ b/examples/automation/105-automation-powershell-module/configuration.tfvars @@ -0,0 +1,30 @@ +global_settings = { + default_region = "region1" + regions = { + region1 = "australiaeast" + } +} + +resource_groups = { + automation = { + name = "automation" + } +} + +automations = { + auto1 = { + name = "automation" + sku = "Basic" + resource_group_key = "automation" + } +} + +automation_powershell72_module = { + module1 = { + name = "Az.ResourceGraph" + automation_account_key = "auto1" + module_link = { + uri = "https://www.powershellgallery.com/api/v2/package/Az.ResourceGraph/1.0.0" + } + } +} diff --git a/locals.tf b/locals.tf index e81350b46f..723bd58a84 100644 --- a/locals.tf +++ b/locals.tf @@ -380,6 +380,7 @@ locals { shared_services = { automations = try(var.shared_services.automations, {}) + automation_powershell72_module = try(var.shared_services.automation_powershell72_module, {}) automation_schedules = try(var.shared_services.automation_schedules, {}) automation_runbooks = try(var.shared_services.automation_runbooks, {}) automation_log_analytics_links = try(var.shared_services.automation_log_analytics_links, {}) diff --git a/modules/automation/automation_module/automation_powershell_module/main.tf b/modules/automation/automation_module/automation_powershell_module/main.tf new file mode 100644 index 0000000000..bd414805b7 --- /dev/null +++ b/modules/automation/automation_module/automation_powershell_module/main.tf @@ -0,0 +1,14 @@ +terraform { + required_providers { + azurecaf = { + source = "aztfmod/azurecaf" + } + } +} + +locals { + tags = var.base_tags ? merge( + var.global_settings.tags, + try(var.settings.tags, null) + ) : try(var.settings.tags, null) +} diff --git a/modules/automation/automation_module/automation_powershell_module/module.tf b/modules/automation/automation_module/automation_powershell_module/module.tf new file mode 100644 index 0000000000..e1da8e9556 --- /dev/null +++ b/modules/automation/automation_module/automation_powershell_module/module.tf @@ -0,0 +1,18 @@ +resource "azurerm_automation_powershell72_module" "automation_powershell72_module" { + name = var.settings.name + automation_account_id = var.automation_account_id + tags = local.tags + + module_link { + uri = var.settings.module_link.uri + + dynamic "hash" { + for_each = try(var.settings.module_link.hash, null) == null ? [] : [1] + + content { + algorithm = hash.algorithm + value = hash.value + } + } + } +} diff --git a/modules/automation/automation_module/automation_powershell_module/output.tf b/modules/automation/automation_module/automation_powershell_module/output.tf new file mode 100644 index 0000000000..5dd86bb0c1 --- /dev/null +++ b/modules/automation/automation_module/automation_powershell_module/output.tf @@ -0,0 +1,4 @@ +output "id" { + description = "The Automation Module ID." + value = azurerm_automation_powershell72_module.automation_powershell72_module.id +} diff --git a/modules/automation/automation_module/automation_powershell_module/variables.tf b/modules/automation/automation_module/automation_powershell_module/variables.tf new file mode 100644 index 0000000000..fc8002befb --- /dev/null +++ b/modules/automation/automation_module/automation_powershell_module/variables.tf @@ -0,0 +1,15 @@ +variable "automation_account_id" {} + +variable "settings" { + description = "Configuration object for the Automation account schedule." +} + +variable "global_settings" { + description = "Global settings object (see module README.md)" +} +variable "base_tags" { + description = "Enable tags inheritence." + type = bool +} + +variable "client_config" {} From e81e75fcb1d66ccd34100ebe782edc2900093f86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20DELMONT?= Date: Thu, 26 Sep 2024 09:55:11 +0200 Subject: [PATCH 7/7] Add variable in example --- examples/module.tf | 1 + examples/variables.tf | 3 +++ 2 files changed, 4 insertions(+) diff --git a/examples/module.tf b/examples/module.tf index f2fbbc1c6c..94263ead40 100644 --- a/examples/module.tf +++ b/examples/module.tf @@ -300,6 +300,7 @@ module "example" { shared_services = { automations = var.automations + automation_powershell72_module = var.automation_powershell72_module automation_schedules = var.automation_schedules automation_runbooks = var.automation_runbooks automation_log_analytics_links = var.automation_log_analytics_links diff --git a/examples/variables.tf b/examples/variables.tf index 53625d0dd2..a18f6e9924 100644 --- a/examples/variables.tf +++ b/examples/variables.tf @@ -506,6 +506,9 @@ variable "event_hubs" { variable "automations" { default = {} } +variable "automation_powershell72_module" { + default = {} +} variable "automation_schedules" { default = {} }