Code for the blog: How to set up CI/CD for data infrastructure
We need to create our state S3 backend and ODIC (for GitHub Actions to deploy to AWS). We have them defined at ./terraform/bootstrap/main.tf.
Apply them as shown below
terraform -chdir=terraform/bootstrap init
terraform -chdir=terraform/bootstrap apply
terraform -chdir=terraform/bootstrap output
# you will see your S3 backend and AWS ARNCreate a repo secret and call it AWS_ROLE_ARN. The value must be the output from the bootstrap output command in the bootstrap section.
Note
When copy-pasting the ARN, do not copy the quotes.
We use GitHub environment to force manual review. Create this by going to settings -> environment in this repo.
Add a review rule requiring atleast one manual review.
Our CI process checks .tf file formats, but does not fix it. Make sure to run the below command before you push your changes to your PR/branch.
terraform -chdir=terraform fmt -recursive
After you are done, do not forget to destroy all the resources. We have a handy script to do that for you.
./tear-down.sh


