terraform-azurerm-caf-enterprise-scale

repository·main·Indexed 21 days ago

https://github.com/azure/terraform-azurerm-caf-enterprise-scale

An Azure landing zones Terraform module designed to accelerate the deployment of platform resources based on the Azure landing zones conceptual architecture. It includes sub-modules for management groups, connectivity, identity, and management subscriptions, as well as an archetypes sub-module for applying specific configurations to a given scope.

Tokens
95.7K
Snippets
140
Records
275
Agent score
75%

What's inside terraform-azurerm-caf-enterprise-scale

  1. Overview of Azure landing zones Terraform module

    main

    The terraform-azurerm-caf-enterprise-scale module provides an opinionated approach for deploying and managing core platform capabilities of Azure landing zones architecture. It focuses on the central resource hierarchy and allows for the deployment of specific resource sets based on selected capabilities.

    Supported capability sets include:

    • Core Resources
    • Management Resources
    • Connectivity Resources
    • Identity Resources
  2. New features in v2.0.0

    main

    The v2.0.0 release includes several enhancements:

    • Connectivity: Added support for Azure Virtual WAN hub networks and extended Virtual Network Gateway configuration options for hub and spoke networks.
    • Policies: Updated policies to match the upstream Azure/Enterprise-Scale repository.
    • Azure Firewall: Added Azure Firewall Policy resources to enable DNS Proxy settings and simplify configuration.
    • VPN Gateways:
      • Automatic configuration of generation value.
      • Simplified active-active mode configuration.
      • Added BGP configuration settings and vpn_auth_types attribute for vpn_client_configuration.
    • Resource Management: Added asc_export_resource_group_name variable and logic to suppress Public IP creation when a custom ip_configuration is provided via the advanced block for azurerm_virtual_network_gateway and azurerm_firewall.
  3. Core capabilities and resource types of the CAF Enterprise Scale module

    main

    The core capability of this module implements the foundations of the Azure landing zones conceptual architecture, specifically focusing on central resource organization.

    When using the core capabilities, the module manages several key Azure resource types via Terraform. The exact number of resources created depends on your specific configuration; for a default configuration, approximately 180 resources are typically created.

    Managed Resource Types

    ResourceAzure resource typeTerraform resource type
    Management groupsMicrosoft.Management/managementGroupsazurerm_management_group
    Management group subscriptionsMicrosoft.Management/managementGroups/subscriptionsazurerm_management_group or azurerm_management_group_subscription_association
    Policy assignmentsMicrosoft.Authorization/policyAssignmentsazurerm_management_group_policy_assignment
    Policy definitionsMicrosoft.Authorization/policyDefinitionsazurerm_policy_definition
    Policy set definitionsMicrosoft.Authorization/policySetDefinitionsazurerm_policy_set_definition
    Role assignmentsMicrosoft.Authorization/roleAssignmentsazurerm_role_assignment
    Role definitionsMicrosoft.Authorization/roleDefinitionsazurerm_role_definition
  4. Overview of Connectivity Resources in CAF Enterprise Scale

    main

    The module allows for the deployment of network topology and connectivity resources into the current subscription context, specifically targeting the connectivity subscription. It ensures the subscription is placed in the correct management group and supports multiple hub networks using either traditional hub-and-spoke or Microsoft-managed Virtual WAN topologies.

    Key capabilities include:

    • Deploying traditional hub-and-spoke networks.
    • Deploying Virtual WAN (vWAN) network topologies.
    • Creating and linking DDoS Protection Standard to Virtual Networks.
    • Managing centralized public and private DNS zones.

    Note on Spoke Management: The module currently focuses on configuring the hub network and dependent resources for the connectivity subscription. While outbound peering from hub to spoke can be enabled, users must still manually initiate peering from the spoke to the hub due to AzureRM provider limitations regarding subscription targeting.

  5. Overview of Azure Landing Zones Module Capabilities

    main

    The Azure landing zones Terraform module accelerates the deployment of platform resources based on the Azure landing zones conceptual architecture. The module is logically split into several capabilities:

    Module capabilityScopeDesign area
    Core ResourcesManagement group and subscription organizationResource organization
    Management ResourcesManagement subscriptionManagement
    Connectivity ResourcesConnectivity subscriptionNetwork topology and connectivity
    Identity ResourcesIdentity subscriptionIdentity and access management

    Key Architectural Concepts

    • Governance Baseline: The module deploys a management group hierarchy including recommended governance via Azure Policy and Access control (IAM) at the management group scope.
    • Multi-Subscription Deployment: To enable deployment across multiple subscriptions (e.g., management and connectivity), you must configure a Provider Configuration block.
    • Modular Design: While logically grouped, resources can be deployed using different Terraform workspaces to manage large state files or enforce the principle of least privilege.
  6. Overview of Azure landing zones Terraform module capabilities

    main

    The module accelerates the deployment of platform resources based on the Azure landing zones conceptual architecture. It is logically split into the following capabilities:

    Module capabilityScopeDesign area
    Core ResourcesManagement group and subscription organizationResource organization
    Management ResourcesManagement subscriptionManagement
    Connectivity ResourcesConnectivity subscriptionNetwork topology and connectivity
    Identity ResourcesIdentity subscriptionIdentity and access management

    The module can deploy a management group hierarchy including a governance baseline (Azure Policy and IAM) at the management group scope. While resources are logically grouped, the modular design allows them to be deployed using different Terraform workspaces to manage large state files or enforce granular permissions.

  7. What is an archetype in Azure landing zones?

    main

    In the Azure landing zone conceptual architecture, an archetype is a template-driven definition used to transform Management Groups and Subscriptions into functional Landing Zones.

    An archetype defines the necessary Azure Policy and Access control (IAM) settings required to secure and configure a Landing Zone for safe handover to its owner. This includes:

    • Consistent RBAC settings: Standardized role-based access control.
    • Security Guardrails: Enforced security settings.
    • Workload Guardrails: Configuration standards for specific workloads (e.g., SAP, AKS, WVD).
    • Automated Provisioning: Deployment of critical platform resources like monitoring and networking solutions within each Landing Zone.

    This mechanism allows application teams to operate with autonomy while ensuring organizational security policies and standards are strictly enforced.

  8. Configure DDoS Protection plans

    main

    The module can deploy DDoS Network Protection and link Virtual Networks to the plan.

    Constraints and Recommendations:

    • Compatibility: DDoS protection plans can only be enabled for traditional virtual networks. Support for Virtual Hubs is not currently available.
    • Cost Warning: DDoS Network Protection incurs costs. This capability is disabled by default in the module to prevent unexpected charges in non-production or MVP environments.
    • Best Practice: For production environments, it is strongly recommended to enable this capability to increase platform protection.

    Managed resource types:

    • azurerm_resource_group
    • azurerm_network_ddos_protection_plan
  9. Tune Terraform apply/destroy delays for eventual consistency

    main

    To handle errors caused by Azure API caching or eventual consistency, you can use create_duration_delay and destroy_duration_delay to set custom wait periods after resource operations.

    Create Delays

    Use create_duration_delay to set delays for:

    • azurerm_management_group (default: 30s)
    • azurerm_policy_assignment (default: 30s)
    • azurerm_policy_definition (default: 30s)
    • azurerm_policy_set_definition (default: 30s)
    • azurerm_role_assignment (default: 0s)
    • azurerm_role_definition (default: 60s)

    Destroy Delays

    Use destroy_duration_delay to set delays for the same resource types (defaults are 0s).

  10. Create custom policy definition files

    main

    Custom policy definitions are stored as JSON files in your custom library directory. It is recommended to organize them in a policy_definitions subdirectory within your library folder.

    Each JSON file must follow the Azure Microsoft.Authorization/policyDefinitions schema. Key properties include:

    • name: The unique name of the policy.
    • properties.policyType: Should be set to Custom.
    • properties.mode: Can be All or Indexed.
    • properties.policyRule: The logic defining the policy condition and effect.
    • properties.parameters: The input parameters for the policy.
  11. Understand the deprecation timeline for the Management sub-module

    main

    The management sub-module is currently in extended support mode.

    Support Schedule:

    • Now until August 1, 2026: Extended support period. During this time, only quality updates (e.g., bug fixes) and policy library updates are provided. No new features or functionality will be added.
    • August 1, 2026: The repository will be archived, and all updates will cease.
  12. Configure Private DNS zone links for Virtual WAN

    main

    By default, the module creates private DNS zones for all services supporting private endpoints.

    Virtual Network Links:

    • For traditional hub virtual networks, the module automatically configures virtual network links to connect each private DNS zone.
    • For virtual hubs, this is not currently supported. However, you can optionally enable these links for spoke virtual networks that are being peered to the virtual hub.