Skip to content

Example of implementing a simple Lanzing Zone with Terraform following the Cloud Adoption Framework.

Notifications You must be signed in to change notification settings

Masahigo/caf-terraform-landingzone-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This Git repository is for a CAF Terraform Landing zone project. You can find more about the backgrounds from here. Good place to start is by skim through the intro.

Getting Started

We are using a tool called Rover. It's Dockerized and local development is done using VSCode and Dev Containers. Prerequisites for getting started are listed here.

  1. Installation process
  2. Software dependencies
  3. Latest releases

Local development

Windows 10 & WSL: Make sure there is no "time drift" between your local computer time and the time in Docker containers. Before starting the Dev Container it's good to restart Docker Desktop before continuing.

Windows 10 & WSL2: WSL2 also experiences from similar issues. To fix run sudo hwclock -s.

1. Initialize Rover in Dev Container from VSCode

[vscode@e1d53c1ca8ae ~]$ pwd
/home/vscode

2. Git checkout this repo from the container

[vscode@e1d53c1ca8ae ~]$ sudo mkdir /tf/caf-custom && sudo chown -R $(whoami) tf/caf-custom
[vscode@e1d53c1ca8ae ~]$ git clone https://github.com/Masahigo/caf-terraform-landingzone-example.git /tf/caf-custom

3. Login to Azure tenant and initialize Launchpad

[vscode@e1d53c1ca8ae ~]$ rover login
# Select subscription where Level 0 is provisioned
[vscode@e1d53c1ca8ae ~]$ az account set -s <your-subscription-id>
# Initialize Launchpad to WE (bootstrap level 0)
[vscode@e1d53c1ca8ae ~]$ rover /tf/caf/landingzones/launchpad apply -launchpad -var-file="/tf/caf-custom/tfvars/sandpit/launchpad_opensource_light.tfvars"

4. Start developing your Landing Zones!

# Deploy the Level 1 example LZ using Rover
[vscode@e1d53c1ca8ae ~]$ rover /tf/caf-custom/landingzones/level1_landingzone_example plan -var-file="/tf/caf-custom/tfvars/sandpit/level1_landingzone_example.tfvars"
[vscode@e1d53c1ca8ae ~]$ rover /tf/caf-custom/landingzones/level1_landingzone_example apply -var-file="/tf/caf-custom/tfvars/sandpit/level1_landingzone_example.tfvars"
[vscode@e1d53c1ca8ae ~]$ rover /tf/caf-custom/landingzones/level1_landingzone_example destroy -var-file="/tf/caf-custom/tfvars/sandpit/level1_landingzone_example.tfvars" -auto-approve

File structure

bootstrap_sp

landingzones
├── level1_lanzingzone_example
|   landingzone.tf
|   main.tf
|   output.tf
|   variables.tf
|   versions.tf
├── ...

tfvars
├── ci
├── dev
├── sandpit
|   launchpad_opensource_light.tfvars
|   level1_landingzone_example.tfvars
├── environment_xyz
├── ...

pipelines
├── ci
|   azure_pipelines.yml
├── dev
|   azure_pipelines.yml
├── environment_xyz
├── ...

bootstrap_sp

This folder contains shell and Terraform scripts for creating the Service Principal account (level0-bootstrap-sp) needed for Rover in CI/CD.

See the CI/CD instructions for how to set up a pipeline to Azure DevOps.

About

Example of implementing a simple Lanzing Zone with Terraform following the Cloud Adoption Framework.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published