This is a demo Terraform repository to set up AWS CodePipeline to test Terraform projects using tflint, Checkov, OPA, Terrascan, and Terratest.
Thanks to @andreivmaksimov for the idea! Additional information can be found in the How to use CodePipeline CICD pipeline to test Terraform article.
- All configs is set to AWS region "us-east-1"
- The repo used as a source code is Github, connected with codepipeline via "CodeStarSourceConnection" (here you have to change pending status to avalaible on console)
This step is required to set up an infrastructure to store Terraform remote state files
cd 0_remote_state
terraform init
terraform plan
terraform apply -auto-approve
This step is required to set up an AWS CodePipeline to test Terraform projects using tflint, Checkov, OPA, Terrascan, and Terratest.
cd 1_pipeline
terraform init
terraform plan
terraform apply -auto-approve
Every code commit will trigger the pipeline and made all checks before deploy. You can make some changes in the terraform code to check the behavior in every steps Enjoy! Happy learning