Terraform - Infrastructure as Code
How to Run Terraform from CircleCI?
Anton Putra
March 14, 2021
1 min

  • Create GitHub infra-2 private repository

  • Create the project folder infra-2 locally and initialize a new repository

  • Create main.tf file
  • Create .gitignore in case you would like to run terraform locally
  • Create S3 bucket devopsbyexample-tf-state to store Terraform state

  • Create TerraformEC2RunAccess IAM Policy

  • Create TerraformS3Access IAM Policy
  • Create IAM Group Terraform and attach these two policies

  • Create terraform IAM user and place it in Terraform group. Also, download credentials.

  • Create .circleci/config.yml to configure CircleCI project

  • Commit and push to the master

  • Configure CircleCI project.

  • Create terraform context in CircleCI with following environment variables

  • Mark Only build pull requests under Advanced settings

  • Add terraform for ec2 for 18.04

  • Update to Ubuntu 20.04



Anton Putra

DevOps Engineer

Big Data | DevOps engineer with hands-on experience in building large, scalable batch and real-time applications with Apache Spark, Hive, Flink on top of Kubernetes; designing and developing CI/CD pipelines.



Social Media


Related Posts

Terraform Tutorial
Terraform Tutorial for Beginners
January 03, 2021
1 min
© 2021, All Rights Reserved.

Quick Links

About UsContact Us

Social Media