From f42e4b16a34731a7f81a6202cc2aeb5e423f0d84 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 18 Dec 2020 03:08:06 +0000 Subject: [PATCH 01/23] add eventhub module --- event_hub.tf | 13 +++++ .../configuration.tfvars | 44 +++++++++++++++ examples/module.tf | 1 + examples/variables.tf | 4 ++ .../event_hub/event_hub.tf | 56 +++++++++++++++++++ .../event_hub_namespaces/event_hub/main.tf | 16 ++++++ .../event_hub_namespaces/event_hub/output.tf | 5 ++ .../event_hub/variables.tf | 7 +++ modules/event_hub_namespaces/output.tf | 16 ++++++ variables.tf | 4 ++ 10 files changed, 166 insertions(+) create mode 100644 event_hub.tf create mode 100644 examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars create mode 100644 modules/event_hub_namespaces/event_hub/event_hub.tf create mode 100644 modules/event_hub_namespaces/event_hub/main.tf create mode 100644 modules/event_hub_namespaces/event_hub/output.tf create mode 100644 modules/event_hub_namespaces/event_hub/variables.tf diff --git a/event_hub.tf b/event_hub.tf new file mode 100644 index 000000000..2b4dda256 --- /dev/null +++ b/event_hub.tf @@ -0,0 +1,13 @@ +module event_hub { + source = "./modules/event_hub_namespaces/event_hub" + depends_on = [module.event_hub_namespaces] + for_each = try(var.event_hub, {}) + + resource_group_name = module.resource_groups[each.value.resource_group_key].name + client_config = local.client_config + global_settings = local.global_settings + settings = each.value + namespace_name = var.diagnostics.event_hub_namespaces[var.diagnostics.diagnostics_destinations.event_hub_namespaces[each.value.destination_key].event_hub_namespace_key].name + storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) + base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} +} \ No newline at end of file diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars new file mode 100644 index 000000000..5ee672c85 --- /dev/null +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars @@ -0,0 +1,44 @@ +global_settings = { + default_region = "region1" + regions = { + region1 = "southeastasia" + } +} + +resource_groups = { + sec_center = { + name = "sec-center" + } +} + +storage_accounts = { + evh1 = { + name = "evh1" + resource_group_key = "sec_center" + account_kind = "BlobStorage" + account_tier = "Standard" + account_replication_type = "LRS" + containers = { + evh = { + name = "evh" + } + } + } +} + +event_hub = { + ev = { + name = "ev" + resource_group_key = "sec_center" + eventhub_namespace_key = "central_logs_region1" + destination_key = "central_logs" + storage_account_key = "evh1" + blob_container_name = "evh" + partition_count = "2" + message_retention = "2" + rule_name = "ev-rule" + listen = true + send = true + manage = false + } +} \ No newline at end of file diff --git a/examples/module.tf b/examples/module.tf index 0cdc455cd..9b2c888c4 100644 --- a/examples/module.tf +++ b/examples/module.tf @@ -18,6 +18,7 @@ module "caf" { role_mapping = var.role_mapping log_analytics = var.log_analytics event_hub_namespaces = var.event_hub_namespaces + event_hub = var.event_hub webapp = { azurerm_application_insights = var.azurerm_application_insights diff --git a/examples/variables.tf b/examples/variables.tf index b9a4620f1..da28faf71 100644 --- a/examples/variables.tf +++ b/examples/variables.tf @@ -239,4 +239,8 @@ variable private_endpoints { variable local_network_gateways { default = {} +} + +variable event_hub { + default = {} } \ No newline at end of file diff --git a/modules/event_hub_namespaces/event_hub/event_hub.tf b/modules/event_hub_namespaces/event_hub/event_hub.tf new file mode 100644 index 000000000..46a82c22b --- /dev/null +++ b/modules/event_hub_namespaces/event_hub/event_hub.tf @@ -0,0 +1,56 @@ +resource "azurecaf_name" "evhub" { + name = var.settings.name + resource_type = "azurerm_eventhub" + prefixes = [var.global_settings.prefix] + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough + use_slug = var.global_settings.use_slug +} + +resource "azurecaf_name" "evh_rule" { + name = var.settings.rule_name + resource_type = "azurerm_eventhub_authorization_rule" + prefixes = [var.global_settings.prefix] + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough + use_slug = var.global_settings.use_slug +} +resource "azurerm_eventhub" "evhub" { + name = azurecaf_name.evhub.result + namespace_name = var.namespace_name + resource_group_name = var.resource_group_name + partition_count = var.settings.partition_count + message_retention = var.settings.message_retention + + dynamic "capture_description" { + for_each = try(var.settings.capture_description, {}) + content { + enabled = capture_description.value.enabled + encoding = capture_description.value.encoding + interval_in_seconds = try(capture_description.value.interval_in_seconds, null) + size_limit_in_bytes = try(capture_description.value.size_limit_in_bytes, null) + skip_empty_archives = try(capture_description.value.skip_empty_archives, null) + dynamic "destination" { # required if capture_description is set + for_each = try(var.settings.capture_description.destination, {}) + content { + name = destination.value.name # At this time(12/2020), the only supported value is EventHubArchive.AzureBlockBlob + archive_name_format = destination.value.archive_name_format # e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second} + blob_container_name = destination.value.blob_container_name + storage_account_id = var.storage_account_id + } + } + } + } +} + +resource "azurerm_eventhub_authorization_rule" "evhub_rule" { + name = azurecaf_name.evh_rule.result + namespace_name = var.namespace_name + eventhub_name = azurerm_eventhub.evhub.name + resource_group_name = var.resource_group_name + listen = var.settings.listen + send = var.settings.send + manage = var.settings.manage +} \ No newline at end of file diff --git a/modules/event_hub_namespaces/event_hub/main.tf b/modules/event_hub_namespaces/event_hub/main.tf new file mode 100644 index 000000000..bb376e1a6 --- /dev/null +++ b/modules/event_hub_namespaces/event_hub/main.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + azurecaf = { + source = "aztfmod/azurecaf" + } + } + required_version = ">= 0.13" +} + + +locals { + module_tag = { + "module" = basename(abspath(path.module)) + } + tags = merge(local.module_tag, lookup(var.settings, "tags", {}), var.base_tags) +} diff --git a/modules/event_hub_namespaces/event_hub/output.tf b/modules/event_hub_namespaces/event_hub/output.tf new file mode 100644 index 000000000..44bbec47d --- /dev/null +++ b/modules/event_hub_namespaces/event_hub/output.tf @@ -0,0 +1,5 @@ +output id { + value = azurerm_eventhub.evhub.id + sensitive = true +} + diff --git a/modules/event_hub_namespaces/event_hub/variables.tf b/modules/event_hub_namespaces/event_hub/variables.tf new file mode 100644 index 000000000..b6bdeadd3 --- /dev/null +++ b/modules/event_hub_namespaces/event_hub/variables.tf @@ -0,0 +1,7 @@ +variable global_settings {} +variable settings {} +variable resource_group_name {} +variable base_tags {} +variable client_config {} +variable namespace_name {} +variable storage_account_id {} \ No newline at end of file diff --git a/modules/event_hub_namespaces/output.tf b/modules/event_hub_namespaces/output.tf index d7577ec94..8e57f1201 100755 --- a/modules/event_hub_namespaces/output.tf +++ b/modules/event_hub_namespaces/output.tf @@ -11,4 +11,20 @@ output name { output location { value = azurerm_eventhub_namespace.evh.location sensitive = true +} + +output connection_string_primary { + value = azurerm_eventhub_namespace.evh.default_primary_connection_string +} + +output connection_string_secondary { + value = azurerm_eventhub_namespace.evh.default_secondary_connection_string +} + +output primary_key { + value = azurerm_eventhub_namespace.evh.default_primary_key +} + +output secondary_key { + value = azurerm_eventhub_namespace.evh.default_secondary_key } \ No newline at end of file diff --git a/variables.tf b/variables.tf index b142d241f..fc69d3232 100755 --- a/variables.tf +++ b/variables.tf @@ -199,4 +199,8 @@ variable cosmos_dbs { variable local_network_gateways { default = {} +} + +variable event_hub { + default = {} } \ No newline at end of file From 6aab6e7aa76b537528d07cd83f8079ae14b508d4 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 8 Jan 2021 05:11:53 +0000 Subject: [PATCH 02/23] add standalone module --- .../102-evh_with_auth_rules/standalone/ci.sh | 25 +++++++++++ .../standalone/main.tf | 43 +++++++++++++++++++ .../standalone/module.tf | 9 ++++ .../standalone/readme.md | 23 ++++++++++ .../standalone/variables.tf | 18 ++++++++ 5 files changed, 118 insertions(+) create mode 100644 examples/eventhub_namespace/102-evh_with_auth_rules/standalone/ci.sh create mode 100644 examples/eventhub_namespace/102-evh_with_auth_rules/standalone/main.tf create mode 100644 examples/eventhub_namespace/102-evh_with_auth_rules/standalone/module.tf create mode 100644 examples/eventhub_namespace/102-evh_with_auth_rules/standalone/readme.md create mode 100644 examples/eventhub_namespace/102-evh_with_auth_rules/standalone/variables.tf diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/ci.sh b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/ci.sh new file mode 100644 index 000000000..18f3fec48 --- /dev/null +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/ci.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +current_folder=$(pwd) +cd standalone + +terraform init + +terraform apply \ + -var-file ../configuration.tfvars \ + -var tags='{testing_job_id="${1}"}' \ + -var var_folder_path=${current_folder} \ + -input=false \ + -auto-approve + + +terraform destroy \ + -var-file ../configuration.tfvars \ + -var tags='{testing_job_id="${1}"}' \ + -var tags='{testing_job_id="${1}"}' \ + -var var_folder_path=${current_folder} \ + -input=false \ + -auto-approve + diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/main.tf b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/main.tf new file mode 100644 index 000000000..84ff4f978 --- /dev/null +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/main.tf @@ -0,0 +1,43 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 2.40.0" + } + azuread = { + source = "hashicorp/azuread" + version = "~> 1.0.0" + } + random = { + source = "hashicorp/random" + version = "~> 2.2.1" + } + null = { + source = "hashicorp/null" + version = "~> 2.1.0" + } + external = { + source = "hashicorp/external" + version = "~> 1.2.0" + } + tls = { + source = "hashicorp/tls" + version = "~> 2.2.0" + } + azurecaf = { + source = "aztfmod/azurecaf" + version = "~> 1.1.0" + } + } + required_version = ">= 0.13" +} + + +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = true + } + } +} + diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/module.tf b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/module.tf new file mode 100644 index 000000000..819f19e98 --- /dev/null +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/module.tf @@ -0,0 +1,9 @@ +module "caf" { + source = "../../../../../caf" + global_settings = var.global_settings + tags = var.tags + resource_groups = var.resource_groups + storage_accounts = var.storage_accounts + +} + diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/readme.md b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/readme.md new file mode 100644 index 000000000..322a62144 --- /dev/null +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/readme.md @@ -0,0 +1,23 @@ +You can test this module outside of a landingzone using + +```bash +cd /tf/caf/examples/eventhub_namespace/102-evh_with_auth_rules/standalone + +terraform init + +terraform plan \ + -var-file ../configuration.tfvars + +``` + +To test this deployment in the example landingzone. Make sure the launchpad has been deployed first + +```bash + +rover \ + -lz /tf/caf/aztfmod/examples \ + -var-folder /tf/caf/examples/eventhub_namespace/102-evh_with_auth_rules/ \ + -level level1 \ + -a plan + +``` \ No newline at end of file diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/variables.tf b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/variables.tf new file mode 100644 index 000000000..30b9a6b0a --- /dev/null +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/variables.tf @@ -0,0 +1,18 @@ +variable global_settings { + default = {} +} + +variable resource_groups { + default = null +} + +variable storage_accounts { + default = {} +} + +variable tags { + default = {} +} + + + From c106cfcaed7d627da1205e060ec99d7fd18514cb Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 8 Jan 2021 13:40:12 +0000 Subject: [PATCH 03/23] fix typo --- modules/event_hub_namespaces/output.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/event_hub_namespaces/output.tf b/modules/event_hub_namespaces/output.tf index 4598c2519..9f83aa8e9 100755 --- a/modules/event_hub_namespaces/output.tf +++ b/modules/event_hub_namespaces/output.tf @@ -30,6 +30,5 @@ output primary_key { output secondary_key { value = azurerm_eventhub_namespace.evh.default_secondary_key description = "The EventHub Namespace location." - value = azurerm_eventhub_namespace.evh.location sensitive = true } \ No newline at end of file From 65c2a5ce6e27b90ff081a07d82b562c4eb6cb621 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 11 Jan 2021 01:35:13 +0000 Subject: [PATCH 04/23] add eventhub to CI --- .github/workflows/master-100.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/master-100.yaml b/.github/workflows/master-100.yaml index fdae321ba..6773d796d 100755 --- a/.github/workflows/master-100.yaml +++ b/.github/workflows/master-100.yaml @@ -101,6 +101,7 @@ jobs: "datalake/101-datalake-storage", "eventhub_namespace/100-simple-evh", "eventhub_namespace/101-evh-with-private-endpoint", + "eventhub_namespace/102-evh_with_auth_rules", "keyvault/102-keyvault-cert-issuer", "mariadb_server/100-simple-mariadb", "mariadb_server/101-vnet-rule-mariadb", From f24e731f020b0ccab733fbda666dba41a4c98bb1 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 11 Jan 2021 01:52:44 +0000 Subject: [PATCH 05/23] update example --- .../102-evh_with_auth_rules/configuration.tfvars | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars index 5ee672c85..dff74d84b 100644 --- a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars @@ -26,11 +26,20 @@ storage_accounts = { } } +event_hub_namespaces = { + evh1 = { + name = "evh1" + resource_group_key = "evh_examples" + sku = "Standard" + region = "region1" + } +} + event_hub = { ev = { name = "ev" resource_group_key = "sec_center" - eventhub_namespace_key = "central_logs_region1" + eventhub_namespace_key = "evh1" destination_key = "central_logs" storage_account_key = "evh1" blob_container_name = "evh" From 06e61ce1fc78822d6707d6bcac20b7687b099419 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 11 Jan 2021 01:54:15 +0000 Subject: [PATCH 06/23] update example --- .../102-evh_with_auth_rules/configuration.tfvars | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars index dff74d84b..93c380bdb 100644 --- a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars @@ -39,7 +39,7 @@ event_hub = { ev = { name = "ev" resource_group_key = "sec_center" - eventhub_namespace_key = "evh1" + event_hub_namespace_key = "evh1" destination_key = "central_logs" storage_account_key = "evh1" blob_container_name = "evh" From 401d9e3d3130e9cc0efad25c44678e0def52c4b5 Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 11 Jan 2021 04:34:06 +0000 Subject: [PATCH 07/23] edit CI file --- .github/workflows/master-100.yaml | 1 - .../102-evh_with_auth_rules/configuration.tfvars | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/master-100.yaml b/.github/workflows/master-100.yaml index 6773d796d..fdae321ba 100755 --- a/.github/workflows/master-100.yaml +++ b/.github/workflows/master-100.yaml @@ -101,7 +101,6 @@ jobs: "datalake/101-datalake-storage", "eventhub_namespace/100-simple-evh", "eventhub_namespace/101-evh-with-private-endpoint", - "eventhub_namespace/102-evh_with_auth_rules", "keyvault/102-keyvault-cert-issuer", "mariadb_server/100-simple-mariadb", "mariadb_server/101-vnet-rule-mariadb", diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars index 93c380bdb..948f4ced0 100644 --- a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars +++ b/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars @@ -1,3 +1,5 @@ +#scenario 200 has to be deployed + global_settings = { default_region = "region1" regions = { From 8d193034a5303450c232021b3243903a06de016c Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 21 Jan 2021 08:22:00 +0000 Subject: [PATCH 08/23] consolidate eventhub objects in single file --- event_hub.tf | 13 ------------- event_hub_namespaces.tf | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 13 deletions(-) delete mode 100644 event_hub.tf diff --git a/event_hub.tf b/event_hub.tf deleted file mode 100644 index 2b4dda256..000000000 --- a/event_hub.tf +++ /dev/null @@ -1,13 +0,0 @@ -module event_hub { - source = "./modules/event_hub_namespaces/event_hub" - depends_on = [module.event_hub_namespaces] - for_each = try(var.event_hub, {}) - - resource_group_name = module.resource_groups[each.value.resource_group_key].name - client_config = local.client_config - global_settings = local.global_settings - settings = each.value - namespace_name = var.diagnostics.event_hub_namespaces[var.diagnostics.diagnostics_destinations.event_hub_namespaces[each.value.destination_key].event_hub_namespace_key].name - storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) - base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} -} \ No newline at end of file diff --git a/event_hub_namespaces.tf b/event_hub_namespaces.tf index afff49839..b77eb334b 100755 --- a/event_hub_namespaces.tf +++ b/event_hub_namespaces.tf @@ -63,3 +63,18 @@ locals { ) : format("%s-%s", private_endpoint.eh_ns_key, private_endpoint.pe_key) => private_endpoint } } + + +module event_hub { + source = "./modules/event_hub_namespaces/event_hub" + depends_on = [module.event_hub_namespaces] + for_each = try(var.event_hub, {}) + + resource_group_name = module.resource_groups[each.value.resource_group_key].name + client_config = local.client_config + global_settings = local.global_settings + settings = each.value + namespace_name = var.diagnostics.event_hub_namespaces[var.diagnostics.diagnostics_destinations.event_hub_namespaces[each.value.destination_key].event_hub_namespace_key].name + storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) + base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} +} \ No newline at end of file From 88b3fb466d5db71a68978fad2502e8131976f4fd Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 21 Jan 2021 08:35:25 +0000 Subject: [PATCH 09/23] fix typo --- modules/event_hub_namespaces/output.tf | 3 +-- variables.tf | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/event_hub_namespaces/output.tf b/modules/event_hub_namespaces/output.tf index 5fdea5e0d..341845ab1 100755 --- a/modules/event_hub_namespaces/output.tf +++ b/modules/event_hub_namespaces/output.tf @@ -31,6 +31,5 @@ output secondary_key { value = azurerm_eventhub_namespace.evh.default_secondary_key description = "The EventHub Namespace location." sensitive = true - value = azurerm_eventhub_namespace.evh.location - + } \ No newline at end of file diff --git a/variables.tf b/variables.tf index 04ec84f8d..a95cedc18 100755 --- a/variables.tf +++ b/variables.tf @@ -233,6 +233,9 @@ variable local_network_gateways { } variable event_hub { + default = {} +} + variable automations { default = {} } From 8ca1267b1d134ae140067eede38dbdee0c3a70f0 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Jan 2021 15:05:35 +0000 Subject: [PATCH 10/23] - enhance eventhub namespace module - add eventhub and consumer group modules - refactor existing files - rename paths in CI --- .github/workflows/master-100.yaml | 6 +- .github/workflows/master-standalone.yaml | 5 +- diagnostics.tf | 2 +- event_hub_namespaces.tf => event_hub.tf | 56 ++++++++++++++++++- .../configuration.tfvars | 0 .../standalone/ci.sh | 0 .../standalone/main.tf | 0 .../standalone/module.tf | 0 .../standalone/readme.md | 0 .../standalone/variables.tf | 0 .../configuration.tfvars | 0 .../standalone/ci.sh | 0 .../standalone/main.tf | 0 .../standalone/module.tf | 0 .../standalone/readme.md | 0 .../standalone/variables.tf | 0 .../configuration.tfvars | 18 ++++-- .../standalone/ci.sh | 0 .../standalone/main.tf | 0 .../standalone/module.tf | 0 .../standalone/readme.md | 0 .../standalone/variables.tf | 0 .../configuration.tfvars | 46 +++++++++++++++ examples/module.tf | 3 + examples/variables.tf | 12 ++++ .../event_hub/auth_rules/auth_rules.tf | 19 +++++++ .../event_hub/event_hub/auth_rules/main.tf | 16 ++++++ .../event_hub/event_hub/auth_rules/output.tf | 27 +++++++++ .../event_hub/auth_rules/variables.tf | 6 ++ .../event_hub/event_hub.tf | 18 ------ .../event_hub/main.tf | 0 modules/event_hub/event_hub/output.tf | 9 +++ .../event_hub/variables.tf | 2 +- .../consumer_groups.tf | 17 ++++++ .../event_hub_consumer_groups/main.tf | 16 ++++++ .../event_hub_consumer_groups/output.tf | 3 + .../event_hub_consumer_groups/variables.tf | 7 +++ .../event_hub_namespaces/README.md | 0 .../auth_rules/auth_rules.tf | 18 ++++++ .../event_hub_namespaces/auth_rules/main.tf | 16 ++++++ .../event_hub_namespaces/auth_rules/output.tf | 27 +++++++++ .../auth_rules/variables.tf | 5 ++ .../event_hub_namespaces.tf | 54 ++++++++++++++++++ .../event_hub_namespaces/main.tf | 0 .../event_hub_namespaces/output.tf | 0 .../event_hub_namespaces/variables.tf | 0 .../event_hub_namespaces/event_hub/output.tf | 5 -- .../event_hub_namespaces.tf | 18 ------ variables.tf | 12 ++++ 49 files changed, 388 insertions(+), 55 deletions(-) rename event_hub_namespaces.tf => event_hub.tf (60%) mode change 100755 => 100644 rename examples/{eventhub_namespace/100-simple-evh => eventhub/100-simple-eventhub-namespace}/configuration.tfvars (100%) rename examples/{eventhub_namespace/100-simple-evh => eventhub/100-simple-eventhub-namespace}/standalone/ci.sh (100%) mode change 100755 => 100644 rename examples/{eventhub_namespace/100-simple-evh => eventhub/100-simple-eventhub-namespace}/standalone/main.tf (100%) rename examples/{eventhub_namespace/100-simple-evh => eventhub/100-simple-eventhub-namespace}/standalone/module.tf (100%) rename examples/{eventhub_namespace/100-simple-evh => eventhub/100-simple-eventhub-namespace}/standalone/readme.md (100%) rename examples/{eventhub_namespace/100-simple-evh => eventhub/100-simple-eventhub-namespace}/standalone/variables.tf (100%) rename examples/{eventhub_namespace/101-evh-with-private-endpoint => eventhub/101-evh-namespace-with-private-endpoint}/configuration.tfvars (100%) rename examples/{eventhub_namespace/101-evh-with-private-endpoint => eventhub/101-evh-namespace-with-private-endpoint}/standalone/ci.sh (100%) mode change 100755 => 100644 rename examples/{eventhub_namespace/101-evh-with-private-endpoint => eventhub/101-evh-namespace-with-private-endpoint}/standalone/main.tf (100%) rename examples/{eventhub_namespace/101-evh-with-private-endpoint => eventhub/101-evh-namespace-with-private-endpoint}/standalone/module.tf (100%) rename examples/{eventhub_namespace/101-evh-with-private-endpoint => eventhub/101-evh-namespace-with-private-endpoint}/standalone/readme.md (100%) rename examples/{eventhub_namespace/101-evh-with-private-endpoint => eventhub/101-evh-namespace-with-private-endpoint}/standalone/variables.tf (100%) rename examples/{eventhub_namespace/102-evh_with_auth_rules => eventhub/102-namespace-and-evh-with-auth-rules}/configuration.tfvars (73%) rename examples/{eventhub_namespace/102-evh_with_auth_rules => eventhub/102-namespace-and-evh-with-auth-rules}/standalone/ci.sh (100%) rename examples/{eventhub_namespace/102-evh_with_auth_rules => eventhub/102-namespace-and-evh-with-auth-rules}/standalone/main.tf (100%) rename examples/{eventhub_namespace/102-evh_with_auth_rules => eventhub/102-namespace-and-evh-with-auth-rules}/standalone/module.tf (100%) rename examples/{eventhub_namespace/102-evh_with_auth_rules => eventhub/102-namespace-and-evh-with-auth-rules}/standalone/readme.md (100%) rename examples/{eventhub_namespace/102-evh_with_auth_rules => eventhub/102-namespace-and-evh-with-auth-rules}/standalone/variables.tf (100%) create mode 100644 examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars create mode 100644 modules/event_hub/event_hub/auth_rules/auth_rules.tf create mode 100644 modules/event_hub/event_hub/auth_rules/main.tf create mode 100644 modules/event_hub/event_hub/auth_rules/output.tf create mode 100644 modules/event_hub/event_hub/auth_rules/variables.tf rename modules/{event_hub_namespaces => event_hub}/event_hub/event_hub.tf (69%) rename modules/{event_hub_namespaces => event_hub}/event_hub/main.tf (100%) create mode 100644 modules/event_hub/event_hub/output.tf rename modules/{event_hub_namespaces => event_hub}/event_hub/variables.tf (83%) create mode 100644 modules/event_hub/event_hub_consumer_groups/consumer_groups.tf create mode 100644 modules/event_hub/event_hub_consumer_groups/main.tf create mode 100644 modules/event_hub/event_hub_consumer_groups/output.tf create mode 100644 modules/event_hub/event_hub_consumer_groups/variables.tf rename modules/{ => event_hub}/event_hub_namespaces/README.md (100%) mode change 100755 => 100644 create mode 100644 modules/event_hub/event_hub_namespaces/auth_rules/auth_rules.tf create mode 100644 modules/event_hub/event_hub_namespaces/auth_rules/main.tf create mode 100644 modules/event_hub/event_hub_namespaces/auth_rules/output.tf create mode 100644 modules/event_hub/event_hub_namespaces/auth_rules/variables.tf create mode 100644 modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf rename modules/{ => event_hub}/event_hub_namespaces/main.tf (100%) mode change 100755 => 100644 rename modules/{ => event_hub}/event_hub_namespaces/output.tf (100%) mode change 100755 => 100644 rename modules/{ => event_hub}/event_hub_namespaces/variables.tf (100%) mode change 100755 => 100644 delete mode 100644 modules/event_hub_namespaces/event_hub/output.tf delete mode 100644 modules/event_hub_namespaces/event_hub_namespaces.tf diff --git a/.github/workflows/master-100.yaml b/.github/workflows/master-100.yaml index 6f9a162f0..1553390e5 100755 --- a/.github/workflows/master-100.yaml +++ b/.github/workflows/master-100.yaml @@ -99,8 +99,10 @@ jobs: "cosmos_db/100-simple-cosmos-db-cassandra", "databricks/100-simple-databricks", "datalake/101-datalake-storage", - "eventhub_namespace/100-simple-evh", - "eventhub_namespace/101-evh-with-private-endpoint", + "eventhub/100-simple-eventhub-namespace", + "eventhub/101-evh-namespace-with-private-endpoint", + "eventhub/102-namespace-and-evh-with-auth-rules", + "eventhub/103-eventhub-consumer-groups", "keyvault/102-keyvault-cert-issuer", "mariadb_server/100-simple-mariadb", "mariadb_server/101-vnet-rule-mariadb", diff --git a/.github/workflows/master-standalone.yaml b/.github/workflows/master-standalone.yaml index 9f55f62dd..94cfb8357 100755 --- a/.github/workflows/master-standalone.yaml +++ b/.github/workflows/master-standalone.yaml @@ -53,8 +53,9 @@ jobs: "cosmos_db/100-simple-cosmos-db-sql", "databricks/100-simple-databricks", "datalake/101-datalake-storage", - "eventhub_namespace/100-simple-evh", - "eventhub_namespace/101-evh-with-private-endpoint", + "eventhub/100-simple-eventhub-namespace", + "eventhub/101-evh-namespace-with-private-endpoint", + "eventhub/102-namespace-and-evh-with-auth-rules", "keyvault/101-keyvault-policies", "machine_learning/100-aml", "mariadb_server/100-simple-mariadb", diff --git a/diagnostics.tf b/diagnostics.tf index ebaf0f455..23e04214e 100644 --- a/diagnostics.tf +++ b/diagnostics.tf @@ -35,7 +35,7 @@ module diagnostic_storage_accounts { } module "diagnostic_event_hub_namespaces" { - source = "./modules/event_hub_namespaces" + source = "./modules/event_hub/event_hub_namespaces" for_each = local.diagnostics.diagnostic_event_hub_namespaces global_settings = local.global_settings diff --git a/event_hub_namespaces.tf b/event_hub.tf old mode 100755 new mode 100644 similarity index 60% rename from event_hub_namespaces.tf rename to event_hub.tf index b77eb334b..f040712bf --- a/event_hub_namespaces.tf +++ b/event_hub.tf @@ -1,6 +1,6 @@ module "event_hub_namespaces" { - source = "./modules/event_hub_namespaces" + source = "./modules/event_hub/event_hub_namespaces" for_each = var.event_hub_namespaces global_settings = local.global_settings @@ -10,6 +10,21 @@ module "event_hub_namespaces" { base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} } +module event_hub_namespace_auth_rules { + source = "./modules/event_hub/event_hub_namespaces/auth_rules" + for_each = try(var.event_hub_namespace_auth_rules, {}) + + resource_group_name = module.resource_groups[each.value.resource_group_key].name + client_config = local.client_config + global_settings = local.global_settings + settings = each.value + namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name + + depends_on = [ + module.event_hub_namespaces + ] +} + module event_hub_namespaces_diagnostics { source = "./modules/diagnostics" for_each = var.event_hub_namespaces @@ -66,7 +81,7 @@ locals { module event_hub { - source = "./modules/event_hub_namespaces/event_hub" + source = "./modules/event_hub/event_hub" depends_on = [module.event_hub_namespaces] for_each = try(var.event_hub, {}) @@ -74,7 +89,42 @@ module event_hub { client_config = local.client_config global_settings = local.global_settings settings = each.value - namespace_name = var.diagnostics.event_hub_namespaces[var.diagnostics.diagnostics_destinations.event_hub_namespaces[each.value.destination_key].event_hub_namespace_key].name + namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name + #namespace_name = var.diagnostics.event_hub_namespaces[var.diagnostics.diagnostics_destinations.event_hub_namespaces[each.value.destination_key].event_hub_namespace_key].name storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} +} + +module event_hub_auth_rules { + source = "./modules/event_hub/event_hub/auth_rules" + for_each = try(var.event_hub_auth_rules, {}) + + resource_group_name = module.resource_groups[each.value.resource_group_key].name + client_config = local.client_config + global_settings = local.global_settings + settings = each.value + namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name + eventhub_name = module.event_hub[each.value.event_hub_name_key].name + + depends_on = [ + module.event_hub_namespaces, + module.event_hub + ] +} + +module event_hub_consumer_groups { + source = "./modules/event_hub/event_hub_consumer_groups" + for_each = try(var.event_hub_consumer_groups, {}) + + resource_group_name = module.resource_groups[each.value.resource_group_key].name + client_config = local.client_config + global_settings = local.global_settings + settings = each.value + namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name + eventhub_name = module.event_hub[each.value.event_hub_name_key].name + + depends_on = [ + module.event_hub_namespaces, + module.event_hub + ] } \ No newline at end of file diff --git a/examples/eventhub_namespace/100-simple-evh/configuration.tfvars b/examples/eventhub/100-simple-eventhub-namespace/configuration.tfvars similarity index 100% rename from examples/eventhub_namespace/100-simple-evh/configuration.tfvars rename to examples/eventhub/100-simple-eventhub-namespace/configuration.tfvars diff --git a/examples/eventhub_namespace/100-simple-evh/standalone/ci.sh b/examples/eventhub/100-simple-eventhub-namespace/standalone/ci.sh old mode 100755 new mode 100644 similarity index 100% rename from examples/eventhub_namespace/100-simple-evh/standalone/ci.sh rename to examples/eventhub/100-simple-eventhub-namespace/standalone/ci.sh diff --git a/examples/eventhub_namespace/100-simple-evh/standalone/main.tf b/examples/eventhub/100-simple-eventhub-namespace/standalone/main.tf similarity index 100% rename from examples/eventhub_namespace/100-simple-evh/standalone/main.tf rename to examples/eventhub/100-simple-eventhub-namespace/standalone/main.tf diff --git a/examples/eventhub_namespace/100-simple-evh/standalone/module.tf b/examples/eventhub/100-simple-eventhub-namespace/standalone/module.tf similarity index 100% rename from examples/eventhub_namespace/100-simple-evh/standalone/module.tf rename to examples/eventhub/100-simple-eventhub-namespace/standalone/module.tf diff --git a/examples/eventhub_namespace/100-simple-evh/standalone/readme.md b/examples/eventhub/100-simple-eventhub-namespace/standalone/readme.md similarity index 100% rename from examples/eventhub_namespace/100-simple-evh/standalone/readme.md rename to examples/eventhub/100-simple-eventhub-namespace/standalone/readme.md diff --git a/examples/eventhub_namespace/100-simple-evh/standalone/variables.tf b/examples/eventhub/100-simple-eventhub-namespace/standalone/variables.tf similarity index 100% rename from examples/eventhub_namespace/100-simple-evh/standalone/variables.tf rename to examples/eventhub/100-simple-eventhub-namespace/standalone/variables.tf diff --git a/examples/eventhub_namespace/101-evh-with-private-endpoint/configuration.tfvars b/examples/eventhub/101-evh-namespace-with-private-endpoint/configuration.tfvars similarity index 100% rename from examples/eventhub_namespace/101-evh-with-private-endpoint/configuration.tfvars rename to examples/eventhub/101-evh-namespace-with-private-endpoint/configuration.tfvars diff --git a/examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/ci.sh b/examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/ci.sh old mode 100755 new mode 100644 similarity index 100% rename from examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/ci.sh rename to examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/ci.sh diff --git a/examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/main.tf b/examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/main.tf similarity index 100% rename from examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/main.tf rename to examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/main.tf diff --git a/examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/module.tf b/examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/module.tf similarity index 100% rename from examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/module.tf rename to examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/module.tf diff --git a/examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/readme.md b/examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/readme.md similarity index 100% rename from examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/readme.md rename to examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/readme.md diff --git a/examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/variables.tf b/examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/variables.tf similarity index 100% rename from examples/eventhub_namespace/101-evh-with-private-endpoint/standalone/variables.tf rename to examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/variables.tf diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars b/examples/eventhub/102-namespace-and-evh-with-auth-rules/configuration.tfvars similarity index 73% rename from examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars rename to examples/eventhub/102-namespace-and-evh-with-auth-rules/configuration.tfvars index 948f4ced0..66f5ef328 100644 --- a/examples/eventhub_namespace/102-evh_with_auth_rules/configuration.tfvars +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/configuration.tfvars @@ -8,15 +8,15 @@ global_settings = { } resource_groups = { - sec_center = { - name = "sec-center" + evh_examples = { + name = "evh_examples" } } storage_accounts = { evh1 = { name = "evh1" - resource_group_key = "sec_center" + resource_group_key = "evh_examples" account_kind = "BlobStorage" account_tier = "Standard" account_replication_type = "LRS" @@ -40,13 +40,21 @@ event_hub_namespaces = { event_hub = { ev = { name = "ev" - resource_group_key = "sec_center" + resource_group_key = "evh_examples" event_hub_namespace_key = "evh1" - destination_key = "central_logs" + #destination_key = "central_logs" storage_account_key = "evh1" blob_container_name = "evh" partition_count = "2" message_retention = "2" + } +} + +event_hub_auth_rules = { + rule1 = { + resource_group_key = "evh_examples" + event_hub_namespace_key = "evh1" + event_hub_name_key = "ev" rule_name = "ev-rule" listen = true send = true diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/ci.sh b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/ci.sh similarity index 100% rename from examples/eventhub_namespace/102-evh_with_auth_rules/standalone/ci.sh rename to examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/ci.sh diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/main.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf similarity index 100% rename from examples/eventhub_namespace/102-evh_with_auth_rules/standalone/main.tf rename to examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/module.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf similarity index 100% rename from examples/eventhub_namespace/102-evh_with_auth_rules/standalone/module.tf rename to examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/readme.md b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/readme.md similarity index 100% rename from examples/eventhub_namespace/102-evh_with_auth_rules/standalone/readme.md rename to examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/readme.md diff --git a/examples/eventhub_namespace/102-evh_with_auth_rules/standalone/variables.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf similarity index 100% rename from examples/eventhub_namespace/102-evh_with_auth_rules/standalone/variables.tf rename to examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf diff --git a/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars new file mode 100644 index 000000000..05fbd4e2c --- /dev/null +++ b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars @@ -0,0 +1,46 @@ +global_settings = { + default_region = "region1" + regions = { + region1 = "southeastasia" + } +} + +resource_groups = { + evh_examples = { + name = "evh_examples" + } +} + + + +event_hub_namespaces = { + evh1 = { + name = "evh1" + resource_group_key = "evh_examples" + sku = "Standard" + region = "region1" + } +} + +event_hub = { + ev = { + name = "ev" + resource_group_key = "evh_examples" + event_hub_namespace_key = "evh1" + #destination_key = "central_logs" + storage_account_key = "evh1" + blob_container_name = "evh" + partition_count = "2" + message_retention = "2" + } +} + +event_hub_consumer_groups = { + cg1 ={ + resource_group_key = "evh_examples" + event_hub_namespace_key = "evh1" + event_hub_name_key = "ev" + name = "example-cg" + user_metadata = "some_metadata" + } +} \ No newline at end of file diff --git a/examples/module.tf b/examples/module.tf index 7dcc373e3..71c1510b6 100644 --- a/examples/module.tf +++ b/examples/module.tf @@ -23,6 +23,9 @@ module "caf" { log_analytics = var.log_analytics event_hub_namespaces = var.event_hub_namespaces event_hub = var.event_hub + event_hub_auth_rules = var.event_hub_auth_rules + event_hub_namespace_auth_rules = var.event_hub_namespace_auth_rules + event_hub_consumer_groups = var.event_hub_consumer_groups webapp = { azurerm_application_insights = var.azurerm_application_insights diff --git a/examples/variables.tf b/examples/variables.tf index 1cc52612c..353252763 100644 --- a/examples/variables.tf +++ b/examples/variables.tf @@ -302,3 +302,15 @@ variable azurerm_firewall_application_rule_collection_definition { variable azurerm_firewall_nat_rule_collection_definition { default = {} } + +variable event_hub_auth_rules { + default = {} +} + +variable event_hub_namespace_auth_rules { + default = {} +} + +variable event_hub_consumer_groups { + default = {} +} \ No newline at end of file diff --git a/modules/event_hub/event_hub/auth_rules/auth_rules.tf b/modules/event_hub/event_hub/auth_rules/auth_rules.tf new file mode 100644 index 000000000..1eccd9386 --- /dev/null +++ b/modules/event_hub/event_hub/auth_rules/auth_rules.tf @@ -0,0 +1,19 @@ +resource "azurecaf_name" "evh_rule" { + name = var.settings.rule_name + resource_type = "azurerm_eventhub_authorization_rule" + prefixes = [var.global_settings.prefix] + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough + use_slug = var.global_settings.use_slug +} + +resource "azurerm_eventhub_authorization_rule" "evhub_rule" { + name = azurecaf_name.evh_rule.result + namespace_name = var.namespace_name + eventhub_name = var.eventhub_name + resource_group_name = var.resource_group_name + listen = var.settings.listen + send = var.settings.send + manage = var.settings.manage +} \ No newline at end of file diff --git a/modules/event_hub/event_hub/auth_rules/main.tf b/modules/event_hub/event_hub/auth_rules/main.tf new file mode 100644 index 000000000..5719db2c1 --- /dev/null +++ b/modules/event_hub/event_hub/auth_rules/main.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + azurecaf = { + source = "aztfmod/azurecaf" + } + } + required_version = ">= 0.13" +} + + +locals { + module_tag = { + "module" = basename(abspath(path.module)) + } + #tags = merge(local.module_tag, lookup(var.settings, "tags", {}), var.base_tags) +} diff --git a/modules/event_hub/event_hub/auth_rules/output.tf b/modules/event_hub/event_hub/auth_rules/output.tf new file mode 100644 index 000000000..b957d17c3 --- /dev/null +++ b/modules/event_hub/event_hub/auth_rules/output.tf @@ -0,0 +1,27 @@ +output id { + value = azurerm_eventhub_authorization_rule.evhub_rule.id +} + +output primary_connection_string_alias { + value = azurerm_eventhub_authorization_rule.evhub_rule.primary_connection_string_alias +} + +output secondary_connection_string_alias { + value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_connection_string_alias +} + +output primary_connection_string { + value = azurerm_eventhub_authorization_rule.evhub_rule.primary_connection_string +} + +output primary_key { + value = azurerm_eventhub_authorization_rule.evhub_rule.primary_key +} + +output secondary_connection_string { + value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_connection_string +} + +output secondary_key { + value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_key +} \ No newline at end of file diff --git a/modules/event_hub/event_hub/auth_rules/variables.tf b/modules/event_hub/event_hub/auth_rules/variables.tf new file mode 100644 index 000000000..edff89dfe --- /dev/null +++ b/modules/event_hub/event_hub/auth_rules/variables.tf @@ -0,0 +1,6 @@ +variable global_settings {} +variable settings {} +variable resource_group_name {} +variable client_config {} +variable namespace_name {} +variable eventhub_name {} diff --git a/modules/event_hub_namespaces/event_hub/event_hub.tf b/modules/event_hub/event_hub/event_hub.tf similarity index 69% rename from modules/event_hub_namespaces/event_hub/event_hub.tf rename to modules/event_hub/event_hub/event_hub.tf index 46a82c22b..3dba6aa39 100644 --- a/modules/event_hub_namespaces/event_hub/event_hub.tf +++ b/modules/event_hub/event_hub/event_hub.tf @@ -8,15 +8,6 @@ resource "azurecaf_name" "evhub" { use_slug = var.global_settings.use_slug } -resource "azurecaf_name" "evh_rule" { - name = var.settings.rule_name - resource_type = "azurerm_eventhub_authorization_rule" - prefixes = [var.global_settings.prefix] - random_length = var.global_settings.random_length - clean_input = true - passthrough = var.global_settings.passthrough - use_slug = var.global_settings.use_slug -} resource "azurerm_eventhub" "evhub" { name = azurecaf_name.evhub.result namespace_name = var.namespace_name @@ -45,12 +36,3 @@ resource "azurerm_eventhub" "evhub" { } } -resource "azurerm_eventhub_authorization_rule" "evhub_rule" { - name = azurecaf_name.evh_rule.result - namespace_name = var.namespace_name - eventhub_name = azurerm_eventhub.evhub.name - resource_group_name = var.resource_group_name - listen = var.settings.listen - send = var.settings.send - manage = var.settings.manage -} \ No newline at end of file diff --git a/modules/event_hub_namespaces/event_hub/main.tf b/modules/event_hub/event_hub/main.tf similarity index 100% rename from modules/event_hub_namespaces/event_hub/main.tf rename to modules/event_hub/event_hub/main.tf diff --git a/modules/event_hub/event_hub/output.tf b/modules/event_hub/event_hub/output.tf new file mode 100644 index 000000000..56451c218 --- /dev/null +++ b/modules/event_hub/event_hub/output.tf @@ -0,0 +1,9 @@ +output id { + value = azurerm_eventhub.evhub.id + sensitive = true +} + +output name { + description = "The EventHub name." + value = azurerm_eventhub.evhub.name +} \ No newline at end of file diff --git a/modules/event_hub_namespaces/event_hub/variables.tf b/modules/event_hub/event_hub/variables.tf similarity index 83% rename from modules/event_hub_namespaces/event_hub/variables.tf rename to modules/event_hub/event_hub/variables.tf index b6bdeadd3..f51ece03d 100644 --- a/modules/event_hub_namespaces/event_hub/variables.tf +++ b/modules/event_hub/event_hub/variables.tf @@ -4,4 +4,4 @@ variable resource_group_name {} variable base_tags {} variable client_config {} variable namespace_name {} -variable storage_account_id {} \ No newline at end of file +variable storage_account_id {} diff --git a/modules/event_hub/event_hub_consumer_groups/consumer_groups.tf b/modules/event_hub/event_hub_consumer_groups/consumer_groups.tf new file mode 100644 index 000000000..15e36a41d --- /dev/null +++ b/modules/event_hub/event_hub_consumer_groups/consumer_groups.tf @@ -0,0 +1,17 @@ +resource "azurecaf_name" "evhcg_name" { + name = var.settings.name + resource_type = "azurerm_eventhub_consumer_group" + prefixes = [var.global_settings.prefix] + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough + use_slug = var.global_settings.use_slug +} + +resource "azurerm_eventhub_consumer_group" "evhcg" { + name = azurecaf_name.evhcg_name.result + namespace_name = var.namespace_name + eventhub_name = var.eventhub_name + resource_group_name = var.resource_group_name + user_metadata = var.settings.user_metadata +} \ No newline at end of file diff --git a/modules/event_hub/event_hub_consumer_groups/main.tf b/modules/event_hub/event_hub_consumer_groups/main.tf new file mode 100644 index 000000000..5719db2c1 --- /dev/null +++ b/modules/event_hub/event_hub_consumer_groups/main.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + azurecaf = { + source = "aztfmod/azurecaf" + } + } + required_version = ">= 0.13" +} + + +locals { + module_tag = { + "module" = basename(abspath(path.module)) + } + #tags = merge(local.module_tag, lookup(var.settings, "tags", {}), var.base_tags) +} diff --git a/modules/event_hub/event_hub_consumer_groups/output.tf b/modules/event_hub/event_hub_consumer_groups/output.tf new file mode 100644 index 000000000..92a44e853 --- /dev/null +++ b/modules/event_hub/event_hub_consumer_groups/output.tf @@ -0,0 +1,3 @@ +output id { + value = azurerm_eventhub_consumer_group.evhcg.id +} \ No newline at end of file diff --git a/modules/event_hub/event_hub_consumer_groups/variables.tf b/modules/event_hub/event_hub_consumer_groups/variables.tf new file mode 100644 index 000000000..418d7b9b6 --- /dev/null +++ b/modules/event_hub/event_hub_consumer_groups/variables.tf @@ -0,0 +1,7 @@ +variable global_settings {} +variable settings {} +variable resource_group_name {} +variable client_config {} +variable namespace_name {} +variable eventhub_name {} + diff --git a/modules/event_hub_namespaces/README.md b/modules/event_hub/event_hub_namespaces/README.md old mode 100755 new mode 100644 similarity index 100% rename from modules/event_hub_namespaces/README.md rename to modules/event_hub/event_hub_namespaces/README.md diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/auth_rules.tf b/modules/event_hub/event_hub_namespaces/auth_rules/auth_rules.tf new file mode 100644 index 000000000..cffcf7d10 --- /dev/null +++ b/modules/event_hub/event_hub_namespaces/auth_rules/auth_rules.tf @@ -0,0 +1,18 @@ +resource "azurecaf_name" "evh_ns_rule_name" { + name = var.settings.rule_name + resource_type = "azurerm_eventhub_namespace_authorization_rule" + prefixes = [var.global_settings.prefix] + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough + use_slug = var.global_settings.use_slug +} + +resource "azurerm_eventhub_namespace_authorization_rule" "evh_ns_rule" { + name = azurecaf_name.evh_ns_rule_name.result + namespace_name = var.namespace_name + resource_group_name = var.resource_group_name + listen = var.settings.listen + send = var.settings.send + manage = var.settings.manage +} \ No newline at end of file diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/main.tf b/modules/event_hub/event_hub_namespaces/auth_rules/main.tf new file mode 100644 index 000000000..5719db2c1 --- /dev/null +++ b/modules/event_hub/event_hub_namespaces/auth_rules/main.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + azurecaf = { + source = "aztfmod/azurecaf" + } + } + required_version = ">= 0.13" +} + + +locals { + module_tag = { + "module" = basename(abspath(path.module)) + } + #tags = merge(local.module_tag, lookup(var.settings, "tags", {}), var.base_tags) +} diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/output.tf b/modules/event_hub/event_hub_namespaces/auth_rules/output.tf new file mode 100644 index 000000000..e18e3866a --- /dev/null +++ b/modules/event_hub/event_hub_namespaces/auth_rules/output.tf @@ -0,0 +1,27 @@ +output id { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.id +} + +output primary_connection_string_alias { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.primary_connection_string_alias +} + +output secondary_connection_string_alias { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.secondary_connection_string_alias +} + +output primary_connection_string { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.primary_connection_string +} + +output primary_key { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.primary_key +} + +output secondary_connection_string { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.secondary_connection_string +} + +output secondary_key { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.secondary_key +} \ No newline at end of file diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/variables.tf b/modules/event_hub/event_hub_namespaces/auth_rules/variables.tf new file mode 100644 index 000000000..3ee66779a --- /dev/null +++ b/modules/event_hub/event_hub_namespaces/auth_rules/variables.tf @@ -0,0 +1,5 @@ +variable global_settings {} +variable settings {} +variable resource_group_name {} +variable client_config {} +variable namespace_name {} diff --git a/modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf b/modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf new file mode 100644 index 000000000..41abb81d6 --- /dev/null +++ b/modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf @@ -0,0 +1,54 @@ +resource "azurecaf_name" "evh" { + name = var.settings.name + resource_type = "azurerm_eventhub_namespace" + prefixes = [var.global_settings.prefix] + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough + use_slug = var.global_settings.use_slug +} + +resource "azurerm_eventhub_namespace" "evh" { + name = azurecaf_name.evh.result + location = lookup(var.settings, "region", null) == null ? var.resource_groups[var.settings.resource_group_key].location : var.global_settings.regions[var.settings.region] + resource_group_name = var.resource_groups[var.settings.resource_group_key].name + sku = var.settings.sku + capacity = try(var.settings.capacity, null) + tags = local.tags + auto_inflate_enabled = try(var.settings.auto_inflate_enabled, null) + dedicated_cluster_id = try(var.settings.dedicated_cluster_id, null) + maximum_throughput_units = try(var.settings.maximum_throughput_units, null) + zone_redundant = try(var.settings.zone_redundant, null) + + dynamic "identity" { + for_each = try(var.settings.identity, {}) + content { + type = identity.value.type + } + } + + dynamic "network_rulesets" { + for_each = try(var.settings.network_rulesets, {}) + content { + default_action = network_rulesets.value.default_action #Possible values are Allow and Deny. Defaults to Deny. + trusted_service_access_enabled = try(network_rulesets.value.trusted_service_access_enabled, null) + + dynamic "virtual_network_rule" { + for_each = try(var.settings.network_rulesets.virtual_network_rule, {}) + content { + subnet_id = virtual_network_rule.value.subnet_id + ignore_missing_virtual_network_service_endpoint = try(virtual_network_rule.value.ignore_missing_virtual_network_service_endpoint, null) + } + } + + dynamic "ip_rule" { + for_each = try(var.settings.network_rulesets.ip_rule, {}) + content { + ip_mask = ip_rule.value.ip_mask + action = try(ip_rule.value.action, null) + } + } + } + } + + } diff --git a/modules/event_hub_namespaces/main.tf b/modules/event_hub/event_hub_namespaces/main.tf old mode 100755 new mode 100644 similarity index 100% rename from modules/event_hub_namespaces/main.tf rename to modules/event_hub/event_hub_namespaces/main.tf diff --git a/modules/event_hub_namespaces/output.tf b/modules/event_hub/event_hub_namespaces/output.tf old mode 100755 new mode 100644 similarity index 100% rename from modules/event_hub_namespaces/output.tf rename to modules/event_hub/event_hub_namespaces/output.tf diff --git a/modules/event_hub_namespaces/variables.tf b/modules/event_hub/event_hub_namespaces/variables.tf old mode 100755 new mode 100644 similarity index 100% rename from modules/event_hub_namespaces/variables.tf rename to modules/event_hub/event_hub_namespaces/variables.tf diff --git a/modules/event_hub_namespaces/event_hub/output.tf b/modules/event_hub_namespaces/event_hub/output.tf deleted file mode 100644 index 44bbec47d..000000000 --- a/modules/event_hub_namespaces/event_hub/output.tf +++ /dev/null @@ -1,5 +0,0 @@ -output id { - value = azurerm_eventhub.evhub.id - sensitive = true -} - diff --git a/modules/event_hub_namespaces/event_hub_namespaces.tf b/modules/event_hub_namespaces/event_hub_namespaces.tf deleted file mode 100644 index 96f25e630..000000000 --- a/modules/event_hub_namespaces/event_hub_namespaces.tf +++ /dev/null @@ -1,18 +0,0 @@ -resource "azurecaf_name" "evh" { - name = var.settings.name - resource_type = "azurerm_eventhub_namespace" - prefixes = [var.global_settings.prefix] - random_length = var.global_settings.random_length - clean_input = true - passthrough = var.global_settings.passthrough - use_slug = var.global_settings.use_slug -} - -resource "azurerm_eventhub_namespace" "evh" { - name = azurecaf_name.evh.result - location = lookup(var.settings, "region", null) == null ? var.resource_groups[var.settings.resource_group_key].location : var.global_settings.regions[var.settings.region] - resource_group_name = var.resource_groups[var.settings.resource_group_key].name - sku = var.settings.sku - capacity = try(var.settings.capacity, null) - tags = local.tags -} \ No newline at end of file diff --git a/variables.tf b/variables.tf index a95cedc18..318345f9a 100755 --- a/variables.tf +++ b/variables.tf @@ -239,3 +239,15 @@ variable event_hub { variable automations { default = {} } + +variable event_hub_auth_rules { + default = {} +} + +variable event_hub_namespace_auth_rules { + default = {} +} + +variable event_hub_consumer_groups { + default = {} +} \ No newline at end of file From 6417bf1e8366eb2ffa9f836dbdf55c09cc7413de Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Jan 2021 15:09:00 +0000 Subject: [PATCH 11/23] format code --- aks_clusters.tf | 4 ++-- app_service_environments.tf | 4 ++-- app_service_plans.tf | 4 ++-- application_gateways.tf | 8 ++++---- automations.tf | 4 ++-- availability_sets.tf | 4 ++-- azuread.tf | 12 ++++++------ azurerm_application_insights.tf | 4 ++-- container_registry.tf | 4 ++-- cosmos_db.tf | 4 ++-- databricks.tf | 4 ++-- diagnostics.tf | 4 ++-- event_hub.tf | 20 ++++++++++---------- front_door_waf_policies.tf | 4 ++-- keyvault.tf | 4 ++-- keyvault_certificate_issuers.tf | 4 ++-- machine_learning.tf | 4 ++-- managed_identities.tf | 4 ++-- mariadb_servers.tf | 4 ++-- mssql_databases.tf | 4 ++-- mssql_elastic_pools.tf | 4 ++-- mssql_servers.tf | 4 ++-- msssql_managed_databases.tf | 4 ++-- msssql_managed_instances.tf | 4 ++-- mysql_servers.tf | 4 ++-- networking.tf | 6 +++--- networking_express_route.tf | 8 ++++---- networking_firewall.tf | 4 ++-- networking_virtual_wan.tf | 4 ++-- output.tf | 2 +- postgresql_servers.tf | 4 ++-- proximity_placement_groups.tf | 4 ++-- recovery_vaults.tf | 4 ++-- resource_groups.tf | 4 ++-- storage_account_blobs.tf | 4 ++-- storage_accounts.tf | 4 ++-- synapses.tf | 4 ++-- virtual_machines.tf | 4 ++-- 38 files changed, 92 insertions(+), 92 deletions(-) diff --git a/aks_clusters.tf b/aks_clusters.tf index 1386688a6..cc23b836d 100755 --- a/aks_clusters.tf +++ b/aks_clusters.tf @@ -1,6 +1,6 @@ output aks_clusters { - value = module.aks_clusters - + value = module.aks_clusters + } module aks_clusters { diff --git a/app_service_environments.tf b/app_service_environments.tf index f34101709..293bd8298 100755 --- a/app_service_environments.tf +++ b/app_service_environments.tf @@ -24,6 +24,6 @@ module "app_service_environments" { output "app_service_environments" { - value = module.app_service_environments - + value = module.app_service_environments + } \ No newline at end of file diff --git a/app_service_plans.tf b/app_service_plans.tf index 87ecfc1dc..e6d8592b8 100755 --- a/app_service_plans.tf +++ b/app_service_plans.tf @@ -15,6 +15,6 @@ module "app_service_plans" { } output app_service_plans { - value = module.app_service_plans - + value = module.app_service_plans + } diff --git a/application_gateways.tf b/application_gateways.tf index 107c3d146..25efc6686 100644 --- a/application_gateways.tf +++ b/application_gateways.tf @@ -24,11 +24,11 @@ module application_gateways { } output application_gateways { - value = module.application_gateways - + value = module.application_gateways + } output application_gateway_applications { - value = local.networking.application_gateway_applications - + value = local.networking.application_gateway_applications + } diff --git a/automations.tf b/automations.tf index bb726e232..1f5b82805 100644 --- a/automations.tf +++ b/automations.tf @@ -12,6 +12,6 @@ module automations { } output automations { - value = module.automations - + value = module.automations + } diff --git a/availability_sets.tf b/availability_sets.tf index 0175ca907..7e01699a1 100644 --- a/availability_sets.tf +++ b/availability_sets.tf @@ -18,6 +18,6 @@ module availability_sets { output availability_sets { - value = module.availability_sets - + value = module.availability_sets + } \ No newline at end of file diff --git a/azuread.tf b/azuread.tf index ed80eb04c..a2fab6658 100755 --- a/azuread.tf +++ b/azuread.tf @@ -16,8 +16,8 @@ module azuread_applications { } output aad_apps { - value = module.azuread_applications - + value = module.azuread_applications + } # @@ -34,8 +34,8 @@ module azuread_groups { } output azuread_groups { - value = module.azuread_groups - + value = module.azuread_groups + } module azuread_groups_members { @@ -64,6 +64,6 @@ module azuread_users { } output azuread_users { - value = module.azuread_users - + value = module.azuread_users + } \ No newline at end of file diff --git a/azurerm_application_insights.tf b/azurerm_application_insights.tf index b03ee802e..392a9d33b 100755 --- a/azurerm_application_insights.tf +++ b/azurerm_application_insights.tf @@ -18,6 +18,6 @@ module "azurerm_application_insights" { } output application_insights { - value = module.azurerm_application_insights - + value = module.azurerm_application_insights + } \ No newline at end of file diff --git a/container_registry.tf b/container_registry.tf index f430691a5..2858fd3fe 100755 --- a/container_registry.tf +++ b/container_registry.tf @@ -22,7 +22,7 @@ module container_registry { } output azure_container_registries { - value = module.container_registry - + value = module.container_registry + } diff --git a/cosmos_db.tf b/cosmos_db.tf index 5b22edd33..d42303058 100644 --- a/cosmos_db.tf +++ b/cosmos_db.tf @@ -10,6 +10,6 @@ module cosmos_db { } output cosmos_db_id { - value = module.cosmos_db - + value = module.cosmos_db + } \ No newline at end of file diff --git a/databricks.tf b/databricks.tf index e4aae3391..444a40c2c 100644 --- a/databricks.tf +++ b/databricks.tf @@ -12,7 +12,7 @@ module databricks_workspaces { } output databricks_workspaces { - value = module.databricks_workspaces - + value = module.databricks_workspaces + } diff --git a/diagnostics.tf b/diagnostics.tf index 23e04214e..65ba27f9c 100644 --- a/diagnostics.tf +++ b/diagnostics.tf @@ -18,8 +18,8 @@ locals { # Output diagnostics output diagnostics { - value = local.combined_diagnostics - + value = local.combined_diagnostics + } module diagnostic_storage_accounts { diff --git a/event_hub.tf b/event_hub.tf index f040712bf..1d59e2b58 100644 --- a/event_hub.tf +++ b/event_hub.tf @@ -1,6 +1,6 @@ module "event_hub_namespaces" { - source = "./modules/event_hub/event_hub_namespaces" + source = "./modules/event_hub/event_hub_namespaces" for_each = var.event_hub_namespaces global_settings = local.global_settings @@ -11,15 +11,15 @@ module "event_hub_namespaces" { } module event_hub_namespace_auth_rules { - source = "./modules/event_hub/event_hub_namespaces/auth_rules" - for_each = try(var.event_hub_namespace_auth_rules, {}) + source = "./modules/event_hub/event_hub_namespaces/auth_rules" + for_each = try(var.event_hub_namespace_auth_rules, {}) resource_group_name = module.resource_groups[each.value.resource_group_key].name client_config = local.client_config global_settings = local.global_settings settings = each.value namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name - + depends_on = [ module.event_hub_namespaces ] @@ -91,13 +91,13 @@ module event_hub { settings = each.value namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name #namespace_name = var.diagnostics.event_hub_namespaces[var.diagnostics.diagnostics_destinations.event_hub_namespaces[each.value.destination_key].event_hub_namespace_key].name - storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) - base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} + storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) + base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} } module event_hub_auth_rules { - source = "./modules/event_hub/event_hub/auth_rules" - for_each = try(var.event_hub_auth_rules, {}) + source = "./modules/event_hub/event_hub/auth_rules" + for_each = try(var.event_hub_auth_rules, {}) resource_group_name = module.resource_groups[each.value.resource_group_key].name client_config = local.client_config @@ -113,8 +113,8 @@ module event_hub_auth_rules { } module event_hub_consumer_groups { - source = "./modules/event_hub/event_hub_consumer_groups" - for_each = try(var.event_hub_consumer_groups, {}) + source = "./modules/event_hub/event_hub_consumer_groups" + for_each = try(var.event_hub_consumer_groups, {}) resource_group_name = module.resource_groups[each.value.resource_group_key].name client_config = local.client_config diff --git a/front_door_waf_policies.tf b/front_door_waf_policies.tf index 5c8d73a46..bbaf10ee3 100644 --- a/front_door_waf_policies.tf +++ b/front_door_waf_policies.tf @@ -9,6 +9,6 @@ module "front_door_waf_policies" { } output front_door_waf_policies { - value = module.front_door_waf_policies - + value = module.front_door_waf_policies + } \ No newline at end of file diff --git a/keyvault.tf b/keyvault.tf index bd1cd1173..87e014b51 100755 --- a/keyvault.tf +++ b/keyvault.tf @@ -48,6 +48,6 @@ module "keyvault_access_policies_azuread_apps" { output keyvaults { - value = module.keyvaults - + value = module.keyvaults + } diff --git a/keyvault_certificate_issuers.tf b/keyvault_certificate_issuers.tf index 1b46bb956..df990bf2c 100644 --- a/keyvault_certificate_issuers.tf +++ b/keyvault_certificate_issuers.tf @@ -24,6 +24,6 @@ data "azurerm_key_vault_secret" "certificate_issuer_password" { } output keyvault_certificate_issuers { - value = module.keyvault_certificate_issuers - + value = module.keyvault_certificate_issuers + } diff --git a/machine_learning.tf b/machine_learning.tf index 093a6c6b3..b9b42d05a 100644 --- a/machine_learning.tf +++ b/machine_learning.tf @@ -15,7 +15,7 @@ module machine_learning_workspaces { } output machine_learning_workspaces { - value = module.machine_learning_workspaces - + value = module.machine_learning_workspaces + } diff --git a/managed_identities.tf b/managed_identities.tf index 662833c18..0b20a592b 100755 --- a/managed_identities.tf +++ b/managed_identities.tf @@ -11,6 +11,6 @@ module managed_identities { } output managed_identities { - value = module.managed_identities - + value = module.managed_identities + } diff --git a/mariadb_servers.tf b/mariadb_servers.tf index f24f574f6..2b8b21cac 100644 --- a/mariadb_servers.tf +++ b/mariadb_servers.tf @@ -1,7 +1,7 @@ output mariadb_servers { - value = module.mariadb_servers - + value = module.mariadb_servers + } module "mariadb_servers" { diff --git a/mssql_databases.tf b/mssql_databases.tf index 658c89501..99a45d299 100755 --- a/mssql_databases.tf +++ b/mssql_databases.tf @@ -1,7 +1,7 @@ output mssql_databases { - value = module.mssql_databases - + value = module.mssql_databases + } module "mssql_databases" { diff --git a/mssql_elastic_pools.tf b/mssql_elastic_pools.tf index b8a61fbc4..4540ae43a 100755 --- a/mssql_elastic_pools.tf +++ b/mssql_elastic_pools.tf @@ -1,7 +1,7 @@ output mssql_elastic_pools { - value = module.mssql_elastic_pools - + value = module.mssql_elastic_pools + } module "mssql_elastic_pools" { diff --git a/mssql_servers.tf b/mssql_servers.tf index ff07c0c28..a0532b834 100755 --- a/mssql_servers.tf +++ b/mssql_servers.tf @@ -1,7 +1,7 @@ output mssql_servers { - value = module.mssql_servers - + value = module.mssql_servers + } module "mssql_servers" { diff --git a/msssql_managed_databases.tf b/msssql_managed_databases.tf index 0e83cd77f..e08ed06ac 100644 --- a/msssql_managed_databases.tf +++ b/msssql_managed_databases.tf @@ -1,7 +1,7 @@ output mssql_managed_databases { - value = module.mssql_managed_databases - + value = module.mssql_managed_databases + } module "mssql_managed_databases" { diff --git a/msssql_managed_instances.tf b/msssql_managed_instances.tf index 9ead52999..7244ddff7 100644 --- a/msssql_managed_instances.tf +++ b/msssql_managed_instances.tf @@ -1,7 +1,7 @@ output mssql_managed_instances { - value = module.mssql_managed_instances - + value = module.mssql_managed_instances + } module "mssql_managed_instances" { diff --git a/mysql_servers.tf b/mysql_servers.tf index f5648f49d..5d648f0eb 100644 --- a/mysql_servers.tf +++ b/mysql_servers.tf @@ -1,7 +1,7 @@ output mysql_servers { - value = module.mysql_servers - + value = module.mysql_servers + } module "mysql_servers" { diff --git a/networking.tf b/networking.tf index e8c66b9b1..89439420d 100755 --- a/networking.tf +++ b/networking.tf @@ -1,12 +1,12 @@ output vnets { depends_on = [azurerm_virtual_network_peering.peering] value = module.networking - + } output public_ip_addresses { - value = module.public_ip_addresses - + value = module.public_ip_addresses + } diff --git a/networking_express_route.tf b/networking_express_route.tf index a47dceeb7..f9319d3cd 100644 --- a/networking_express_route.tf +++ b/networking_express_route.tf @@ -34,13 +34,13 @@ module express_route_circuit_authorizations { # Outputs output express_route_circuits { - value = module.express_route_circuits - + value = module.express_route_circuits + description = "Express Route Circuit output" } output express_route_circuit_authorizations { - value = module.express_route_circuit_authorizations - + value = module.express_route_circuit_authorizations + description = "Express Route Circuit Authorizations Keys output" } diff --git a/networking_firewall.tf b/networking_firewall.tf index 6f9f4eb16..8f5b0c0fe 100755 --- a/networking_firewall.tf +++ b/networking_firewall.tf @@ -61,6 +61,6 @@ module azurerm_firewall_nat_rule_collections { } output azurerm_firewalls { - value = module.azurerm_firewalls - + value = module.azurerm_firewalls + } diff --git a/networking_virtual_wan.tf b/networking_virtual_wan.tf index 3c2587fc7..1ff80370e 100644 --- a/networking_virtual_wan.tf +++ b/networking_virtual_wan.tf @@ -37,7 +37,7 @@ resource "azurerm_virtual_hub_connection" "vhub_connection" { # Outputs output virtual_wans { - value = module.virtual_wans - + value = module.virtual_wans + description = "Virtual WAN output" } diff --git a/output.tf b/output.tf index b93713b33..bd2a291b9 100755 --- a/output.tf +++ b/output.tf @@ -5,5 +5,5 @@ output client_config { subscription_id = local.client_config.subscription_id landingzone_key = local.client_config.landingzone_key } - + } \ No newline at end of file diff --git a/postgresql_servers.tf b/postgresql_servers.tf index 8f0174759..8419f806a 100644 --- a/postgresql_servers.tf +++ b/postgresql_servers.tf @@ -1,7 +1,7 @@ output postgresql_servers { - value = module.postgresql_servers - + value = module.postgresql_servers + } module "postgresql_servers" { diff --git a/proximity_placement_groups.tf b/proximity_placement_groups.tf index bc7cff142..143f54540 100644 --- a/proximity_placement_groups.tf +++ b/proximity_placement_groups.tf @@ -14,6 +14,6 @@ module proximity_placement_groups { output proximity_placement_groups { - value = module.proximity_placement_groups - + value = module.proximity_placement_groups + } diff --git a/recovery_vaults.tf b/recovery_vaults.tf index 6cda98c33..a7de39b98 100644 --- a/recovery_vaults.tf +++ b/recovery_vaults.tf @@ -18,6 +18,6 @@ module recovery_vaults { } output recovery_vaults { - value = module.recovery_vaults - + value = module.recovery_vaults + } diff --git a/resource_groups.tf b/resource_groups.tf index 3b7e5b24d..c025b5cd5 100755 --- a/resource_groups.tf +++ b/resource_groups.tf @@ -10,6 +10,6 @@ module resource_groups { } output resource_groups { - value = module.resource_groups - + value = module.resource_groups + } \ No newline at end of file diff --git a/storage_account_blobs.tf b/storage_account_blobs.tf index 7820365e5..48064a6ed 100644 --- a/storage_account_blobs.tf +++ b/storage_account_blobs.tf @@ -22,6 +22,6 @@ module "storage_account_blobs" { } output storage_account_blobs { - value = module.storage_account_blobs - + value = module.storage_account_blobs + } diff --git a/storage_accounts.tf b/storage_accounts.tf index de598afa6..fdbe114c3 100755 --- a/storage_accounts.tf +++ b/storage_accounts.tf @@ -17,6 +17,6 @@ module "storage_accounts" { } output storage_accounts { - value = module.storage_accounts - + value = module.storage_accounts + } diff --git a/synapses.tf b/synapses.tf index d7c2ccc0a..152613d28 100644 --- a/synapses.tf +++ b/synapses.tf @@ -13,8 +13,8 @@ module synapse_workspaces { } output synapse_workspaces { - value = module.synapse_workspaces - + value = module.synapse_workspaces + } diff --git a/virtual_machines.tf b/virtual_machines.tf index 50e17d050..fe4ac5d13 100644 --- a/virtual_machines.tf +++ b/virtual_machines.tf @@ -30,7 +30,7 @@ module virtual_machines { output virtual_machines { - value = module.virtual_machines - + value = module.virtual_machines + } From f265b9acd7b15f78b90e511bcd9e5e0ed0d4714d Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Jan 2021 15:27:12 +0000 Subject: [PATCH 12/23] resolve conflicts --- msssql_managed_instances.tf | 3 --- 1 file changed, 3 deletions(-) diff --git a/msssql_managed_instances.tf b/msssql_managed_instances.tf index 441b0ba2a..151d2e55c 100644 --- a/msssql_managed_instances.tf +++ b/msssql_managed_instances.tf @@ -2,13 +2,10 @@ output mssql_managed_instances { value = module.mssql_managed_instances -<<<<<<< HEAD -======= } output mssql_managed_instances_secondary { value = module.mssql_managed_instances_secondary sensitive = true ->>>>>>> 11b4102de1016fdea27a581399f04b913918aaf4 } module "mssql_managed_instances" { From 665941f3492e2fadfdcf6d2833ef431e370fb0ec Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Jan 2021 15:55:49 +0000 Subject: [PATCH 13/23] update permissions for ci.sh --- examples/eventhub/100-simple-eventhub-namespace/standalone/ci.sh | 0 .../101-evh-namespace-with-private-endpoint/standalone/ci.sh | 0 .../102-namespace-and-evh-with-auth-rules/standalone/ci.sh | 0 3 files changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 examples/eventhub/100-simple-eventhub-namespace/standalone/ci.sh mode change 100644 => 100755 examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/ci.sh mode change 100644 => 100755 examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/ci.sh diff --git a/examples/eventhub/100-simple-eventhub-namespace/standalone/ci.sh b/examples/eventhub/100-simple-eventhub-namespace/standalone/ci.sh old mode 100644 new mode 100755 diff --git a/examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/ci.sh b/examples/eventhub/101-evh-namespace-with-private-endpoint/standalone/ci.sh old mode 100644 new mode 100755 diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/ci.sh b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/ci.sh old mode 100644 new mode 100755 From a5220f8ca2f477468003df65e53b19769bb959cb Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Jan 2021 16:14:06 +0000 Subject: [PATCH 14/23] add standalone module for 103-eventhub-consumer-groups --- .../standalone/readme.md | 4 +- .../standalone/module.tf | 4 +- .../standalone/readme.md | 4 +- .../standalone/variables.tf | 15 +++++++ .../standalone/ci.sh | 25 +++++++++++ .../standalone/main.tf | 43 +++++++++++++++++++ .../standalone/module.tf | 11 +++++ .../standalone/readme.md | 23 ++++++++++ .../standalone/variables.tf | 33 ++++++++++++++ 9 files changed, 157 insertions(+), 5 deletions(-) create mode 100755 examples/eventhub/103-eventhub-consumer-groups/standalone/ci.sh create mode 100644 examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf create mode 100644 examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf create mode 100644 examples/eventhub/103-eventhub-consumer-groups/standalone/readme.md create mode 100644 examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf diff --git a/examples/eventhub/100-simple-eventhub-namespace/standalone/readme.md b/examples/eventhub/100-simple-eventhub-namespace/standalone/readme.md index 99abc9b48..a469b8c4a 100644 --- a/examples/eventhub/100-simple-eventhub-namespace/standalone/readme.md +++ b/examples/eventhub/100-simple-eventhub-namespace/standalone/readme.md @@ -1,7 +1,7 @@ You can test this module outside of a landingzone using ```bash -cd /tf/caf/examples/eventhub_namespace/100-simple-evh/standalone +cd /tf/caf/examples/eventhub/100-simple-eventhub-namespace/standalone terraform init @@ -17,7 +17,7 @@ To test this deployment in the example landingzone. Make sure the launchpad has rover \ -lz /tf/caf/aztfmod/examples \ - -var-folder /tf/caf/examples/eventhub_namespace/100-simple-evh/ \ + -var-folder /tf/caf/examples/eventhub/100-simple-eventhub-namespace/ \ -level level1 \ -a plan diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf index 819f19e98..555e9e43f 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf @@ -4,6 +4,8 @@ module "caf" { tags = var.tags resource_groups = var.resource_groups storage_accounts = var.storage_accounts - + event_hub = var.event_hub + event_hub_auth_rules = var.event_hub_auth_rules + event_hub_namespaces = var.event_hub_namespaces } diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/readme.md b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/readme.md index 322a62144..d8e035945 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/readme.md +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/readme.md @@ -1,7 +1,7 @@ You can test this module outside of a landingzone using ```bash -cd /tf/caf/examples/eventhub_namespace/102-evh_with_auth_rules/standalone +cd /tf/caf/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone terraform init @@ -16,7 +16,7 @@ To test this deployment in the example landingzone. Make sure the launchpad has rover \ -lz /tf/caf/aztfmod/examples \ - -var-folder /tf/caf/examples/eventhub_namespace/102-evh_with_auth_rules/ \ + -var-folder /tf/caf/examples/eventhub/102-namespace-and-evh-with-auth-rules/ \ -level level1 \ -a plan diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf index 30b9a6b0a..fdde5caf0 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf @@ -11,8 +11,23 @@ variable storage_accounts { } variable tags { + default = null + type = map +} + +variable event_hub_namespaces { + default ={} +} + +variable event_hub_auth_rules { default = {} } +variable event_hub { + default ={} +} +variable var_folder_path { + default = {} +} diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/ci.sh b/examples/eventhub/103-eventhub-consumer-groups/standalone/ci.sh new file mode 100755 index 000000000..18f3fec48 --- /dev/null +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/ci.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +set -e + +current_folder=$(pwd) +cd standalone + +terraform init + +terraform apply \ + -var-file ../configuration.tfvars \ + -var tags='{testing_job_id="${1}"}' \ + -var var_folder_path=${current_folder} \ + -input=false \ + -auto-approve + + +terraform destroy \ + -var-file ../configuration.tfvars \ + -var tags='{testing_job_id="${1}"}' \ + -var tags='{testing_job_id="${1}"}' \ + -var var_folder_path=${current_folder} \ + -input=false \ + -auto-approve + diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf new file mode 100644 index 000000000..84ff4f978 --- /dev/null +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf @@ -0,0 +1,43 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 2.40.0" + } + azuread = { + source = "hashicorp/azuread" + version = "~> 1.0.0" + } + random = { + source = "hashicorp/random" + version = "~> 2.2.1" + } + null = { + source = "hashicorp/null" + version = "~> 2.1.0" + } + external = { + source = "hashicorp/external" + version = "~> 1.2.0" + } + tls = { + source = "hashicorp/tls" + version = "~> 2.2.0" + } + azurecaf = { + source = "aztfmod/azurecaf" + version = "~> 1.1.0" + } + } + required_version = ">= 0.13" +} + + +provider "azurerm" { + features { + key_vault { + purge_soft_delete_on_destroy = true + } + } +} + diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf new file mode 100644 index 000000000..555e9e43f --- /dev/null +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf @@ -0,0 +1,11 @@ +module "caf" { + source = "../../../../../caf" + global_settings = var.global_settings + tags = var.tags + resource_groups = var.resource_groups + storage_accounts = var.storage_accounts + event_hub = var.event_hub + event_hub_auth_rules = var.event_hub_auth_rules + event_hub_namespaces = var.event_hub_namespaces +} + diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/readme.md b/examples/eventhub/103-eventhub-consumer-groups/standalone/readme.md new file mode 100644 index 000000000..47527bc98 --- /dev/null +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/readme.md @@ -0,0 +1,23 @@ +You can test this module outside of a landingzone using + +```bash +cd /tf/caf/examples/eventhub/103-eventhub-consumer-groups/standalone + +terraform init + +terraform plan \ + -var-file ../configuration.tfvars + +``` + +To test this deployment in the example landingzone. Make sure the launchpad has been deployed first + +```bash + +rover \ + -lz /tf/caf/aztfmod/examples \ + -var-folder /tf/caf/examples/eventhub/103-eventhub-consumer-groups/ \ + -level level1 \ + -a plan + +``` \ No newline at end of file diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf new file mode 100644 index 000000000..fdde5caf0 --- /dev/null +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf @@ -0,0 +1,33 @@ +variable global_settings { + default = {} +} + +variable resource_groups { + default = null +} + +variable storage_accounts { + default = {} +} + +variable tags { + default = null + type = map +} + +variable event_hub_namespaces { + default ={} +} + +variable event_hub_auth_rules { + default = {} +} + +variable event_hub { + default ={} +} + +variable var_folder_path { + default = {} +} + From 020fbbfa06d7d1603df76c598823dd0c21db4637 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Jan 2021 16:17:27 +0000 Subject: [PATCH 15/23] update CI file --- .github/workflows/master-standalone.yaml | 1 + examples/variables.tf | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/master-standalone.yaml b/.github/workflows/master-standalone.yaml index 3131728c2..d8421e17d 100755 --- a/.github/workflows/master-standalone.yaml +++ b/.github/workflows/master-standalone.yaml @@ -56,6 +56,7 @@ jobs: "eventhub/100-simple-eventhub-namespace", "eventhub/101-evh-namespace-with-private-endpoint", "eventhub/102-namespace-and-evh-with-auth-rules", + "eventhub/103-eventhub-consumer-groups", "keyvault/101-keyvault-policies", "machine_learning/100-aml", "mariadb_server/100-simple-mariadb", diff --git a/examples/variables.tf b/examples/variables.tf index 1c6fff5c8..d7a3ecb7e 100644 --- a/examples/variables.tf +++ b/examples/variables.tf @@ -328,6 +328,3 @@ variable event_hub_consumer_groups { default = {} } -variable automations { - default = {} -} \ No newline at end of file From 313850daa310ad5b7daa48d73c5a424547eea03e Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Jan 2021 16:22:47 +0000 Subject: [PATCH 16/23] update module path --- .../102-namespace-and-evh-with-auth-rules/standalone/module.tf | 2 +- .../eventhub/103-eventhub-consumer-groups/standalone/module.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf index 555e9e43f..0cd129625 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf @@ -1,5 +1,5 @@ module "caf" { - source = "../../../../../caf" + source = "../../../../" global_settings = var.global_settings tags = var.tags resource_groups = var.resource_groups diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf index 555e9e43f..0cd129625 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf @@ -1,5 +1,5 @@ module "caf" { - source = "../../../../../caf" + source = "../../../../" global_settings = var.global_settings tags = var.tags resource_groups = var.resource_groups From c3731411b201f515bf0d73c3f0102444fb0c0206 Mon Sep 17 00:00:00 2001 From: Ben Date: Thu, 28 Jan 2021 08:44:27 +0800 Subject: [PATCH 17/23] update azurerm version --- .../102-namespace-and-evh-with-auth-rules/standalone/main.tf | 2 +- .../eventhub/103-eventhub-consumer-groups/standalone/main.tf | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf index 84ff4f978..65968a056 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 2.40.0" + version = "~> 2.43.0" } azuread = { source = "hashicorp/azuread" diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf index 84ff4f978..65968a056 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 2.40.0" + version = "~> 2.43.0" } azuread = { source = "hashicorp/azuread" From 971cbe2ca4664342665d915e0cfa75b35b77aa70 Mon Sep 17 00:00:00 2001 From: lolorol Date: Fri, 29 Jan 2021 01:29:57 +0000 Subject: [PATCH 18/23] Refactor the patterns --- diagnostics.tf | 5 +- event_hub.tf => event_hubs.tf | 39 ++++----- .../configuration.tfvars | 24 +++--- .../standalone/module.tf | 14 ++-- .../standalone/variables.tf | 6 +- .../configuration.tfvars | 81 ++++++++++++++++--- .../standalone/module.tf | 19 ++--- .../standalone/variables.tf | 9 ++- .../event_hub/event_hub/auth_rules/output.tf | 27 ------- .../event_hub_namespaces/auth_rules/output.tf | 27 ------- .../event_hub_namespaces.tf | 54 ------------- .../event_hub/event_hub_namespaces/output.tf | 35 -------- .../consumer_groups}/consumer_groups.tf | 0 .../consumer_groups}/main.tf | 0 .../consumer_groups}/output.tf | 0 .../consumer_groups}/variables.tf | 0 modules/event_hubs/hubs/auth_rules.tf | 11 +++ .../hubs}/auth_rules/auth_rules.tf | 0 .../hubs/auth_rules}/main.tf | 0 modules/event_hubs/hubs/auth_rules/output.tf | 27 +++++++ .../hubs}/auth_rules/variables.tf | 0 .../hubs}/event_hub.tf | 18 ++--- .../event_hub => event_hubs/hubs}/main.tf | 0 .../event_hub => event_hubs/hubs}/output.tf | 0 .../hubs}/variables.tf | 0 .../namespaces}/README.md | 0 modules/event_hubs/namespaces/auth_rules.tf | 10 +++ .../namespaces}/auth_rules/auth_rules.tf | 0 .../namespaces}/auth_rules/main.tf | 0 .../namespaces/auth_rules/output.tf | 21 +++++ .../namespaces}/auth_rules/variables.tf | 0 .../namespaces/event_hub_namespaces.tf | 54 +++++++++++++ modules/event_hubs/namespaces/event_hubs.tf | 12 +++ .../namespaces}/main.tf | 0 modules/event_hubs/namespaces/output.tf | 19 +++++ .../namespaces}/variables.tf | 6 +- variables.tf | 2 +- 37 files changed, 298 insertions(+), 222 deletions(-) rename event_hub.tf => event_hubs.tf (73%) delete mode 100644 modules/event_hub/event_hub/auth_rules/output.tf delete mode 100644 modules/event_hub/event_hub_namespaces/auth_rules/output.tf delete mode 100644 modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf delete mode 100644 modules/event_hub/event_hub_namespaces/output.tf rename modules/{event_hub/event_hub_consumer_groups => event_hubs/consumer_groups}/consumer_groups.tf (100%) rename modules/{event_hub/event_hub/auth_rules => event_hubs/consumer_groups}/main.tf (100%) rename modules/{event_hub/event_hub_consumer_groups => event_hubs/consumer_groups}/output.tf (100%) rename modules/{event_hub/event_hub_consumer_groups => event_hubs/consumer_groups}/variables.tf (100%) create mode 100644 modules/event_hubs/hubs/auth_rules.tf rename modules/{event_hub/event_hub => event_hubs/hubs}/auth_rules/auth_rules.tf (100%) rename modules/{event_hub/event_hub_consumer_groups => event_hubs/hubs/auth_rules}/main.tf (100%) create mode 100644 modules/event_hubs/hubs/auth_rules/output.tf rename modules/{event_hub/event_hub => event_hubs/hubs}/auth_rules/variables.tf (100%) rename modules/{event_hub/event_hub => event_hubs/hubs}/event_hub.tf (64%) rename modules/{event_hub/event_hub => event_hubs/hubs}/main.tf (100%) rename modules/{event_hub/event_hub => event_hubs/hubs}/output.tf (100%) rename modules/{event_hub/event_hub => event_hubs/hubs}/variables.tf (100%) rename modules/{event_hub/event_hub_namespaces => event_hubs/namespaces}/README.md (100%) create mode 100644 modules/event_hubs/namespaces/auth_rules.tf rename modules/{event_hub/event_hub_namespaces => event_hubs/namespaces}/auth_rules/auth_rules.tf (100%) rename modules/{event_hub/event_hub_namespaces => event_hubs/namespaces}/auth_rules/main.tf (100%) create mode 100644 modules/event_hubs/namespaces/auth_rules/output.tf rename modules/{event_hub/event_hub_namespaces => event_hubs/namespaces}/auth_rules/variables.tf (100%) create mode 100644 modules/event_hubs/namespaces/event_hub_namespaces.tf create mode 100644 modules/event_hubs/namespaces/event_hubs.tf rename modules/{event_hub/event_hub_namespaces => event_hubs/namespaces}/main.tf (100%) create mode 100644 modules/event_hubs/namespaces/output.tf rename modules/{event_hub/event_hub_namespaces => event_hubs/namespaces}/variables.tf (77%) diff --git a/diagnostics.tf b/diagnostics.tf index 65ba27f9c..9de5d4a14 100644 --- a/diagnostics.tf +++ b/diagnostics.tf @@ -35,12 +35,13 @@ module diagnostic_storage_accounts { } module "diagnostic_event_hub_namespaces" { - source = "./modules/event_hub/event_hub_namespaces" + source = "./modules/event_hubs/namespaces" for_each = local.diagnostics.diagnostic_event_hub_namespaces global_settings = local.global_settings settings = each.value - resource_groups = module.resource_groups + resource_group_name = module.resource_groups[each.value.resource_group_key].name + location = lookup(each.value, "region", null) == null ? module.resource_groups[each.value.resource_group_key].location : local.global_settings.regions[each.value.region] client_config = local.client_config base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} } diff --git a/event_hub.tf b/event_hubs.tf similarity index 73% rename from event_hub.tf rename to event_hubs.tf index 1d59e2b58..b56df6c24 100644 --- a/event_hub.tf +++ b/event_hubs.tf @@ -1,17 +1,19 @@ module "event_hub_namespaces" { - source = "./modules/event_hub/event_hub_namespaces" + source = "./modules/event_hubs/namespaces" for_each = var.event_hub_namespaces - global_settings = local.global_settings - settings = each.value - resource_groups = module.resource_groups - client_config = local.client_config - base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} + global_settings = local.global_settings + settings = each.value + storage_accounts = local.combined_objects_storage_accounts + resource_group_name = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][each.value.resource_group.key].name + location = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][each.value.resource_group.key].location + client_config = local.client_config + base_tags = try(local.global_settings.inherit_tags, false) ? local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][each.value.resource_group.key].tags : {} } module event_hub_namespace_auth_rules { - source = "./modules/event_hub/event_hub_namespaces/auth_rules" + source = "./modules/event_hubs/namespaces/auth_rules" for_each = try(var.event_hub_namespace_auth_rules, {}) resource_group_name = module.resource_groups[each.value.resource_group_key].name @@ -80,23 +82,22 @@ locals { } -module event_hub { - source = "./modules/event_hub/event_hub" +module event_hubs { + source = "./modules/event_hubs/hubs" depends_on = [module.event_hub_namespaces] - for_each = try(var.event_hub, {}) + for_each = try(var.event_hubs, {}) resource_group_name = module.resource_groups[each.value.resource_group_key].name client_config = local.client_config global_settings = local.global_settings settings = each.value namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name - #namespace_name = var.diagnostics.event_hub_namespaces[var.diagnostics.diagnostics_destinations.event_hub_namespaces[each.value.destination_key].event_hub_namespace_key].name - storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) - base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} + storage_account_id = try(module.storage_accounts[each.value.storage_account_key].id, null) + base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} } module event_hub_auth_rules { - source = "./modules/event_hub/event_hub/auth_rules" + source = "./modules/event_hubs/hubs/auth_rules" for_each = try(var.event_hub_auth_rules, {}) resource_group_name = module.resource_groups[each.value.resource_group_key].name @@ -104,16 +105,16 @@ module event_hub_auth_rules { global_settings = local.global_settings settings = each.value namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name - eventhub_name = module.event_hub[each.value.event_hub_name_key].name + eventhub_name = module.event_hubs[each.value.event_hub_name_key].name depends_on = [ module.event_hub_namespaces, - module.event_hub + module.event_hubs ] } module event_hub_consumer_groups { - source = "./modules/event_hub/event_hub_consumer_groups" + source = "./modules/event_hubs/consumer_groups" for_each = try(var.event_hub_consumer_groups, {}) resource_group_name = module.resource_groups[each.value.resource_group_key].name @@ -121,10 +122,10 @@ module event_hub_consumer_groups { global_settings = local.global_settings settings = each.value namespace_name = module.event_hub_namespaces[each.value.event_hub_namespace_key].name - eventhub_name = module.event_hub[each.value.event_hub_name_key].name + eventhub_name = module.event_hubs[each.value.event_hub_name_key].name depends_on = [ module.event_hub_namespaces, - module.event_hub + module.event_hubs ] } \ No newline at end of file diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/configuration.tfvars b/examples/eventhub/102-namespace-and-evh-with-auth-rules/configuration.tfvars index 66f5ef328..202bfe26b 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/configuration.tfvars +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/configuration.tfvars @@ -37,27 +37,27 @@ event_hub_namespaces = { } } -event_hub = { +event_hubs = { ev = { - name = "ev" - resource_group_key = "evh_examples" + name = "ev" + resource_group_key = "evh_examples" event_hub_namespace_key = "evh1" #destination_key = "central_logs" storage_account_key = "evh1" blob_container_name = "evh" - partition_count = "2" - message_retention = "2" + partition_count = "2" + message_retention = "2" } } -event_hub_auth_rules = { +event_hub_auth_rules = { rule1 = { - resource_group_key = "evh_examples" + resource_group_key = "evh_examples" event_hub_namespace_key = "evh1" - event_hub_name_key = "ev" - rule_name = "ev-rule" - listen = true - send = true - manage = false + event_hub_name_key = "ev" + rule_name = "ev-rule" + listen = true + send = true + manage = false } } \ No newline at end of file diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf index 0cd129625..9868087ff 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/module.tf @@ -1,11 +1,11 @@ module "caf" { - source = "../../../../" - global_settings = var.global_settings - tags = var.tags - resource_groups = var.resource_groups - storage_accounts = var.storage_accounts - event_hub = var.event_hub + source = "../../../../" + global_settings = var.global_settings + tags = var.tags + resource_groups = var.resource_groups + storage_accounts = var.storage_accounts + event_hubs = var.event_hubs event_hub_auth_rules = var.event_hub_auth_rules event_hub_namespaces = var.event_hub_namespaces } - + diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf index fdde5caf0..e4c9746eb 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/variables.tf @@ -16,15 +16,15 @@ variable tags { } variable event_hub_namespaces { - default ={} + default = {} } variable event_hub_auth_rules { default = {} } -variable event_hub { - default ={} +variable event_hubs { + default = {} } variable var_folder_path { diff --git a/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars index 05fbd4e2c..6c3bd0a8d 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars +++ b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars @@ -12,35 +12,90 @@ resource_groups = { } +storage_accounts = { + evh1 = { + name = "evh1" + resource_group_key = "evh_examples" + account_kind = "BlobStorage" + account_tier = "Standard" + account_replication_type = "LRS" + containers = { + evh = { + name = "evh" + } + } + } +} + event_hub_namespaces = { evh1 = { - name = "evh1" - resource_group_key = "evh_examples" - sku = "Standard" - region = "region1" + name = "evh1" + resource_group = { + key = "evh_examples" + } + sku = "Standard" + region = "region1" + + event_hubs = { + gaming = { + name = "gaming" + storage_account = { + key = "evh1" + } + blob_container_name = "evh" + partition_count = "2" + message_retention = "2" + + auth_rules = { + mobile_apps_ios = { + rule_name = "mobile-app-ios" + listen = true + send = true + manage = false + } + mobile_apps_android = { + rule_name = "mobile-app-android" + listen = true + send = true + manage = false + } + } // auth_rules + + } + } // event_hubs + + auth_rules = { + siem = { + rule_name = "siem" + listen = true + send = false + manage = false + } + } // auth_rules + } } -event_hub = { +event_hubs = { ev = { - name = "ev" - resource_group_key = "evh_examples" + name = "ev" + resource_group_key = "evh_examples" event_hub_namespace_key = "evh1" #destination_key = "central_logs" storage_account_key = "evh1" blob_container_name = "evh" - partition_count = "2" - message_retention = "2" + partition_count = "2" + message_retention = "2" } } event_hub_consumer_groups = { - cg1 ={ - resource_group_key = "evh_examples" + cg1 = { + resource_group_key = "evh_examples" event_hub_namespace_key = "evh1" event_hub_name_key = "ev" - name = "example-cg" - user_metadata = "some_metadata" + name = "example-cg" + user_metadata = "some_metadata" } } \ No newline at end of file diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf index 0cd129625..b8c2a06e0 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/module.tf @@ -1,11 +1,12 @@ module "caf" { - source = "../../../../" - global_settings = var.global_settings - tags = var.tags - resource_groups = var.resource_groups - storage_accounts = var.storage_accounts - event_hub = var.event_hub - event_hub_auth_rules = var.event_hub_auth_rules - event_hub_namespaces = var.event_hub_namespaces + source = "../../../../" + global_settings = var.global_settings + tags = var.tags + resource_groups = var.resource_groups + storage_accounts = var.storage_accounts + event_hubs = var.event_hubs + event_hub_auth_rules = var.event_hub_auth_rules + event_hub_namespaces = var.event_hub_namespaces + event_hub_consumer_groups = var.event_hub_consumer_groups } - + diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf index fdde5caf0..333f4f8ed 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/variables.tf @@ -16,18 +16,21 @@ variable tags { } variable event_hub_namespaces { - default ={} + default = {} } variable event_hub_auth_rules { default = {} } -variable event_hub { - default ={} +variable event_hubs { + default = {} } variable var_folder_path { default = {} } +variable event_hub_consumer_groups { + default = {} +} \ No newline at end of file diff --git a/modules/event_hub/event_hub/auth_rules/output.tf b/modules/event_hub/event_hub/auth_rules/output.tf deleted file mode 100644 index b957d17c3..000000000 --- a/modules/event_hub/event_hub/auth_rules/output.tf +++ /dev/null @@ -1,27 +0,0 @@ -output id { - value = azurerm_eventhub_authorization_rule.evhub_rule.id -} - -output primary_connection_string_alias { - value = azurerm_eventhub_authorization_rule.evhub_rule.primary_connection_string_alias -} - -output secondary_connection_string_alias { - value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_connection_string_alias -} - -output primary_connection_string { - value = azurerm_eventhub_authorization_rule.evhub_rule.primary_connection_string -} - -output primary_key { - value = azurerm_eventhub_authorization_rule.evhub_rule.primary_key -} - -output secondary_connection_string { - value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_connection_string -} - -output secondary_key { - value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_key -} \ No newline at end of file diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/output.tf b/modules/event_hub/event_hub_namespaces/auth_rules/output.tf deleted file mode 100644 index e18e3866a..000000000 --- a/modules/event_hub/event_hub_namespaces/auth_rules/output.tf +++ /dev/null @@ -1,27 +0,0 @@ -output id { - value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.id -} - -output primary_connection_string_alias { - value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.primary_connection_string_alias -} - -output secondary_connection_string_alias { - value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.secondary_connection_string_alias -} - -output primary_connection_string { - value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.primary_connection_string -} - -output primary_key { - value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.primary_key -} - -output secondary_connection_string { - value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.secondary_connection_string -} - -output secondary_key { - value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.secondary_key -} \ No newline at end of file diff --git a/modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf b/modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf deleted file mode 100644 index 41abb81d6..000000000 --- a/modules/event_hub/event_hub_namespaces/event_hub_namespaces.tf +++ /dev/null @@ -1,54 +0,0 @@ -resource "azurecaf_name" "evh" { - name = var.settings.name - resource_type = "azurerm_eventhub_namespace" - prefixes = [var.global_settings.prefix] - random_length = var.global_settings.random_length - clean_input = true - passthrough = var.global_settings.passthrough - use_slug = var.global_settings.use_slug -} - -resource "azurerm_eventhub_namespace" "evh" { - name = azurecaf_name.evh.result - location = lookup(var.settings, "region", null) == null ? var.resource_groups[var.settings.resource_group_key].location : var.global_settings.regions[var.settings.region] - resource_group_name = var.resource_groups[var.settings.resource_group_key].name - sku = var.settings.sku - capacity = try(var.settings.capacity, null) - tags = local.tags - auto_inflate_enabled = try(var.settings.auto_inflate_enabled, null) - dedicated_cluster_id = try(var.settings.dedicated_cluster_id, null) - maximum_throughput_units = try(var.settings.maximum_throughput_units, null) - zone_redundant = try(var.settings.zone_redundant, null) - - dynamic "identity" { - for_each = try(var.settings.identity, {}) - content { - type = identity.value.type - } - } - - dynamic "network_rulesets" { - for_each = try(var.settings.network_rulesets, {}) - content { - default_action = network_rulesets.value.default_action #Possible values are Allow and Deny. Defaults to Deny. - trusted_service_access_enabled = try(network_rulesets.value.trusted_service_access_enabled, null) - - dynamic "virtual_network_rule" { - for_each = try(var.settings.network_rulesets.virtual_network_rule, {}) - content { - subnet_id = virtual_network_rule.value.subnet_id - ignore_missing_virtual_network_service_endpoint = try(virtual_network_rule.value.ignore_missing_virtual_network_service_endpoint, null) - } - } - - dynamic "ip_rule" { - for_each = try(var.settings.network_rulesets.ip_rule, {}) - content { - ip_mask = ip_rule.value.ip_mask - action = try(ip_rule.value.action, null) - } - } - } - } - - } diff --git a/modules/event_hub/event_hub_namespaces/output.tf b/modules/event_hub/event_hub_namespaces/output.tf deleted file mode 100644 index 341845ab1..000000000 --- a/modules/event_hub/event_hub_namespaces/output.tf +++ /dev/null @@ -1,35 +0,0 @@ -output id { - description = "The EventHub Namespace ID." - value = azurerm_eventhub_namespace.evh.id - -} - -output name { - description = "The EventHub Namespace name." - value = azurerm_eventhub_namespace.evh.name - -} - -output location { - value = azurerm_eventhub_namespace.evh.location - sensitive = true -} - -output connection_string_primary { - value = azurerm_eventhub_namespace.evh.default_primary_connection_string -} - -output connection_string_secondary { - value = azurerm_eventhub_namespace.evh.default_secondary_connection_string -} - -output primary_key { - value = azurerm_eventhub_namespace.evh.default_primary_key -} - -output secondary_key { - value = azurerm_eventhub_namespace.evh.default_secondary_key - description = "The EventHub Namespace location." - sensitive = true - -} \ No newline at end of file diff --git a/modules/event_hub/event_hub_consumer_groups/consumer_groups.tf b/modules/event_hubs/consumer_groups/consumer_groups.tf similarity index 100% rename from modules/event_hub/event_hub_consumer_groups/consumer_groups.tf rename to modules/event_hubs/consumer_groups/consumer_groups.tf diff --git a/modules/event_hub/event_hub/auth_rules/main.tf b/modules/event_hubs/consumer_groups/main.tf similarity index 100% rename from modules/event_hub/event_hub/auth_rules/main.tf rename to modules/event_hubs/consumer_groups/main.tf diff --git a/modules/event_hub/event_hub_consumer_groups/output.tf b/modules/event_hubs/consumer_groups/output.tf similarity index 100% rename from modules/event_hub/event_hub_consumer_groups/output.tf rename to modules/event_hubs/consumer_groups/output.tf diff --git a/modules/event_hub/event_hub_consumer_groups/variables.tf b/modules/event_hubs/consumer_groups/variables.tf similarity index 100% rename from modules/event_hub/event_hub_consumer_groups/variables.tf rename to modules/event_hubs/consumer_groups/variables.tf diff --git a/modules/event_hubs/hubs/auth_rules.tf b/modules/event_hubs/hubs/auth_rules.tf new file mode 100644 index 000000000..70ecc8581 --- /dev/null +++ b/modules/event_hubs/hubs/auth_rules.tf @@ -0,0 +1,11 @@ +module authorization_rules { + source = "./auth_rules" + for_each = try(var.settings.auth_rules, {}) + + resource_group_name = var.resource_group_name + client_config = var.client_config + global_settings = var.global_settings + settings = each.value + namespace_name = var.namespace_name + eventhub_name = azurerm_eventhub.evhub.name +} \ No newline at end of file diff --git a/modules/event_hub/event_hub/auth_rules/auth_rules.tf b/modules/event_hubs/hubs/auth_rules/auth_rules.tf similarity index 100% rename from modules/event_hub/event_hub/auth_rules/auth_rules.tf rename to modules/event_hubs/hubs/auth_rules/auth_rules.tf diff --git a/modules/event_hub/event_hub_consumer_groups/main.tf b/modules/event_hubs/hubs/auth_rules/main.tf similarity index 100% rename from modules/event_hub/event_hub_consumer_groups/main.tf rename to modules/event_hubs/hubs/auth_rules/main.tf diff --git a/modules/event_hubs/hubs/auth_rules/output.tf b/modules/event_hubs/hubs/auth_rules/output.tf new file mode 100644 index 000000000..403c041da --- /dev/null +++ b/modules/event_hubs/hubs/auth_rules/output.tf @@ -0,0 +1,27 @@ +output id { + value = azurerm_eventhub_authorization_rule.evhub_rule.id +} + +output primary_connection_string_alias { + value = azurerm_eventhub_authorization_rule.evhub_rule.primary_connection_string_alias +} + +output secondary_connection_string_alias { + value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_connection_string_alias +} + +output primary_connection_string { + value = azurerm_eventhub_authorization_rule.evhub_rule.primary_connection_string +} + +output primary_key { + value = azurerm_eventhub_authorization_rule.evhub_rule.primary_key +} + +output secondary_connection_string { + value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_connection_string +} + +output secondary_key { + value = azurerm_eventhub_authorization_rule.evhub_rule.secondary_key +} \ No newline at end of file diff --git a/modules/event_hub/event_hub/auth_rules/variables.tf b/modules/event_hubs/hubs/auth_rules/variables.tf similarity index 100% rename from modules/event_hub/event_hub/auth_rules/variables.tf rename to modules/event_hubs/hubs/auth_rules/variables.tf diff --git a/modules/event_hub/event_hub/event_hub.tf b/modules/event_hubs/hubs/event_hub.tf similarity index 64% rename from modules/event_hub/event_hub/event_hub.tf rename to modules/event_hubs/hubs/event_hub.tf index 3dba6aa39..9aa205247 100644 --- a/modules/event_hub/event_hub/event_hub.tf +++ b/modules/event_hubs/hubs/event_hub.tf @@ -23,15 +23,15 @@ resource "azurerm_eventhub" "evhub" { interval_in_seconds = try(capture_description.value.interval_in_seconds, null) size_limit_in_bytes = try(capture_description.value.size_limit_in_bytes, null) skip_empty_archives = try(capture_description.value.skip_empty_archives, null) - dynamic "destination" { # required if capture_description is set - for_each = try(var.settings.capture_description.destination, {}) - content { - name = destination.value.name # At this time(12/2020), the only supported value is EventHubArchive.AzureBlockBlob - archive_name_format = destination.value.archive_name_format # e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second} - blob_container_name = destination.value.blob_container_name - storage_account_id = var.storage_account_id - } - } + dynamic "destination" { # required if capture_description is set + for_each = try(var.settings.capture_description.destination, {}) + content { + name = destination.value.name # At this time(12/2020), the only supported value is EventHubArchive.AzureBlockBlob + archive_name_format = destination.value.archive_name_format # e.g. {Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second} + blob_container_name = destination.value.blob_container_name + storage_account_id = var.storage_account_id + } + } } } } diff --git a/modules/event_hub/event_hub/main.tf b/modules/event_hubs/hubs/main.tf similarity index 100% rename from modules/event_hub/event_hub/main.tf rename to modules/event_hubs/hubs/main.tf diff --git a/modules/event_hub/event_hub/output.tf b/modules/event_hubs/hubs/output.tf similarity index 100% rename from modules/event_hub/event_hub/output.tf rename to modules/event_hubs/hubs/output.tf diff --git a/modules/event_hub/event_hub/variables.tf b/modules/event_hubs/hubs/variables.tf similarity index 100% rename from modules/event_hub/event_hub/variables.tf rename to modules/event_hubs/hubs/variables.tf diff --git a/modules/event_hub/event_hub_namespaces/README.md b/modules/event_hubs/namespaces/README.md similarity index 100% rename from modules/event_hub/event_hub_namespaces/README.md rename to modules/event_hubs/namespaces/README.md diff --git a/modules/event_hubs/namespaces/auth_rules.tf b/modules/event_hubs/namespaces/auth_rules.tf new file mode 100644 index 000000000..0815d5b77 --- /dev/null +++ b/modules/event_hubs/namespaces/auth_rules.tf @@ -0,0 +1,10 @@ +module event_hub_namespace_auth_rules { + source = "./auth_rules" + for_each = try(var.settings.auth_rules, {}) + + resource_group_name = var.resource_group_name + client_config = var.client_config + global_settings = var.global_settings + settings = each.value + namespace_name = azurerm_eventhub_namespace.evh.name +} \ No newline at end of file diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/auth_rules.tf b/modules/event_hubs/namespaces/auth_rules/auth_rules.tf similarity index 100% rename from modules/event_hub/event_hub_namespaces/auth_rules/auth_rules.tf rename to modules/event_hubs/namespaces/auth_rules/auth_rules.tf diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/main.tf b/modules/event_hubs/namespaces/auth_rules/main.tf similarity index 100% rename from modules/event_hub/event_hub_namespaces/auth_rules/main.tf rename to modules/event_hubs/namespaces/auth_rules/main.tf diff --git a/modules/event_hubs/namespaces/auth_rules/output.tf b/modules/event_hubs/namespaces/auth_rules/output.tf new file mode 100644 index 000000000..83eba970f --- /dev/null +++ b/modules/event_hubs/namespaces/auth_rules/output.tf @@ -0,0 +1,21 @@ +output id { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.id +} + +output primary_connection_string_alias { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.primary_connection_string_alias +} + +output secondary_connection_string_alias { + value = azurerm_eventhub_namespace_authorization_rule.evh_ns_rule.secondary_connection_string_alias +} + +output name { + value = var.namespace_name + description = "Name of the authorization rule" +} + +output resource_group_name { + value = var.resource_group_name + description = "Name of the resource group" +} diff --git a/modules/event_hub/event_hub_namespaces/auth_rules/variables.tf b/modules/event_hubs/namespaces/auth_rules/variables.tf similarity index 100% rename from modules/event_hub/event_hub_namespaces/auth_rules/variables.tf rename to modules/event_hubs/namespaces/auth_rules/variables.tf diff --git a/modules/event_hubs/namespaces/event_hub_namespaces.tf b/modules/event_hubs/namespaces/event_hub_namespaces.tf new file mode 100644 index 000000000..ebc2e5b31 --- /dev/null +++ b/modules/event_hubs/namespaces/event_hub_namespaces.tf @@ -0,0 +1,54 @@ +resource "azurecaf_name" "evh" { + name = var.settings.name + resource_type = "azurerm_eventhub_namespace" + prefixes = [var.global_settings.prefix] + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough + use_slug = var.global_settings.use_slug +} + +resource "azurerm_eventhub_namespace" "evh" { + name = azurecaf_name.evh.result + location = var.location + resource_group_name = var.resource_group_name + sku = var.settings.sku + capacity = try(var.settings.capacity, null) + tags = local.tags + auto_inflate_enabled = try(var.settings.auto_inflate_enabled, null) + dedicated_cluster_id = try(var.settings.dedicated_cluster_id, null) + maximum_throughput_units = try(var.settings.maximum_throughput_units, null) + zone_redundant = try(var.settings.zone_redundant, null) + + dynamic "identity" { + for_each = try(var.settings.identity, {}) + content { + type = identity.value.type + } + } + + dynamic "network_rulesets" { + for_each = try(var.settings.network_rulesets, {}) + content { + default_action = network_rulesets.value.default_action #Possible values are Allow and Deny. Defaults to Deny. + trusted_service_access_enabled = try(network_rulesets.value.trusted_service_access_enabled, null) + + dynamic "virtual_network_rule" { + for_each = try(var.settings.network_rulesets.virtual_network_rule, {}) + content { + subnet_id = virtual_network_rule.value.subnet_id + ignore_missing_virtual_network_service_endpoint = try(virtual_network_rule.value.ignore_missing_virtual_network_service_endpoint, null) + } + } + + dynamic "ip_rule" { + for_each = try(var.settings.network_rulesets.ip_rule, {}) + content { + ip_mask = ip_rule.value.ip_mask + action = try(ip_rule.value.action, null) + } + } + } + } + +} diff --git a/modules/event_hubs/namespaces/event_hubs.tf b/modules/event_hubs/namespaces/event_hubs.tf new file mode 100644 index 000000000..9f0ed9104 --- /dev/null +++ b/modules/event_hubs/namespaces/event_hubs.tf @@ -0,0 +1,12 @@ +module event_hubs { + source = "../hubs" + for_each = try(var.settings.event_hubs, {}) + + resource_group_name = var.resource_group_name + client_config = var.client_config + global_settings = var.global_settings + settings = each.value + namespace_name = azurerm_eventhub_namespace.evh.name + storage_account_id = var.storage_accounts[try(each.value.storage_account.lz_key, var.client_config.landingzone_key)][each.value.storage_account.key].id + base_tags = merge(var.base_tags, try(each.value.tags, {})) +} \ No newline at end of file diff --git a/modules/event_hub/event_hub_namespaces/main.tf b/modules/event_hubs/namespaces/main.tf similarity index 100% rename from modules/event_hub/event_hub_namespaces/main.tf rename to modules/event_hubs/namespaces/main.tf diff --git a/modules/event_hubs/namespaces/output.tf b/modules/event_hubs/namespaces/output.tf new file mode 100644 index 000000000..b70339071 --- /dev/null +++ b/modules/event_hubs/namespaces/output.tf @@ -0,0 +1,19 @@ +output id { + description = "The EventHub Namespace ID." + value = azurerm_eventhub_namespace.evh.id +} + +output name { + description = "The EventHub Namespace name." + value = azurerm_eventhub_namespace.evh.name +} + +output resource_group_name { + value = var.resource_group_name + description = "Name of the resource group" +} + +output location { + value = var.location + description = "Location of the service" +} diff --git a/modules/event_hub/event_hub_namespaces/variables.tf b/modules/event_hubs/namespaces/variables.tf similarity index 77% rename from modules/event_hub/event_hub_namespaces/variables.tf rename to modules/event_hubs/namespaces/variables.tf index fc96660f4..b48a7fd00 100644 --- a/modules/event_hub/event_hub_namespaces/variables.tf +++ b/modules/event_hubs/namespaces/variables.tf @@ -2,11 +2,15 @@ variable global_settings { description = "Global settings object (see module README.md)" } variable settings {} -variable resource_groups {} +variable resource_group_name {} +variable location {} variable base_tags { description = "Base tags for the resource to be inherited from the resource group." type = map } variable client_config { description = "Client configuration object (see module README.md)." +} +variable storage_accounts { + default = {} } \ No newline at end of file diff --git a/variables.tf b/variables.tf index 318345f9a..d8a9c40ad 100755 --- a/variables.tf +++ b/variables.tf @@ -232,7 +232,7 @@ variable local_network_gateways { default = {} } -variable event_hub { +variable event_hubs { default = {} } From 9b7822cce1581edf6c8de5994a2d34b0eb64d4e3 Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 5 Mar 2021 10:11:32 +0000 Subject: [PATCH 19/23] - update azurerm provider - refactor example files --- event_hubs.tf | 4 ++-- .../standalone/main.tf | 4 ++-- .../configuration.tfvars | 4 +--- .../standalone/main.tf | 4 ++-- examples/eventhub_namespace/README.md | 13 ------------- .../event_hub_namespaces.tf | 18 ------------------ .../consumer_groups/consumer_groups.tf | 2 +- .../event_hubs/hubs/auth_rules/auth_rules.tf | 2 +- modules/event_hubs/hubs/event_hub.tf | 2 +- .../namespaces/auth_rules/auth_rules.tf | 2 +- .../namespaces/event_hub_namespaces.tf | 2 +- 11 files changed, 12 insertions(+), 45 deletions(-) delete mode 100755 examples/eventhub_namespace/README.md delete mode 100644 modules/event_hub_namespaces/event_hub_namespaces.tf diff --git a/event_hubs.tf b/event_hubs.tf index b56df6c24..bbdbd55b5 100644 --- a/event_hubs.tf +++ b/event_hubs.tf @@ -6,8 +6,8 @@ module "event_hub_namespaces" { global_settings = local.global_settings settings = each.value storage_accounts = local.combined_objects_storage_accounts - resource_group_name = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][each.value.resource_group.key].name - location = local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][each.value.resource_group.key].location + resource_group_name = module.resource_groups[each.value.resource_group_key].name + location = lookup(each.value, "region", null) == null ? module.resource_groups[each.value.resource_group_key].location : local.global_settings.regions[each.value.region] client_config = local.client_config base_tags = try(local.global_settings.inherit_tags, false) ? local.combined_objects_resource_groups[try(each.value.resource_group.lz_key, local.client_config.landingzone_key)][each.value.resource_group.key].tags : {} } diff --git a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf index 65968a056..23799f7f1 100644 --- a/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf +++ b/examples/eventhub/102-namespace-and-evh-with-auth-rules/standalone/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 2.43.0" + version = "~> 2.49.0" } azuread = { source = "hashicorp/azuread" @@ -26,7 +26,7 @@ terraform { } azurecaf = { source = "aztfmod/azurecaf" - version = "~> 1.1.0" + version = "~> 1.2.0" } } required_version = ">= 0.13" diff --git a/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars index 6c3bd0a8d..94583269b 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars +++ b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars @@ -31,9 +31,7 @@ storage_accounts = { event_hub_namespaces = { evh1 = { name = "evh1" - resource_group = { - key = "evh_examples" - } + resource_group_key = "evh_examples" sku = "Standard" region = "region1" diff --git a/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf b/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf index 65968a056..23799f7f1 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf +++ b/examples/eventhub/103-eventhub-consumer-groups/standalone/main.tf @@ -2,7 +2,7 @@ terraform { required_providers { azurerm = { source = "hashicorp/azurerm" - version = "~> 2.43.0" + version = "~> 2.49.0" } azuread = { source = "hashicorp/azuread" @@ -26,7 +26,7 @@ terraform { } azurecaf = { source = "aztfmod/azurecaf" - version = "~> 1.1.0" + version = "~> 1.2.0" } } required_version = ">= 0.13" diff --git a/examples/eventhub_namespace/README.md b/examples/eventhub_namespace/README.md deleted file mode 100755 index 6eefe7fc1..000000000 --- a/examples/eventhub_namespace/README.md +++ /dev/null @@ -1,13 +0,0 @@ -# Azure Event Hub Namespace - -This module is part of Cloud Adoption Framework landing zones for Azure on Terraform. - -You can instantiate this directly using the following parameters: - -```hcl -module "caf" { - source = "aztfmod/caf/azurerm" - version = "5.1.0" - # insert the 7 required variables here -} -``` diff --git a/modules/event_hub_namespaces/event_hub_namespaces.tf b/modules/event_hub_namespaces/event_hub_namespaces.tf deleted file mode 100644 index 59c077d64..000000000 --- a/modules/event_hub_namespaces/event_hub_namespaces.tf +++ /dev/null @@ -1,18 +0,0 @@ -resource "azurecaf_name" "evh" { - name = var.settings.name - resource_type = "azurerm_eventhub_namespace" - prefixes = var.global_settings.prefix - random_length = var.global_settings.random_length - clean_input = true - passthrough = var.global_settings.passthrough - use_slug = var.global_settings.use_slug -} - -resource "azurerm_eventhub_namespace" "evh" { - name = azurecaf_name.evh.result - location = lookup(var.settings, "region", null) == null ? var.resource_groups[var.settings.resource_group_key].location : var.global_settings.regions[var.settings.region] - resource_group_name = var.resource_groups[var.settings.resource_group_key].name - sku = var.settings.sku - capacity = try(var.settings.capacity, null) - tags = local.tags -} \ No newline at end of file diff --git a/modules/event_hubs/consumer_groups/consumer_groups.tf b/modules/event_hubs/consumer_groups/consumer_groups.tf index 15e36a41d..3989163bb 100644 --- a/modules/event_hubs/consumer_groups/consumer_groups.tf +++ b/modules/event_hubs/consumer_groups/consumer_groups.tf @@ -1,7 +1,7 @@ resource "azurecaf_name" "evhcg_name" { name = var.settings.name resource_type = "azurerm_eventhub_consumer_group" - prefixes = [var.global_settings.prefix] + prefixes = var.global_settings.prefix random_length = var.global_settings.random_length clean_input = true passthrough = var.global_settings.passthrough diff --git a/modules/event_hubs/hubs/auth_rules/auth_rules.tf b/modules/event_hubs/hubs/auth_rules/auth_rules.tf index 1eccd9386..7b4191a97 100644 --- a/modules/event_hubs/hubs/auth_rules/auth_rules.tf +++ b/modules/event_hubs/hubs/auth_rules/auth_rules.tf @@ -1,7 +1,7 @@ resource "azurecaf_name" "evh_rule" { name = var.settings.rule_name resource_type = "azurerm_eventhub_authorization_rule" - prefixes = [var.global_settings.prefix] + prefixes = var.global_settings.prefix random_length = var.global_settings.random_length clean_input = true passthrough = var.global_settings.passthrough diff --git a/modules/event_hubs/hubs/event_hub.tf b/modules/event_hubs/hubs/event_hub.tf index 9aa205247..a4ea1dcf2 100644 --- a/modules/event_hubs/hubs/event_hub.tf +++ b/modules/event_hubs/hubs/event_hub.tf @@ -1,7 +1,7 @@ resource "azurecaf_name" "evhub" { name = var.settings.name resource_type = "azurerm_eventhub" - prefixes = [var.global_settings.prefix] + prefixes = var.global_settings.prefix random_length = var.global_settings.random_length clean_input = true passthrough = var.global_settings.passthrough diff --git a/modules/event_hubs/namespaces/auth_rules/auth_rules.tf b/modules/event_hubs/namespaces/auth_rules/auth_rules.tf index cffcf7d10..d9ef63e1e 100644 --- a/modules/event_hubs/namespaces/auth_rules/auth_rules.tf +++ b/modules/event_hubs/namespaces/auth_rules/auth_rules.tf @@ -1,7 +1,7 @@ resource "azurecaf_name" "evh_ns_rule_name" { name = var.settings.rule_name resource_type = "azurerm_eventhub_namespace_authorization_rule" - prefixes = [var.global_settings.prefix] + prefixes = var.global_settings.prefix random_length = var.global_settings.random_length clean_input = true passthrough = var.global_settings.passthrough diff --git a/modules/event_hubs/namespaces/event_hub_namespaces.tf b/modules/event_hubs/namespaces/event_hub_namespaces.tf index ebc2e5b31..7b1545ec7 100644 --- a/modules/event_hubs/namespaces/event_hub_namespaces.tf +++ b/modules/event_hubs/namespaces/event_hub_namespaces.tf @@ -1,7 +1,7 @@ resource "azurecaf_name" "evh" { name = var.settings.name resource_type = "azurerm_eventhub_namespace" - prefixes = [var.global_settings.prefix] + prefixes = var.global_settings.prefix random_length = var.global_settings.random_length clean_input = true passthrough = var.global_settings.passthrough From 4323be359ee202cfa35bb5564655d7ae9f241c2c Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 5 Mar 2021 10:25:52 +0000 Subject: [PATCH 20/23] edit variable.tf --- examples/variables.tf | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/variables.tf b/examples/variables.tf index 01582d6b5..9dc99e48b 100644 --- a/examples/variables.tf +++ b/examples/variables.tf @@ -322,9 +322,6 @@ variable "event_hub_auth_rules" { variable "netapp_accounts" { default = {} } -variable "automations" { - default = {} -} variable "load_balancers" { default ={} From 57f3d2937ec339dc34ba592b1dd5c1b9db2bcc5b Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 5 Mar 2021 18:47:33 +0800 Subject: [PATCH 21/23] edit module.tf --- examples/module.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/module.tf b/examples/module.tf index a0a2d1961..f24da1b20 100644 --- a/examples/module.tf +++ b/examples/module.tf @@ -22,7 +22,7 @@ module "caf" { custom_role_definitions = var.custom_role_definitions log_analytics = var.log_analytics event_hub_namespaces = var.event_hub_namespaces - event_hub = var.event_hub + event_hubs = var.event_hubs event_hub_auth_rules = var.event_hub_auth_rules event_hub_namespace_auth_rules = var.event_hub_namespace_auth_rules event_hub_consumer_groups = var.event_hub_consumer_groups From 49dfa6b0d0ed727acb9282aefdc45db3065679ae Mon Sep 17 00:00:00 2001 From: Ben Date: Fri, 5 Mar 2021 22:32:06 +0800 Subject: [PATCH 22/23] update variables.tf --- examples/variables.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/variables.tf b/examples/variables.tf index 9dc99e48b..9a123d0ec 100644 --- a/examples/variables.tf +++ b/examples/variables.tf @@ -277,7 +277,7 @@ variable "private_endpoints" { default = {} } -variable event_hub { +variable event_hubs { default = {} } variable automations { From 1370dc4c7a0112213a241aa9c316f96a2adec517 Mon Sep 17 00:00:00 2001 From: Arnaud Lheureux Date: Mon, 8 Mar 2021 04:03:51 +0000 Subject: [PATCH 23/23] Formatting` --- container_groups.tf | 16 +++--- diagnostics.tf | 8 +-- .../201-groups-and-roles/configuration.tfvars | 2 +- .../101-aci-rover/container_groups.tfvars | 10 ++-- .../101-aci-rover/keyvaults.tfvars | 4 +- .../configuration.tfvars | 6 +-- examples/module.tf | 50 +++++++++---------- .../101-sqlserver-simple/configuration.tfvars | 8 +-- .../100-simple-ip_group/configuration.tfvars | 14 +++--- .../100-simple-ip_group/networking.tfvars | 8 +-- .../configuration.tfvars | 6 +-- ...wall_nat_rule_collection_definition.tfvars | 4 +- .../101-firewall-ip_group/networking.tfvars | 8 +-- .../standalone/module.tf | 6 +-- .../configuration.tfvars | 8 +-- .../standalone/module.tf | 10 ++-- .../standalone/module.tf | 10 ++-- .../101-vpn-site-to-site/configuration.tfvars | 8 +-- examples/variables.tf | 2 +- .../configuration.tfvars | 8 +-- locals.tf | 4 +- .../container_group/container_group.tf | 2 +- modules/compute/container_group/locals.tf | 18 +++---- modules/compute/container_group/variables.tf | 2 +- .../application_gateway.tf | 26 +++++----- .../networking/application_gateway/locals.tf | 10 ++-- .../application_gateway/variable.tf | 2 +- .../load_balancers/load_balancers.tf | 12 ++--- .../keyvault_certificate_request/module.tf | 2 +- modules/webapps/appservice/storage_account.tf | 4 +- msssql_managed_instances.tf | 2 +- 31 files changed, 140 insertions(+), 140 deletions(-) diff --git a/container_groups.tf b/container_groups.tf index f636b2d52..6a3d348e5 100644 --- a/container_groups.tf +++ b/container_groups.tf @@ -2,16 +2,16 @@ module container_groups { source = "./modules/compute/container_group" for_each = local.compute.container_groups - base_tags = try(local.global_settings.inherit_tags, false) ? local.combined_objects_resource_groups[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.resource_group_key].tags : {} - client_config = local.client_config - combined_diagnostics = local.combined_diagnostics + base_tags = try(local.global_settings.inherit_tags, false) ? local.combined_objects_resource_groups[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.resource_group_key].tags : {} + client_config = local.client_config + combined_diagnostics = local.combined_diagnostics # combined_managed_identities = local.combined_objects_managed_identities # combined_vnets = local.combined_objects_networking - diagnostic_profiles = try(each.value.diagnostic_profiles, {}) - global_settings = local.global_settings - location = lookup(each.value, "region", null) == null ? local.combined_objects_resource_groups[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.resource_group_key].location : local.global_settings.regions[each.value.region] - resource_group_name = local.combined_objects_resource_groups[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.resource_group_key].name - settings = each.value + diagnostic_profiles = try(each.value.diagnostic_profiles, {}) + global_settings = local.global_settings + location = lookup(each.value, "region", null) == null ? local.combined_objects_resource_groups[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.resource_group_key].location : local.global_settings.regions[each.value.region] + resource_group_name = local.combined_objects_resource_groups[try(each.value.lz_key, local.client_config.landingzone_key)][each.value.resource_group_key].name + settings = each.value combined_resources = { keyvaults = local.combined_objects_keyvaults diff --git a/diagnostics.tf b/diagnostics.tf index 9de5d4a14..307f1b79a 100644 --- a/diagnostics.tf +++ b/diagnostics.tf @@ -38,12 +38,12 @@ module "diagnostic_event_hub_namespaces" { source = "./modules/event_hubs/namespaces" for_each = local.diagnostics.diagnostic_event_hub_namespaces - global_settings = local.global_settings - settings = each.value + global_settings = local.global_settings + settings = each.value resource_group_name = module.resource_groups[each.value.resource_group_key].name location = lookup(each.value, "region", null) == null ? module.resource_groups[each.value.resource_group_key].location : local.global_settings.regions[each.value.region] - client_config = local.client_config - base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} + client_config = local.client_config + base_tags = try(local.global_settings.inherit_tags, false) ? module.resource_groups[each.value.resource_group_key].tags : {} } module diagnostic_event_hub_namespaces_diagnostics { diff --git a/examples/azure_ad/201-groups-and-roles/configuration.tfvars b/examples/azure_ad/201-groups-and-roles/configuration.tfvars index 7f8a76893..7bad350a5 100644 --- a/examples/azure_ad/201-groups-and-roles/configuration.tfvars +++ b/examples/azure_ad/201-groups-and-roles/configuration.tfvars @@ -34,7 +34,7 @@ azuread_apps = { application_name = "app1" app_role_assignment_required = true keyvaults = { - test_kv= { + test_kv = { secret_prefix = "app1" } } diff --git a/examples/compute/container_groups/101-aci-rover/container_groups.tfvars b/examples/compute/container_groups/101-aci-rover/container_groups.tfvars index 6f646852d..b1136ef32 100644 --- a/examples/compute/container_groups/101-aci-rover/container_groups.tfvars +++ b/examples/compute/container_groups/101-aci-rover/container_groups.tfvars @@ -28,10 +28,10 @@ container_groups = { # for demo purposes environment_variables = { - URL="https://www.microsoft.com" + URL = "https://www.microsoft.com" } secure_environment_variables = { - TOKEN="token from tfvars" + TOKEN = "token from tfvars" } environment_variables_from_resources = { AGENT_KEYVAULT_NAME = { @@ -47,7 +47,7 @@ container_groups = { } } - } //containers + } //containers tags = { environment = "testing" @@ -71,7 +71,7 @@ container_groups = { restart_policy = "Never" // Possible values are 'Always'(default) 'Never' 'OnFailure' containers = { - + # You can also deploy the name container multiple times based on the count number httpd = { name = "httpd" @@ -87,7 +87,7 @@ container_groups = { } } - } //containers + } //containers tags = { environment = "testing" diff --git a/examples/compute/container_groups/101-aci-rover/keyvaults.tfvars b/examples/compute/container_groups/101-aci-rover/keyvaults.tfvars index c79473f47..454440143 100644 --- a/examples/compute/container_groups/101-aci-rover/keyvaults.tfvars +++ b/examples/compute/container_groups/101-aci-rover/keyvaults.tfvars @@ -12,8 +12,8 @@ keyvaults = { secret_permissions = ["Set", "Get", "List", "Delete", "Purge", "Recover"] } nginx = { - managed_identity_key = "nginx" - secret_permissions = ["Get"] + managed_identity_key = "nginx" + secret_permissions = ["Get"] } } } diff --git a/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars index 94583269b..ac6ab994a 100644 --- a/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars +++ b/examples/eventhub/103-eventhub-consumer-groups/configuration.tfvars @@ -30,10 +30,10 @@ storage_accounts = { event_hub_namespaces = { evh1 = { - name = "evh1" + name = "evh1" resource_group_key = "evh_examples" - sku = "Standard" - region = "region1" + sku = "Standard" + region = "region1" event_hubs = { gaming = { diff --git a/examples/module.tf b/examples/module.tf index f24da1b20..f28a3b5dd 100644 --- a/examples/module.tf +++ b/examples/module.tf @@ -1,31 +1,31 @@ module "caf" { source = "../" - global_settings = var.global_settings - diagnostics = local.remote.diagnostics - current_landingzone_key = var.landingzone.key - tenant_id = var.tenant_id - logged_user_objectId = var.logged_user_objectId - logged_aad_app_objectId = var.logged_aad_app_objectId - resource_groups = var.resource_groups - storage_accounts = var.storage_accounts - azuread_groups = var.azuread_groups - azuread_apps = var.azuread_apps - azuread_users = var.azuread_users - azuread_roles = var.azuread_roles - tags = local.tags - keyvaults = var.keyvaults - keyvault_access_policies = var.keyvault_access_policies - keyvault_certificate_issuers = var.keyvault_certificate_issuers - managed_identities = var.managed_identities - role_mapping = var.role_mapping - custom_role_definitions = var.custom_role_definitions - log_analytics = var.log_analytics - event_hub_namespaces = var.event_hub_namespaces - event_hubs = var.event_hubs - event_hub_auth_rules = var.event_hub_auth_rules + global_settings = var.global_settings + diagnostics = local.remote.diagnostics + current_landingzone_key = var.landingzone.key + tenant_id = var.tenant_id + logged_user_objectId = var.logged_user_objectId + logged_aad_app_objectId = var.logged_aad_app_objectId + resource_groups = var.resource_groups + storage_accounts = var.storage_accounts + azuread_groups = var.azuread_groups + azuread_apps = var.azuread_apps + azuread_users = var.azuread_users + azuread_roles = var.azuread_roles + tags = local.tags + keyvaults = var.keyvaults + keyvault_access_policies = var.keyvault_access_policies + keyvault_certificate_issuers = var.keyvault_certificate_issuers + managed_identities = var.managed_identities + role_mapping = var.role_mapping + custom_role_definitions = var.custom_role_definitions + log_analytics = var.log_analytics + event_hub_namespaces = var.event_hub_namespaces + event_hubs = var.event_hubs + event_hub_auth_rules = var.event_hub_auth_rules event_hub_namespace_auth_rules = var.event_hub_namespace_auth_rules - event_hub_consumer_groups = var.event_hub_consumer_groups + event_hub_consumer_groups = var.event_hub_consumer_groups webapp = { azurerm_application_insights = var.azurerm_application_insights @@ -42,7 +42,7 @@ module "caf" { bastion_hosts = var.bastion_hosts aks_clusters = var.aks_clusters proximity_placement_groups = var.proximity_placement_groups - container_groups = var.container_groups + container_groups = var.container_groups } networking = { domain_name_registrations = var.domain_name_registrations diff --git a/examples/mssql_server/101-sqlserver-simple/configuration.tfvars b/examples/mssql_server/101-sqlserver-simple/configuration.tfvars index 1c22a51e1..43de8d616 100644 --- a/examples/mssql_server/101-sqlserver-simple/configuration.tfvars +++ b/examples/mssql_server/101-sqlserver-simple/configuration.tfvars @@ -14,10 +14,10 @@ resource_groups = { mssql_servers = { sql_rg1 = { - name = "sql-rg1" - region = "region1" - resource_group_key = "sql_region1" - administrator_login = "sqladmin" + name = "sql-rg1" + region = "region1" + resource_group_key = "sql_region1" + administrator_login = "sqladmin" } } diff --git a/examples/networking/ip_group/100-simple-ip_group/configuration.tfvars b/examples/networking/ip_group/100-simple-ip_group/configuration.tfvars index 55065dceb..4fa03327e 100644 --- a/examples/networking/ip_group/100-simple-ip_group/configuration.tfvars +++ b/examples/networking/ip_group/100-simple-ip_group/configuration.tfvars @@ -15,19 +15,19 @@ resource_groups = { ip_groups = { ip_group1 = { - name = "ip_group1" - cidrs = ["10.0.0.0/20"] # if cidrs is defined all vnet & subnet are ignored + name = "ip_group1" + cidrs = ["10.0.0.0/20"] # if cidrs is defined all vnet & subnet are ignored resource_group_key = "ip_group_re1" } ip_group2 = { - name = "ip_group2" + name = "ip_group2" resource_group_key = "ip_group_re1" - vnet_key = "vnet_ip_group_re1" + vnet_key = "vnet_ip_group_re1" } ip_group3 = { - name = "ip_group3" + name = "ip_group3" resource_group_key = "ip_group_re1" - vnet_key = "vnet_ip_group_re1" - subnet_keys = ["subnet1","subnet2"] # can be either unclared or empty, will take vnet cidr instead + vnet_key = "vnet_ip_group_re1" + subnet_keys = ["subnet1", "subnet2"] # can be either unclared or empty, will take vnet cidr instead } } diff --git a/examples/networking/ip_group/100-simple-ip_group/networking.tfvars b/examples/networking/ip_group/100-simple-ip_group/networking.tfvars index c18bcbc4c..586fdec65 100644 --- a/examples/networking/ip_group/100-simple-ip_group/networking.tfvars +++ b/examples/networking/ip_group/100-simple-ip_group/networking.tfvars @@ -8,12 +8,12 @@ vnets = { } subnets = { subnet1 = { - name = "subnet1" - cidr = ["10.100.81.0/24"] + name = "subnet1" + cidr = ["10.100.81.0/24"] } subnet2 = { - name = "subnet2" - cidr = ["10.100.82.0/24"] + name = "subnet2" + cidr = ["10.100.82.0/24"] } } //subnets diff --git a/examples/networking/ip_group/101-firewall-ip_group/configuration.tfvars b/examples/networking/ip_group/101-firewall-ip_group/configuration.tfvars index 122188029..59a58dfb7 100644 --- a/examples/networking/ip_group/101-firewall-ip_group/configuration.tfvars +++ b/examples/networking/ip_group/101-firewall-ip_group/configuration.tfvars @@ -21,9 +21,9 @@ resource_groups = { ip_groups = { ip_group1 = { - name = "ip_group1" + name = "ip_group1" resource_group_key = "spoke_re1" - vnet_key = "vnet_spoke_re1" - subnet_keys = ["subnet1","subnet2"] # can be either unclared or empty, will take vnet cidr instead + vnet_key = "vnet_spoke_re1" + subnet_keys = ["subnet1", "subnet2"] # can be either unclared or empty, will take vnet cidr instead } } diff --git a/examples/networking/ip_group/101-firewall-ip_group/firewall_nat_rule_collection_definition.tfvars b/examples/networking/ip_group/101-firewall-ip_group/firewall_nat_rule_collection_definition.tfvars index cccb36c9b..3bf5bc05e 100644 --- a/examples/networking/ip_group/101-firewall-ip_group/firewall_nat_rule_collection_definition.tfvars +++ b/examples/networking/ip_group/101-firewall-ip_group/firewall_nat_rule_collection_definition.tfvars @@ -12,13 +12,13 @@ azurerm_firewall_nat_rule_collection_definition = { destination_ports = [ "443" ] - destination_addresses_public_ips_keys= [ + destination_addresses_public_ips_keys = [ "firewall_re1" ] protocols = [ "TCP", ] - translated_port = 53 + translated_port = 53 translated_address = "8.8.8.8" }, } diff --git a/examples/networking/ip_group/101-firewall-ip_group/networking.tfvars b/examples/networking/ip_group/101-firewall-ip_group/networking.tfvars index 1f4f6a4dd..9babf3363 100644 --- a/examples/networking/ip_group/101-firewall-ip_group/networking.tfvars +++ b/examples/networking/ip_group/101-firewall-ip_group/networking.tfvars @@ -23,12 +23,12 @@ vnets = { } subnets = { subnet1 = { - name = "subnet1" - cidr = ["10.100.81.0/24"] + name = "subnet1" + cidr = ["10.100.81.0/24"] } subnet2 = { - name = "subnet2" - cidr = ["10.100.82.0/24"] + name = "subnet2" + cidr = ["10.100.82.0/24"] } } //subnets diff --git a/examples/networking/load_balancers/100-simple-load-balancer-basic-sku/standalone/module.tf b/examples/networking/load_balancers/100-simple-load-balancer-basic-sku/standalone/module.tf index 586727b6b..2548c6d8e 100644 --- a/examples/networking/load_balancers/100-simple-load-balancer-basic-sku/standalone/module.tf +++ b/examples/networking/load_balancers/100-simple-load-balancer-basic-sku/standalone/module.tf @@ -4,9 +4,9 @@ module "caf" { resource_groups = var.resource_groups tags = var.tags networking = { - vnets = var.vnets - public_ip_addresses = var.public_ip_addresses - load_balancers = var.load_balancers + vnets = var.vnets + public_ip_addresses = var.public_ip_addresses + load_balancers = var.load_balancers } } diff --git a/examples/networking/load_balancers/101-load-balancer-with-rules/configuration.tfvars b/examples/networking/load_balancers/101-load-balancer-with-rules/configuration.tfvars index b5460d44a..27d7790fe 100644 --- a/examples/networking/load_balancers/101-load-balancer-with-rules/configuration.tfvars +++ b/examples/networking/load_balancers/101-load-balancer-with-rules/configuration.tfvars @@ -73,10 +73,10 @@ load_balancers = { } outbound_rules = { - rule1 ={ - name = "outbound-rule" - protocol = "Tcp" - resource_group_key = "lb" + rule1 = { + name = "outbound-rule" + protocol = "Tcp" + resource_group_key = "lb" backend_address_pool_key = "pool1" frontend_ip_configuration = { config1 = { diff --git a/examples/networking/load_balancers/101-load-balancer-with-rules/standalone/module.tf b/examples/networking/load_balancers/101-load-balancer-with-rules/standalone/module.tf index 6c5926417..b102b7b53 100644 --- a/examples/networking/load_balancers/101-load-balancer-with-rules/standalone/module.tf +++ b/examples/networking/load_balancers/101-load-balancer-with-rules/standalone/module.tf @@ -4,11 +4,11 @@ module "caf" { resource_groups = var.resource_groups tags = var.tags networking = { - vnets = var.vnets - public_ip_addresses = var.public_ip_addresses - load_balancers = var.load_balancers - load_balancer_rules = var.load_balancer_rules - load_balancer_probe = var.load_balancer_probe + vnets = var.vnets + public_ip_addresses = var.public_ip_addresses + load_balancers = var.load_balancers + load_balancer_rules = var.load_balancer_rules + load_balancer_probe = var.load_balancer_probe } } diff --git a/examples/networking/load_balancers/102-internal-load-balancer/standalone/module.tf b/examples/networking/load_balancers/102-internal-load-balancer/standalone/module.tf index 6c5926417..b102b7b53 100644 --- a/examples/networking/load_balancers/102-internal-load-balancer/standalone/module.tf +++ b/examples/networking/load_balancers/102-internal-load-balancer/standalone/module.tf @@ -4,11 +4,11 @@ module "caf" { resource_groups = var.resource_groups tags = var.tags networking = { - vnets = var.vnets - public_ip_addresses = var.public_ip_addresses - load_balancers = var.load_balancers - load_balancer_rules = var.load_balancer_rules - load_balancer_probe = var.load_balancer_probe + vnets = var.vnets + public_ip_addresses = var.public_ip_addresses + load_balancers = var.load_balancers + load_balancer_rules = var.load_balancer_rules + load_balancer_probe = var.load_balancer_probe } } diff --git a/examples/networking/virtual_network_gateway/101-vpn-site-to-site/configuration.tfvars b/examples/networking/virtual_network_gateway/101-vpn-site-to-site/configuration.tfvars index 31136fa05..bffc315c0 100644 --- a/examples/networking/virtual_network_gateway/101-vpn-site-to-site/configuration.tfvars +++ b/examples/networking/virtual_network_gateway/101-vpn-site-to-site/configuration.tfvars @@ -86,10 +86,10 @@ virtual_network_gateways = { } bgp_settings = { bpgsettings1 = { - asn = 65512 - peering_address = "10.0.0.5" - peer_weight = 0 + asn = 65512 + peering_address = "10.0.0.5" + peer_weight = 0 + } } - } } } \ No newline at end of file diff --git a/examples/variables.tf b/examples/variables.tf index 9a123d0ec..e9f64b493 100644 --- a/examples/variables.tf +++ b/examples/variables.tf @@ -324,7 +324,7 @@ variable "netapp_accounts" { } variable "load_balancers" { - default ={} + default = {} } variable "ip_groups" { diff --git a/examples/webapps/appservice/105-appservice-backup/configuration.tfvars b/examples/webapps/appservice/105-appservice-backup/configuration.tfvars index d70eb08db..f1614ac94 100644 --- a/examples/webapps/appservice/105-appservice-backup/configuration.tfvars +++ b/examples/webapps/appservice/105-appservice-backup/configuration.tfvars @@ -57,7 +57,7 @@ app_services = { name = "test" enabled = true storage_account_key = "sa1" - container_key = "backup" + container_key = "backup" //storage_account_url = "https://cindstsabackup.blob.core.windows.net/webapp-backup?sv=2018-11-09&sr=c&st=2021-02-08T07%3A07%3A42Z&se=2021-03-10T07%3A07%3A42Z&sp=racwdl&spr=https&sig=5LX%2ByDoE4YQsf%2F0L5f42eML9mk%2Fu5ejjZYVIs81Keng%3D" sas_policy = { @@ -75,11 +75,11 @@ app_services = { } schedule = { - frequency_interval = 1 - frequency_unit = "Day" + frequency_interval = 1 + frequency_unit = "Day" keep_at_least_one_backup = true retention_period_in_days = 1 - start_time = "2021-02-08T00:00:00Z" + start_time = "2021-02-08T00:00:00Z" } } } diff --git a/locals.tf b/locals.tf index 8466f7e83..6cdf54537 100644 --- a/locals.tf +++ b/locals.tf @@ -1,5 +1,5 @@ resource "random_string" "prefix" { - count = try(var.global_settings.prefix, null) == null ? 1 : 0 + count = try(var.global_settings.prefix, null) == null ? 1 : 0 length = 4 special = false upper = false @@ -7,7 +7,7 @@ resource "random_string" "prefix" { } resource "random_string" "alpha1" { - count = try(var.global_settings.prefix, null) == null ? 1 : 0 + count = try(var.global_settings.prefix, null) == null ? 1 : 0 length = 1 special = false upper = false diff --git a/modules/compute/container_group/container_group.tf b/modules/compute/container_group/container_group.tf index b6de5808b..47d2373f9 100644 --- a/modules/compute/container_group/container_group.tf +++ b/modules/compute/container_group/container_group.tf @@ -122,7 +122,7 @@ resource "azurerm_container_group" "acg" { } //container_content } //container - dynamic "identity" { + dynamic "identity" { for_each = try(var.settings.identity, false) == false ? [] : [1] content { diff --git a/modules/compute/container_group/locals.tf b/modules/compute/container_group/locals.tf index 510f46e30..3acd935c4 100644 --- a/modules/compute/container_group/locals.tf +++ b/modules/compute/container_group/locals.tf @@ -8,19 +8,19 @@ locals { if try(value.count, null) == null } - # Get the containers with count + # Get the containers with count countainers_count = { for key, value in var.settings.containers : key => value if try(value.count, null) != null } # Expand the count countainer and add the iterator in the key and name - countainers_count_expanded = { - for container in + countainers_count_expanded = { + for container in flatten( [ for key, value in local.countainers_count : [ - for number in range(value.count) : + for number in range(value.count) : { key = format("%s-%s", key, number) iterator = number @@ -56,17 +56,17 @@ locals { environment_variables_from_resources_list = { for mapping in - flatten( + flatten( [ for container_key, container_value in try(var.settings.containers, {}) : [ for env_key, env_value in try(container_value.environment_variables_from_resources, {}) : { container_key = container_key - env_key = env_key - value = var.combined_resources[env_value.output_key][try(env_value.lz_key, var.client_config.landingzone_key)][env_value.resource_key][env_value.attribute_key] + env_key = env_key + value = var.combined_resources[env_value.output_key][try(env_value.lz_key, var.client_config.landingzone_key)][env_value.resource_key][env_value.attribute_key] } ] ] - ) : mapping.container_key => mapping ... - } + ) : mapping.container_key => mapping... + } } \ No newline at end of file diff --git a/modules/compute/container_group/variables.tf b/modules/compute/container_group/variables.tf index fd0bebf02..25d4123f9 100644 --- a/modules/compute/container_group/variables.tf +++ b/modules/compute/container_group/variables.tf @@ -4,7 +4,7 @@ variable diagnostic_profiles {} variable combined_diagnostics {} variable combined_resources { description = "Provide a map of combined resources for environment_variables_from_resources" - default = {} + default = {} } variable global_settings {} variable location {} diff --git a/modules/networking/application_gateway/application_gateway.tf b/modules/networking/application_gateway/application_gateway.tf index 1c9eeb3b2..0ccf974a8 100644 --- a/modules/networking/application_gateway/application_gateway.tf +++ b/modules/networking/application_gateway/application_gateway.tf @@ -76,10 +76,10 @@ resource "azurerm_application_gateway" "agw" { frontend_ip_configuration_name = var.settings.front_end_ip_configurations[http_listener.value.front_end_ip_configuration_key].name frontend_port_name = var.settings.front_end_ports[http_listener.value.front_end_port_key].name protocol = var.settings.front_end_ports[http_listener.value.front_end_port_key].protocol - host_name = try(trimsuffix((try(http_listener.value.host_names, null) == null ? try(var.dns_zones[try(http_listener.value.dns_zone.lz_key, var.client_config.landingzone_key)][http_listener.value.dns_zone.key].records[0][http_listener.value.dns_zone.record_type][http_listener.value.dns_zone.record_key].fqdn, http_listener.value.host_name) : null),"."), null) + host_name = try(trimsuffix((try(http_listener.value.host_names, null) == null ? try(var.dns_zones[try(http_listener.value.dns_zone.lz_key, var.client_config.landingzone_key)][http_listener.value.dns_zone.key].records[0][http_listener.value.dns_zone.record_type][http_listener.value.dns_zone.record_key].fqdn, http_listener.value.host_name) : null), "."), null) host_names = try(http_listener.value.host_name, null) == null ? try(http_listener.value.host_names, null) : null require_sni = try(http_listener.value.require_sni, false) - ssl_certificate_name = try(try(http_listener.value.keyvault_certificate_request.key,http_listener.value.keyvault_certificate.certificate_key), null) + ssl_certificate_name = try(try(http_listener.value.keyvault_certificate_request.key, http_listener.value.keyvault_certificate.certificate_key), null) } } @@ -87,15 +87,15 @@ resource "azurerm_application_gateway" "agw" { for_each = local.listeners content { - name = "${try(local.request_routing_rules[format("%s-%s", request_routing_rule.value.app_key, request_routing_rule.value.request_routing_rule_key)].rule.prefix,"")}${request_routing_rule.value.name}" + name = "${try(local.request_routing_rules[format("%s-%s", request_routing_rule.value.app_key, request_routing_rule.value.request_routing_rule_key)].rule.prefix, "")}${request_routing_rule.value.name}" rule_type = try(local.request_routing_rules[format("%s-%s", request_routing_rule.value.app_key, request_routing_rule.value.request_routing_rule_key)].rule.rule_type, "Basic") http_listener_name = request_routing_rule.value.name backend_http_settings_name = local.backend_http_settings[request_routing_rule.value.app_key].name backend_address_pool_name = local.backend_pools[request_routing_rule.value.app_key].name - url_path_map_name = try(local.request_routing_rules[format("%s-%s", request_routing_rule.value.app_key, request_routing_rule.value.request_routing_rule_key)].rule.url_path_map_name, try(local.url_path_maps[format("%s-%s", request_routing_rule.value.app_key, - local.request_routing_rules[format("%s-%s", request_routing_rule.value.app_key, request_routing_rule.value.request_routing_rule_key)].rule.url_path_map_key)].name,null)) - - + url_path_map_name = try(local.request_routing_rules[format("%s-%s", request_routing_rule.value.app_key, request_routing_rule.value.request_routing_rule_key)].rule.url_path_map_name, try(local.url_path_maps[format("%s-%s", request_routing_rule.value.app_key, + local.request_routing_rules[format("%s-%s", request_routing_rule.value.app_key, request_routing_rule.value.request_routing_rule_key)].rule.url_path_map_key)].name, null)) + + } } @@ -107,9 +107,9 @@ resource "azurerm_application_gateway" "agw" { name = url_path_map.value.name dynamic "path_rule" { - for_each = try(url_path_map.value.path_rules, []) + for_each = try(url_path_map.value.path_rules, []) - content{ + content { backend_address_pool_name = try(var.application_gateway_applications[path_rule.value.backend_pool.app_key].name, var.application_gateway_applications[path_rule.value.backend_pool.app_key].name) backend_http_settings_name = try(var.application_gateway_applications[path_rule.value.backend_http_setting.app_key].name, var.application_gateway_applications[url_path_map.value.app_key].name) name = path_rule.value.name @@ -169,7 +169,7 @@ resource "azurerm_application_gateway" "agw" { } } - + # ssl_policy { # } @@ -212,6 +212,6 @@ resource "azurerm_application_gateway" "agw" { } - output "certificate_keys" { - value = local.certificate_keys - } \ No newline at end of file +output "certificate_keys" { + value = local.certificate_keys +} \ No newline at end of file diff --git a/modules/networking/application_gateway/locals.tf b/modules/networking/application_gateway/locals.tf index 0e96614c3..83c99d6e4 100644 --- a/modules/networking/application_gateway/locals.tf +++ b/modules/networking/application_gateway/locals.tf @@ -1,7 +1,7 @@ locals { backend_http_settings = { for key, value in var.application_gateway_applications : key => merge({ name = value.name }, value.backend_http_setting) - if lookup(value,"backend_http_setting",false) != false + if lookup(value, "backend_http_setting", false) != false } listeners = { @@ -9,7 +9,7 @@ locals { flatten( [ for app_key, config in var.application_gateway_applications : [ - for listener_key, value in try(config.listeners,[]) : { + for listener_key, value in try(config.listeners, []) : { listener_key = listener_key app_key = app_key value = merge({ app_key = app_key }, value) @@ -24,7 +24,7 @@ locals { flatten( [ for app_key, config in var.application_gateway_applications : [ - for request_key, value in try(config.request_routing_rules,[]) : { + for request_key, value in try(config.request_routing_rules, []) : { name = config.name request_key = request_key app_key = app_key @@ -40,8 +40,8 @@ locals { flatten( [ for app_key, config in var.application_gateway_applications : [ - for key, value in try(config.url_path_maps,[]) : { - value = merge({ app_key = app_key, url_path_map_key = key }, value) + for key, value in try(config.url_path_maps, []) : { + value = merge({ app_key = app_key, url_path_map_key = key }, value) } ] ] diff --git a/modules/networking/application_gateway/variable.tf b/modules/networking/application_gateway/variable.tf index 906f369fb..f8ab5a527 100644 --- a/modules/networking/application_gateway/variable.tf +++ b/modules/networking/application_gateway/variable.tf @@ -57,7 +57,7 @@ variable "private_dns" { variable "keyvault_certificates" { default = {} } -variable "keyvault_certificate_requests"{ +variable "keyvault_certificate_requests" { default = {} } variable "managed_identities" { diff --git a/modules/networking/load_balancers/load_balancers.tf b/modules/networking/load_balancers/load_balancers.tf index 565c06f2b..2fa62569c 100644 --- a/modules/networking/load_balancers/load_balancers.tf +++ b/modules/networking/load_balancers/load_balancers.tf @@ -86,12 +86,12 @@ resource "azurerm_lb_rule" "lb_rule" { resource "azurerm_lb_outbound_rule" "outbound_rule" { for_each = try(var.settings.outbound_rules, {}) - resource_group_name = var.resource_group_name - loadbalancer_id = azurerm_lb.lb.id - name = each.value.name - protocol = each.value.protocol - backend_address_pool_id = azurerm_lb_backend_address_pool.backend_address_pool.0.id - enable_tcp_reset = try(each.value.enable_tcp_reset, null) + resource_group_name = var.resource_group_name + loadbalancer_id = azurerm_lb.lb.id + name = each.value.name + protocol = each.value.protocol + backend_address_pool_id = azurerm_lb_backend_address_pool.backend_address_pool.0.id + enable_tcp_reset = try(each.value.enable_tcp_reset, null) allocated_outbound_ports = try(each.value.allocated_outbound_ports, null) idle_timeout_in_minutes = try(each.value.idle_timeout_in_minutes, null) diff --git a/modules/security/keyvault_certificate_request/module.tf b/modules/security/keyvault_certificate_request/module.tf index 2de914c01..766795c80 100644 --- a/modules/security/keyvault_certificate_request/module.tf +++ b/modules/security/keyvault_certificate_request/module.tf @@ -32,7 +32,7 @@ resource "azurerm_key_vault_certificate" "csr" { extended_key_usage = try(x509_certificate_properties.value.extended_key_usage, null) key_usage = x509_certificate_properties.value.key_usage # subject = x509_certificate_properties.value.subject - subject = try(x509_certificate_properties.value.subject, "CN=${try("${x509_certificate_properties.value.domain_name_registration.subdomain}.","")}${var.domain_name_registrations[x509_certificate_properties.value.domain_name_registration.key].dns_domain_registration_name}") + subject = try(x509_certificate_properties.value.subject, "CN=${try("${x509_certificate_properties.value.domain_name_registration.subdomain}.", "")}${var.domain_name_registrations[x509_certificate_properties.value.domain_name_registration.key].dns_domain_registration_name}") validity_in_months = x509_certificate_properties.value.validity_in_months dynamic subject_alternative_names { diff --git a/modules/webapps/appservice/storage_account.tf b/modules/webapps/appservice/storage_account.tf index 81a94288c..2f94c6510 100644 --- a/modules/webapps/appservice/storage_account.tf +++ b/modules/webapps/appservice/storage_account.tf @@ -1,5 +1,5 @@ data "azurerm_storage_account_blob_container_sas" "backup" { - count = try(var.settings.backup, null) != null ? 1 : 0 + count = try(var.settings.backup, null) != null ? 1 : 0 connection_string = local.backup_storage_account.primary_connection_string container_name = local.backup_storage_account.containers[var.settings.backup.container_key].name @@ -19,7 +19,7 @@ data "azurerm_storage_account_blob_container_sas" "backup" { } resource "time_rotating" "sas" { - count = try(var.settings.backup, null) != null ? 1 : 0 + count = try(var.settings.backup, null) != null ? 1 : 0 rotation_minutes = lookup(var.settings.backup.sas_policy.rotation, "mins", null) rotation_days = lookup(var.settings.backup.sas_policy.rotation, "days", null) diff --git a/msssql_managed_instances.tf b/msssql_managed_instances.tf index facce0b33..ade070a54 100644 --- a/msssql_managed_instances.tf +++ b/msssql_managed_instances.tf @@ -4,7 +4,7 @@ output mssql_managed_instances { } output mssql_managed_instances_secondary { - value = module.mssql_managed_instances_secondary + value = module.mssql_managed_instances_secondary } module "mssql_managed_instances" {