- Lab
- A Cloud Guru
Provide Continuous Delivery with GitHub and Terraform Cloud for Azure
In this hands-on lab, you'll create a Git repository for Terraform for your Terraform infrastructure and configure continuous delivery (CD) using GitHub Actions and Terraform Cloud.
Path Info
Table of Contents
-
Challenge
Set Up Your Environment
- Set up your development environment by connecting to the Virtual Machine using remote desktop and the credentials provided.
- Within the Virtual Machine, using Microsoft Edge, log in to the Azure Portal using the credentials provided. Then log in to your GitHub account and your Terraform Cloud account.
-
Challenge
Create a GitHub Repository
Create a GitHub repository for your Terraform infrastructure.
-
Challenge
Create a Workspace in Terraform Cloud
- Go to
https://app.terraform.io/
and create a Terraform Cloud workspace. - Create four environment variables to authorize access to Azure, with the following details:
ARM_SUBSCRIPTION_ID
- Use the subscription ID from the Azure portal.ARM_CLIENT_ID
- Use the Client ID from the lab details.ARM_CLIENT_SECRET
- Marked as sensitive, use the client secret from the lab details.ARM_TENANT_ID
- Use the Azure AD Tenant ID from the Azure portal.
- Go to
-
Challenge
Configure Continuous Delivery
- Create a GitHub Actions workflow using the following YAML file.
- Create a GitHub Actions repository secret with the name
TF_API_TOKEN
and use the value of a Terraform Cloud API User Token.
-
Challenge
Configure Branch Protection Rules
Create a branch protection rule to protect the
main
branch by requiring approvals and preventing bypassing of the configured protection rules. -
Challenge
Author the Configuration
- Clone the Git repository to the virtual machine.
- Create a branch for your work.
- Use the terraform file named
main.tf
in theC:\Terraform
folder on the workstation. - Add the Terraform Cloud configuration from your Terraform Cloud workspace.
- Import the existing resource group for the hands-on-lab into your state.
- Commit your changes and publish your branch.
-
Challenge
Create and Complete a Pull Request
-
Create and complete a pull request to push your changes to the main branch.
To complete the pull request without a second reviewer, you will need to Allow bypassing branch protection rules by deselecting Do not allow bypassing the above settings in the branch protection policy.
-
-
Challenge
Review Results
- Review the results in GitHub Actions.
- Review the results in the Azure portal.
What's a lab?
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Provided environment for hands-on practice
We will provide the credentials and environment necessary for you to practice right within your browser.
Guided walkthrough
Follow along with the author’s guided walkthrough and build something new in your provided environment!
Did you know?
On average, you retain 75% more of your learning if you get time for practice.