-
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.
- Loading branch information
1 parent
89bd15d
commit 8f65c66
Showing
7 changed files
with
220 additions
and
11 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
archetypes: # `caf-enterprise-scale` module, add inputs as listed on the module registry where necessary. | ||
root_name: es | ||
root_id: Enterprise-Scale | ||
deploy_corp_landing_zones: true | ||
deploy_online_landing_zones: true | ||
default_location: uksouth | ||
deploy_management_resources: true | ||
configure_management_resources: | ||
location: uksouth | ||
settings: | ||
security_center: | ||
config: | ||
email_security_contact: "security_contact@replace_me" | ||
advanced: | ||
asc_export_resource_group_name: rg-asc-export | ||
custom_settings_by_resource_type: | ||
azurerm_resource_group: | ||
management: | ||
name: rg-management | ||
azurerm_log_analytics_workspace: | ||
management: | ||
name: log-management | ||
azurerm_automation_account: | ||
management: | ||
name: aa-management | ||
connectivity: | ||
hubnetworking: # `hubnetworking` module, add inputs as listed on the module registry where necessary. | ||
hub_virtual_networks: | ||
primary: | ||
name: vnet-hub | ||
resource_group_name: rg-connectivity | ||
location: uksouth | ||
address_space: | ||
- 10.0.0.0/16 | ||
firewall: | ||
name: fw-hub | ||
sku_name: AZFW_VNet | ||
sku_tier: Standard | ||
subnet_address_prefix: 10.0.1.0/24 | ||
virtual_network_gateway: # `vnet-gateway` module, add inputs as listed on the module registry where necessary. | ||
name: vgw-hub | ||
sku: VpnGw1 | ||
type: Vpn | ||
subnet_address_prefix: 10.0.2.0/24 |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
locals { | ||
config = yamldecode(file("${path.module}/config.yaml")) | ||
archetypes = local.config.archetypes | ||
hub_virtual_networks = { | ||
for k, v in local.config.connectivity.hubnetworking.hub_virtual_networks : k => { | ||
for k2, v2 in v : k2 => v2 if k2 != "virtual_network_gateway" | ||
} | ||
} | ||
vritual_network_gateways = { | ||
for k, v in local.config.connectivity.hubnetworking.hub_virtual_networks : k => merge( | ||
v.virtual_network_gateway, | ||
{ | ||
location = v.location | ||
virtual_network_name = v.name | ||
virtual_network_resource_group_name = v.resource_group_name | ||
} | ||
) | ||
} | ||
dummy_hub_virtual_network = { | ||
hub = { | ||
name = "dummy" | ||
address_space = ["0.0.0.0/0"] | ||
location = "dummy" | ||
resource_group_name = "dummy" | ||
} | ||
} | ||
} |
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 |
---|---|---|
@@ -0,0 +1,99 @@ | ||
module "enterprise-scale" { | ||
source = "Azure/caf-enterprise-scale/azurerm" | ||
version = "4.2.0" | ||
|
||
default_location = local.archetypes.default_location | ||
root_parent_id = try(local.archetypes.root_parent_id, data.azurerm_client_config.core.tenant_id) | ||
|
||
archetype_config_overrides = try(local.archetypes.archetype_config_overrides, {}) | ||
configure_connectivity_resources = try(local.archetypes.configure_connectivity_resources, {}) | ||
configure_identity_resources = try(local.archetypes.configure_identity_resources, {}) | ||
configure_management_resources = try(local.archetypes.configure_management_resources, {}) | ||
create_duration_delay = try(local.archetypes.create_duration_delay, {}) | ||
custom_landing_zones = try(local.archetypes.custom_landing_zones, {}) | ||
custom_policy_roles = try(local.archetypes.custom_policy_roles, {}) | ||
default_tags = try(local.archetypes.default_tags, {}) | ||
deploy_connectivity_resources = try(local.archetypes.deploy_connectivity_resources, false) | ||
deploy_core_landing_zones = try(local.archetypes.deploy_core_landing_zones, true) | ||
deploy_corp_landing_zones = try(local.archetypes.deploy_corp_landing_zones, false) | ||
deploy_demo_landing_zones = try(local.archetypes.deploy_demo_landing_zones, false) | ||
deploy_diagnostics_for_mg = try(local.archetypes.deploy_diagnostics_for_mg, false) | ||
deploy_identity_resources = try(local.archetypes.deploy_identity_resources, false) | ||
deploy_management_resources = try(local.archetypes.deploy_management_resources, false) | ||
deploy_online_landing_zones = try(local.archetypes.deploy_online_landing_zones, false) | ||
deploy_sap_landing_zones = try(local.archetypes.deploy_sap_landing_zones, false) | ||
destroy_duration_delay = try(local.archetypes.destroy_duration_delay, {}) | ||
disable_base_module_tags = try(local.archetypes.disable_base_module_tags, false) | ||
disable_telemetry = try(local.archetypes.disable_telemetry, false) | ||
library_path = try(local.archetypes.library_path, "") | ||
policy_non_compliance_message_default = try(local.archetypes.policy_non_compliance_message_default, "This resource {enforcementMode} be compliant with the assigned policy.") | ||
policy_non_compliance_message_default_enabled = try(local.archetypes.policy_non_compliance_message_default_enabled, true) | ||
policy_non_compliance_message_enabled = try(local.archetypes.policy_non_compliance_message_enabled, true) | ||
policy_non_compliance_message_enforced_replacement = try(local.archetypes.policy_non_compliance_message_enforced_replacement, "must") | ||
policy_non_compliance_message_enforcement_placeholder = try(local.archetypes.policy_non_compliance_message_enforcement_placeholder, "{enforcementMode}") | ||
policy_non_compliance_message_not_enforced_replacement = try(local.archetypes.policy_non_compliance_message_not_enforced_replacement, "should") | ||
policy_non_compliance_message_not_supported_definitions = try(local.archetypes.policy_non_compliance_message_not_supported_definitions, ["/providers/Microsoft.Authorization/policyDefinitions/1c6e92c9-99f0-4e55-9cf2-0c234dc48f99", "/providers/Microsoft.Authorization/policyDefinitions/1a5b4dca-0b6f-4cf5-907c-56316bc1bf3d", "/providers/Microsoft.Authorization/policyDefinitions/95edb821-ddaf-4404-9732-666045e056b4"]) | ||
resource_custom_timeouts = try(local.archetypes.resource_custom_timeouts, {}) | ||
root_id = try(local.archetypes.root_id, "es") | ||
root_name = try(local.archetypes.root_name, "Enterprise-Scale") | ||
strict_subscription_association = try(local.archetypes.strict_subscription_association, true) | ||
subscription_id_connectivity = var.subscription_id_connectivity | ||
subscription_id_identity = var.subscription_id_identity | ||
subscription_id_management = var.subscription_id_management | ||
subscription_id_overrides = try(local.archetypes.subscription_id_overrides, {}) | ||
template_file_variables = try(local.archetypes.template_file_variables, {}) | ||
|
||
|
||
providers = { | ||
azurerm = azurerm | ||
azurerm.connectivity = azurerm.connectivity | ||
azurerm.management = azurerm.management | ||
} | ||
} | ||
|
||
module "hubnetworking" { | ||
source = "Azure/hubnetworking/azurerm" | ||
version = "1.1.0" | ||
count = length(local.hub_virtual_networks) > 0 ? 1 : 0 | ||
|
||
hub_virtual_networks = length(local.hub_virtual_networks) > 0 ? local.hub_virtual_networks : local.dummy_hub_virtual_network | ||
|
||
providers = { | ||
azurerm = azurerm.connectivity | ||
} | ||
} | ||
|
||
module "vnet-gateway" { | ||
source = "Azure/vnet-gateway/azurerm" | ||
version = "0.1.2" | ||
|
||
for_each = local.vritual_network_gateways | ||
|
||
location = each.value.location | ||
name = each.value.name | ||
sku = each.value.sku | ||
subnet_address_prefix = each.value.subnet_address_prefix | ||
type = each.value.type | ||
virtual_network_name = each.value.virtual_network_name | ||
virtual_network_resource_group_name = each.value.virtual_network_resource_group_name | ||
default_tags = try(each.value.default_tags, null) | ||
edge_zone = try(each.value.edge_zone, null) | ||
express_route_circuits = try(each.value.express_route_circuits, null) | ||
ip_configurations = try(each.value.ip_configurations, null) | ||
local_network_gateways = try(each.value.local_network_gateways, null) | ||
tags = try(each.value.tags, null) | ||
vpn_active_active_enabled = try(each.value.vpn_active_active_enabled, null) | ||
vpn_bgp_enabled = try(each.value.vpn_bgp_enabled, null) | ||
vpn_bgp_settings = try(each.value.vpn_bgp_settings, null) | ||
vpn_generation = try(each.value.vpn_generation, null) | ||
vpn_point_to_site = try(each.value.vpn_point_to_site, null) | ||
vpn_type = try(each.value.vpn_type, null) | ||
|
||
providers = { | ||
azurerm = azurerm.connectivity | ||
} | ||
|
||
depends_on = [ | ||
module.hubnetworking | ||
] | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
variable "subscription_id_connectivity" { | ||
description = "value of the subscription id for the Connectivity subscription" | ||
type = string | ||
} | ||
|
||
variable "subscription_id_identity" { | ||
description = "value of the subscription id for the Identity subscription" | ||
type = string | ||
} | ||
|
||
variable "subscription_id_management" { | ||
description = "value of the subscription id for the Management subscription" | ||
type = string | ||
} |
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
terraform { | ||
required_version = ">= 0.12" | ||
required_providers { | ||
azurerm = ">= 3.0.0" | ||
} | ||
# backend "azurerm" {} | ||
} | ||
|
||
provider "azurerm" { | ||
features {} | ||
} | ||
|
||
provider "azurerm" { | ||
alias = "management" | ||
subscription_id = var.subscription_id_management | ||
features {} | ||
} | ||
|
||
provider "azurerm" { | ||
alias = "connectivity" | ||
subscription_id = var.subscription_id_connectivity | ||
features {} | ||
} |