J0hn-B / terraform-azurerm-caf-enterprise-scale

Terraform Module for Cloud Adoption Framework Enterprise-scale

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform Module for Cloud Adoption Framework Enterprise-scale

Build Status GitHub release (latest SemVer)

MODULE UPGRADE NOTES

The v0.3.0 release focuses mainly on updating the test framework, but also introduces a breaking change which removes the need (and support for) wrapping user-defined parameters in jsonencode(). When upgrading to this release, please ensure to update your code to use native HCL values as documented in the release notes.

The v0.2.0 release added new functionality to enable deployment of Management and monitoring resources into the current Subscription context. Please refer to the Deploy Management Resources page on our Wiki for more information about how to use this.

Documentation

For detailed information about how to use, configure and extend this module, please refer to the documentation on our Wiki:

Overview

The Terraform Module for Cloud Adoption Framework Enterprise-scale provides an opinionated approach for delivering Azure landing zones using Terraform. Depending on the selected options, this module is able to deploy different groups of resources as needed.

This is currently split logically into the following capabilities:

  • Core resources
  • Management resources

The following sections outline the different resource types deployed and managed by this module, depending on the configuration options specified.

Core resources

The core capability of this module deploys the foundations of the Cloud Adoption Framework enterprise-scale landing zone architecture, with a focus on the central resource hierarchy and governance:

Enterprise-scale Core Landing Zones Architecture

The following resource types are deployed and managed by this module when using the core capabilities:

Azure Resource Terraform Resource
Management Groups Microsoft.Management/managementGroups azurerm_management_group
Management Group Subscriptions Microsoft.Management/managementGroups/subscriptions azurerm_management_group
Policy Assignments Microsoft.Authorization/policyAssignments azurerm_policy_assignment
Policy Definitions Microsoft.Authorization/policyDefinitions azurerm_policy_definition
Policy Set Definitions Microsoft.Authorization/policySetDefinitions azurerm_policy_set_definition
Role Assignments Microsoft.Authorization/roleAssignments azurerm_role_assignment
Role Definitions Microsoft.Authorization/roleDefinitions azurerm_role_definition

The exact number of resources created depends on the module configuration, but you can expect upwards of 100 resources to be created by this module for a default installation based on the example below.

NOTE: None of these resources are deployed at the Subscription scope, however Terraform still requires a Subscription to establish an authenticated session with Azure.

Management resources

From release v0.2.0 onwards, the module includes new functionality to enable deployment of Management and monitoring resources into the current Subscription context. This brings the benefit of being able to manage the full lifecycle of these resources using Terraform, with native integration into the corresponding Policy Assignments to ensure full policy compliance.

Enterprise-scale Management Landing Zone Architecture

The following resource types are deployed and managed by this module when the Management resources capabilities are enabled:

Azure Resource Terraform Resource
Resource Groups Microsoft.Resources/resourceGroups azurerm_resource_group
Log Analytics Workspace Microsoft.OperationalInsights/workspaces azurerm_log_analytics_workspace
Log Analytics Solutions Microsoft.OperationsManagement/solutions azurerm_log_analytics_solution
Automation Account Microsoft.Automation/automationAccounts azurerm_automation_account
Log Analytics Linked Service Microsoft.OperationalInsights/workspaces /linkedServices azurerm_log_analytics_linked_service

Please refer to the Deploy Management Resources page on our Wiki for more information about how to use this capability.

Terraform versions

This module has been tested using Terraform 0.13.2 and AzureRM Provider 2.41.0 as a baseline, and various versions to up the most recent at the time of release. In some cases, individual versions of the AzureRM provider may cause errors. If this happens, we advise upgrading to the latest version and checking our troubleshooting guide before raising an issue.

Usage

As a basic starting point, we recommend starting with the following configuration in your root module.

NOTE: For production use we highly recommend using the Terraform Registry and pinning to the latest stable version, as per the example below. Pinning to the main branch in GitHub will give you the latest updates quicker, but increases the likelihood of unplanned changes to your environment and unforeseen issues.

File: main.tf

# Configure Terraform to set the required AzureRM provider
# version and features{} block.

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = ">= 2.41.0"
    }
  }
}

provider "azurerm" {
  features {}
}

# Get the current client configuration from the AzureRM provider.
# This is used to populate the root_parent_id variable with the
# current Tenant ID used as the ID for the "Tenant Root Group"
# Management Group.

data "azurerm_client_config" "current" {}

# Use variables to customise the deployment

variable "root_id" {
  type    = string
  default = "es"
}

variable "root_name" {
  type    = string
  default = "Enterprise-Scale"
}

# Declare the Terraform Module for Cloud Adoption Framework
# Enterprise-scale and provide a base configuration.

module "enterprise_scale" {
  source  = "Azure/caf-enterprise-scale/azurerm"
  version = "0.3.3"

  root_parent_id = data.azurerm_client_config.current.tenant_id
  root_id        = var.root_id
  root_name      = var.root_name

}

For additional guidance on how to customise your deployment using the advanced configuration options for this module, please refer to our User Guide and the additional examples in our documentation.

License

MIT License

Contributing

Contributing Guide

About

Terraform Module for Cloud Adoption Framework Enterprise-scale

License:MIT License


Languages

Language:HCL 71.4%Language:PowerShell 22.9%Language:Shell 5.3%Language:Makefile 0.4%