-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Thank you for submitting a Pull Request. Please fill out the template below.--> ## Overview/Summary Replace this with a brief description of what this Pull Request fixes, changes, etc. ## This PR fixes/adds/changes/removes 1. #96 ### Breaking Changes 1. None ## Testing Evidence Please provide any testing evidence to show that your Pull Request works/fixes as described and planned (include screenshots, if appropriate). ## As part of this Pull Request I have - [x] Checked for duplicate [Pull Requests](https://github.com/Azure/alz-terraform-accelerator/pulls) - [x] Associated it with relevant [issues](https://github.com/Azure/alz-terraform-accelerator/issues), for tracking and closure. - [x] Ensured my code/branch is up-to-date with the latest changes in the `main` [branch](https://github.com/Azure/alz-terraform-accelerator/tree/main) - [x] Performed testing and provided evidence. - [x] Updated relevant and associated documentation. --------- Co-authored-by: Jared Holgate <[email protected]>
- Loading branch information
1 parent
0fd7291
commit fff7bf1
Showing
14 changed files
with
224 additions
and
179 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
data "azurerm_client_config" "current" {} | ||
data "azurerm_client_config" "core" {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,59 @@ | ||
locals { | ||
root_management_group_id = var.root_management_group_id == "" ? data.azurerm_client_config.current.tenant_id : var.root_management_group_id | ||
const_yaml = "yaml" | ||
const_yml = "yml" | ||
|
||
base_config_replacements = { | ||
default_location = var.default_location | ||
default_postfix = var.default_postfix | ||
root_management_group_id = local.root_management_group_id | ||
subscription_id_connectivity = var.subscription_id_connectivity | ||
subscription_id_identity = var.subscription_id_identity | ||
subscription_id_management = var.subscription_id_management | ||
config_file_name = var.configuration_file_path == "" ? "config.yaml" : basename(var.configuration_file_path) | ||
config_file_split = split(".", local.config_file_name) | ||
config_file_extension = replace(lower(element(local.config_file_split, length(local.config_file_split) - 1)), local.const_yml, local.const_yaml) | ||
} | ||
locals { | ||
config_template_file_variables = { | ||
default_location = var.default_location | ||
default_postfix = var.default_postfix | ||
root_parent_management_group_id = var.root_parent_management_group_id == "" ? data.azurerm_client_config.core.tenant_id : var.root_parent_management_group_id | ||
subscription_id_connectivity = var.subscription_id_connectivity | ||
subscription_id_identity = var.subscription_id_identity | ||
subscription_id_management = var.subscription_id_management | ||
} | ||
|
||
initial_config = yamldecode(templatefile("${path.module}/config.yaml", local.base_config_replacements)) | ||
|
||
management = local.initial_config.management | ||
connectivity = local.initial_config.connectivity | ||
|
||
hub_virtual_networks = { | ||
for k, v in local.connectivity.hub_networking.hub_virtual_networks : k => { | ||
for k2, v2 in v : k2 => v2 if k2 != "virtual_network_gateway" | ||
config = (local.config_file_extension == local.const_yaml ? | ||
yamldecode(templatefile("${path.module}/${local.config_file_name}", local.config_template_file_variables)) : | ||
jsondecode(templatefile("${path.module}/${local.config_file_name}", local.config_template_file_variables)) | ||
) | ||
} | ||
locals { | ||
root_parent_management_group_id = local.config_template_file_variables.root_parent_management_group_id | ||
management_groups = local.config.management_groups | ||
management_groups_layer_1 = { for k, v in local.management_groups : k => v if v.parent == local.root_parent_management_group_id } | ||
management_groups_layer_2 = { for k, v in local.management_groups : k => v if contains(keys(local.management_groups_layer_1), v.parent) } | ||
management_groups_layer_3 = { for k, v in local.management_groups : k => v if contains(keys(local.management_groups_layer_2), v.parent) } | ||
management_groups_layer_4 = { for k, v in local.management_groups : k => v if contains(keys(local.management_groups_layer_3), v.parent) } | ||
management_groups_layer_5 = { for k, v in local.management_groups : k => v if contains(keys(local.management_groups_layer_4), v.parent) } | ||
management_groups_layer_6 = { for k, v in local.management_groups : k => v if contains(keys(local.management_groups_layer_5), v.parent) } | ||
management_groups_layer_7 = { for k, v in local.management_groups : k => v if contains(keys(local.management_groups_layer_6), v.parent) } | ||
} | ||
locals { | ||
management = local.config.management | ||
log_analytics_workspace_id = "/subscriptions/${var.subscription_id_management}/resourceGroups/${local.management.resource_group_name}/providers/Microsoft.OperationalInsights/workspaces/${local.management.log_analytics_workspace_name}" | ||
} | ||
locals { | ||
hub_virtual_networks = try(merge(local.config.connectivity.hubnetworking.hub_virtual_networks, {}), {}) | ||
module_hubnetworking = { | ||
hub_virtual_networks = { | ||
for key, hub_virtual_network in local.hub_virtual_networks : key => { | ||
for argument, value in hub_virtual_network : argument => value if argument != "virtual_network_gateway" | ||
} | ||
} | ||
} | ||
virtual_network_gateways = { | ||
for k, v in local.connectivity.hub_networking.hub_virtual_networks : k => merge( | ||
v.virtual_network_gateway, | ||
module_virtual_network_gateway = { | ||
for key, hub_virtual_network in local.hub_virtual_networks : key => merge( | ||
hub_virtual_network.virtual_network_gateway, | ||
{ | ||
location = v.location | ||
virtual_network_name = v.name | ||
virtual_network_resource_group_name = v.resource_group_name | ||
location = hub_virtual_network.location | ||
virtual_network_name = hub_virtual_network.name | ||
virtual_network_resource_group_name = hub_virtual_network.resource_group_name | ||
} | ||
) | ||
if can(hub_virtual_network.virtual_network_gateway) | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.