Effortless Azure Terraforming with GitHub AT-AT v1.0.7: A Step-by-Step Setup Guide
In this quick and concise walkthrough, we’ll guide you through setting up GitHub AT-AT v1.0.7, from configuring your backends to deploying your first application environment on Azure. By the end, you’ll have a fully functional setup with dual backends for both Non-PROD and PROD environments, seamlessly integrated with GitHub repositories and Terraform.
1. Setup your Backends
Setup an “azurerm” provider for your Non-PROD and PROD environments:
# LAME
provider "azurerm" {
subscription_id = var.azure_nonprod_subscription
features {}
}
# DEV Subscription
provider "azurerm" {
alias = "nonprod"
subscription_id = var.azure_nonprod_subscription
features {}
}
# PROD Subscription
provider "azurerm" {
alias = "prod"
subscription_id = var.azure_prod_subscription
features {}
}
Setup the Backend Module
module "backend" {
source = "Azure-Terraformer/atat/github//modules/azure-dual-backend-core"
version = "1.0.7"
providers = {
azurerm.nonprod = azurerm.nonprod
azurerm.prod = azurerm.prod
}
name = var.name
location = var.location
}
Setup your First Application Environment
Make sure to setup the GitHub provider with your organization. The GitHub AT-AT uses GitHub Environments which is only available in GitHub Team and Enterprise. Don’t worry, GitHub Teams is only $4/month. Well worth it!
# Configure the GitHub Provider
provider "github" {
owner = var.github_organization
}
Setup the App Module:
module "app" {
source = "Azure-Terraformer/atat/github//modules/azure-dual-backend-app"
version = "1.0.7"
application_name = var.application_name
github_organization = var.github_organization
repository_name = var.github_repository_name
repository_description = var.github_repository_description
repository_visibility = var.github_repository_visibility
terraform_version = var.terraform_version
commit_user = {
name = var.github_username
email = var.github_email
}
environments = {
dev = {
subscription_id = var.azure_nonprod_subscription
branch_name = "develop"
backend = module.backend.nonprod
}
test = {
subscription_id = var.azure_nonprod_subscription
branch_name = "release"
backend = module.backend.nonprod
}
prod = {
subscription_id = var.azure_prod_subscription
branch_name = "main"
backend = module.backend.prod
}
}
}
Here is a sample TFVAR file you can use:
location = "westus3"
azure_nonprod_subscription = "00000000-0000-0000-0000-000000000000"
azure_prod_subscription = "00000000-0000-0000-0000-000000000000"
application_name = "contoso-foo"
github_organization = "contoso"
github_username = "YOUR NAME GOES HERE"
github_email = "you@contoso.com"
github_repository_name = "contoso-svc-foo"
github_repository_description = "Contoso Foo Service"
github_repository_visibility = "private"
terraform_version = "1.9.8"
That’s it!!!
With the necessary providers and modules configured, setting up your backends for both Non-PROD and PROD environments becomes straightforward. Once you configure the GitHub provider and set up your first application environment, you’ll be ready to deploy and manage your application. The provided TFVAR file will ensure the correct values are set, simplifying the process. With everything in place, you’re all set to begin your journey!
Happy Azure Terraforming!!!