Azure Bootstrap

Source code & Installation

The source code of this kit module can be found hereopen in new window

Run the following command to install the kit module:

collie kit import azure/bootstrap
1

This documentation is intended as a reference documentation for cloud foundation or platform engineers using this module.

Terraform State Storage

This module includes configuration to set up a state backend using Azure blob storage. You can activate this by configuring the terraform_state_storage variable.

Like all bootstrap modules published on collie hub, you will need to deploy this module twice to complete the bootstrap process. To migrate the state, it may be necessary to logout once from the Azure CLI az logout and then login again az login to obtain the newly created permissions for the storage container. Please see the bootstrap tutorialopen in new window for more info.

If you're not using terraform_state_storage, please configure your own backend in platform.hcl

Platform Engineers Group

This module sets up an AAD group for managing platform engineers. This is required in conjunction with enabling access to terraform state storage but can also be used to grant administrative access to Azure resources.

UPN handling for AAD Guest users

Useful if you need to translate emails into UPNs (User Principal Names) as necessary, especially for guest users. You can add this code block to your terragrunt.hcl file instead of using inputs."

locals {
upn_domain = "#EXT#@devmeshithesheep.onmicrosoft.com"
  platform_engineers_emails = [
    "meshi@meshithesheep.io" # #TODO change, enter PLATFORM ENGINEERS here
  ]

# change the upn_domain value above
  platform_engineers_members = [
    for x in local.platform_engineers_emails : {
      email = x
      upn   = "${replace(x, "@", "_")}${local.upn_domain}"
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14

Remove Bootstrap (Unbootstraping)

The following sequence must be followed in order to remove the boostrap

Delete the tfstates-config file. The platform.hcl is using the local backend

rm foundations/<foundationname>/platforms/<platformname>/tfstates-config.yml
1

Migrate the state from the Storage account back to your local machine

collie foundation deploy --bootstrap -- init -migrate-state
1

Destroy the bootsrap

collie foundation deploy --bootstrap -- destroy
1

Requirements

NameVersion
terraform>= 1.0
azuread~> 2.46.0
azurerm~> 3.81.0

Modules

NameSourceVersion
terraform_state./terraform-staten/a

Resources

NameType
azuread_directory_role.readersopen in new windowresource
azuread_directory_role_assignment.validation_readeropen in new windowresource
azuread_group.platform_engineersopen in new windowresource
azurerm_federated_identity_credential.docsopen in new windowresource
azurerm_federated_identity_credential.validationopen in new windowresource
azurerm_role_assignment.cloudfoundation_deployopen in new windowresource
azurerm_role_assignment.docs_tfstateopen in new windowresource
azurerm_role_assignment.tfstates_engineersopen in new windowresource
azurerm_role_assignment.validation_readeropen in new windowresource
azurerm_role_assignment.validation_tfstateopen in new windowresource
azurerm_role_definition.cloudfoundation_deployopen in new windowresource
azurerm_role_definition.validation_readeropen in new windowresource
azurerm_user_assigned_identity.docsopen in new windowresource
azurerm_user_assigned_identity.validationopen in new windowresource
azuread_client_config.currentopen in new windowdata source
azuread_users.platform_engineers_membersopen in new windowdata source
azurerm_management_group.parentopen in new windowdata source
azurerm_subscription.currentopen in new windowdata source

Inputs

NameDescriptionTypeDefaultRequired
aad_tenant_idId of the AAD Tenant. This is also the simultaneously the id of the root management group.stringn/ayes
documentation_uamiread-only UAMI with access to terraform states to generate documentation in CI pipelines
object({
name = string
# note: it seems wildcards are not supported yet, see https://github.com/Azure/azure-workload-identity/issues/373
oidc_subject = string
})
nullno
parent_management_group_nameName of the management group you want to use as parent for your foundation.stringn/ayes
platform_engineers_groupthe name of the cloud foundation platform engineers groupstring"cloudfoundation-platform-engineers"no
platform_engineers_membersSet up a group of platform engineers. If enabled, this group will receive access to terraform_state_storage
list(object({
email = string,
upn = string,
}))
n/ayes
terraform_state_storageConfigure this object to enable setting up a terraform state store in Azure Storage.
object({
location = string,
name = string,
config_file_path = string,
resource_group_name = optional(string)
})
n/ayes
validation_uamiread-only UAMI with access to terraform states and read-only access on the landingzone architecture for validation of the deployment in CI pipelines
object({
name = string
# note: it seems wildcards are not supported yet, see https://github.com/Azure/azure-workload-identity/issues/373
oidc_subject = string
})
nullno

Outputs

NameDescription
documentation_mdn/a
documentation_uami_client_idn/a
module_storage_account_resource_idn/a
parent_management_groupn/a
platform_engineers_azuread_group_displaynamen/a
platform_engineers_azuread_group_idn/a
platform_engineers_membersn/a
validation_uami_client_idn/a