This project creates an EC2 instance and S3 bucket both having Name=Flugel, Owner=Infrateam
tag. Terratest was used to test if the resources are properly tagged. Github Actions was used to validate, plan and test the terraform code when a pull request is created, and deploy the infrastructure when the pull request is merged
- GoLang installed on your machine
- TerraformCLI installed on your machine
- AWS Credentials are properly configured in your Local Machine (Install AWSCLI and running
aws configure
to set up AWS Credentials)
I used Terraform Cloud Workspaces to store the Terraform state files, to run the automation test, you either need to create your own terraform cloud organization and workspace and subtitute in staging/provider.tf
production/provider.tf
where necessary. or delete the backend configuration block in staging/provider.tf
production/provider.tf
e.g following block
backend "remote" {
# The name of your Terraform Cloud organization.
organization = "flugel-infra"
# # The name of the Terraform Cloud workspace to store Terraform state files in.
workspaces {
name = "flugel"
}
}
Deleting above will allow terraform use your Local Machine to execute terraform commands and store its states.
- Clone the repo
- In your terminal, run
go mod init flugel
(flugel can be any name) - Next, run
go mod tidy -go=1.16 && go mod tidy -go=1.17
- Next, run
go test -v
Check the logs for the test results