fabricesemti80 / terraform-aws-github-action-bootstrap

A setup for Terraform using AWS on Github Actions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Terraform Github Actions Bootstrap

Allows you to bootstrap a Terraform project on AWS using Github Actions. The purpose of the project is to make a simple sandbox for experimenting with Terraform resources using a CI pipeline.

For the companion article, check out: https://www.thedevcoach.co.uk/setup-terraform-aws-github-actions/

Setup Steps

Pre-requisites:

  • A setup AWS account
  • Git installed on your machine

Step 1: Create the backend bucket

  1. Clone the repo git@github.com:loujaybee/terraform-aws-github-action-bootstrap.git
  2. Install the Terraform binary
  3. Set your bash variables locally
    • export AWS_ACCESS_KEY_ID=[your-key]
    • export AWS_SECRET_ACCESS_KEY=[your-key]
  4. terraform init to initialise Terraform
  5. Update the main.tf file and set bucket property of the backend and s3 resource blocks (yes, even the one that's commented out, we'll need it as part of step 8)
  6. Execute terraform apply (type yes)

Step 2: Run Terrafrom on Github Actions

  1. Uncomment the backend configuration in main.tf
  2. Execute terraform init (type yes to move your state)
  3. Set your AWS AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY as repo secrets @ github.com/[your-username]/[your-repo]/settings/secrets/new
  4. git add . and git commit -m "First commit" to commit any changes
  5. git push to push to github

Having Problems?

Raise an issue

How to set up Cloud9 ide

Host fabricesemti80-c9-ide
 HostName ec2-35-172-136-186.compute-1.amazonaws.com
 IdentityFile C:\Users\emilf\.ssh\id_ed25519
 User ubuntu

About

A setup for Terraform using AWS on Github Actions


Languages

Language:HCL 100.0%