Copy and paste the below into the Azure Cloud Shell.
wget https://raw.githubusercontent.com/JimPaine/azure-terraform-bootstrapper/master/bootsrapper/main.tf -O main.tf \
  && terraform init \
  && terraform apply -var="resource_group_name=terraform" -var="resource_group_location=westeurope" -auto-approveAimed at accelerating the implementation of Terraform on Azure, this bootstrapper will;
- Create a storage account for the remote state management
- Create a Service Principal for terraform to use for CI / CD
- Give the Service Principal owner access to the subscription so it can manage resources
- Create a key vault
- Add all the details about the service principal and the storage account as secrets in the key vault.
Now your environment is ready to run terraform on Azure lets use the included template to test it out.
Go to https://dev.azure.com and create an account if you haven't already.
So we can use all the details created by the bootstrapper in a secure way, lets create a new variable group based on the key vault it created.
- Navigate to Library
- Create a new group
- Ensure to call it Terraformas this is what the pipeline will look for! - Then selectLink secrets from an Azure Key Vault as variables
- Select the subscription and click Authorize
- Select the Key Vault and Authorize
- Select all secrets
- Save
- Create a new repo and import this repo https://github.com/JimPaine/azure-terraform-bootstrapper.git
- Create a new Pipeline
- Select the repo you imported above
- It will automatically load the azure-pipelines.ymlfile
- Click Run
Now you are all done :) and ready for more terraforming!