Beginner’s guide to AWS CI/CD, using Terraform Cloud and GitHub.

Image for post
Image for post

Hello World!

Below are the steps that one should follow in order to setup a CI/CD pipeline with Terraform Cloud, AWS and GitHub.

First step is to configure AWS by creating a new user, we are going to complete this task in the AWS console.

Under IAM — Click on users and click on “Add User” enter a username and add a permission to the user.

Image for post
Image for post

After adding the permission, download the .csv file that contains the Access Key ID and the Secret Key ID and store it in a safe place.

Now login to your GitHub account and create a repository.

Upload the Terraform code that you’ve written to provision your AWS resources. If you do not have one check out my previous post here.

Now its time to login to your Terraform Cloud account or click here and create one if you do not have an account. I will suggest that you sign in using your GitHub account.

Image for post
Image for post

Terraform cloud makes it easy for users to collaborate on Terraform configurations through versioned and shared Terraform state files.

Now that we got an idea what Terraform Cloud is, it’s time to link our GitHub account to Terraform Cloud to establish a CI/CD Pipeline.

In GitHub create a new repository and push your Terraform code to it.

Image for post
Image for post

Now that all your files are uploaded, it’s now time to create a new Organization inside Terraform Cloud.

Click on New workspace.

Image for post
Image for post

Click on GitHub

Image for post
Image for post

Select the repository that has your Terraform code.

Image for post
Image for post

Now click on Create workspace.

You should now see the message below, stating that the configuration has been uploaded.

Image for post
Image for post

Now it’s time to configure the variables.

Under Environment Variables add your Access Keys, Secret Keys and your default region. Remember that you must never include that information in your code.

Now its now the time to run the Terraform code by clicking Queue plan

Image for post
Image for post

Now everything looks like its running just fine

Image for post
Image for post

After everything ran perfectly, this is what I see on my dashboard.

Image for post
Image for post

Congratulations!!!!!!!!!! You’ve implemented your first GitHub CI/CD pipeline for AWS using Terraform Cloud.

Written by

AWS Certified Cloud Practitioner | UMBC Alum

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store