- Subscription ID variable needs to be set with your ID in the *.tfvars file located in the root folder (./simonhou-oppg2/).
- Variables can be changed in the terraform.tfvars file located in the root folder (./simonhou-oppg2/).
Needed to run locally:
- Deploy from your terminal of choice and make sure to be placed in the root directory (./simonhou-oppg2/).
terraform -chdir=global init
terraform -chdir=global plan -out="backend.tfplan"
terraform -chdir=global apply "backend.tfplan"
terraform -chdir=deployments init
terraform -chdir=deployments plan -out="main.tfplan"
terraform -chdir=deployments apply "main.tfplan"
This Terraform project consists of the following child modules:
Creates Azure Service Plan for hosting the web application and a Linux Web App
Stores product and user data
Creates Virtual Network, Subnet, Network Security Group and Load Balancer:
- The Network Security Group allows inbound access to port 443 (HTTPS)
Azure Storage Account and container for product images.
The backend needs to be deployed before the main infrastructure. It stores all tfstate files.
One for each environment (the apply job will use environment rules so adding a review requirement in GitHub is possible):
- Development (dev.yml) used for the dev branch
- Staging (stage.yml) used for the stage branch
- Production (prod.yml) used for the main branch
Destroy Infrastructure (destroy.yml)
- Only able to run manually through GitHub
All the workflows use GitHub environment secrets for storing Azure credentials:
- ARM_CLIENT_ID needs to be set as the Azure app ID
- ARM_CLIENT_SECRET as the Azure password
- ARM_TENANT_ID as the Azure tenant ID
- ARM_SUBSCRIPTION_ID as the Azure subscription ID