Automating Terraform With Github Actions

My Workflow

A project to demonstrate how to automate terraform workflow with Github Actions.

Login to your AWS account and generate AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
After that, login to your Terraform Cloud account. Create a ne…


This content originally appeared on DEV Community and was authored by Mariam Adedeji

My Workflow

A project to demonstrate how to automate terraform workflow with Github Actions.

  • Login to your AWS account and generate AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.
  • After that, login to your Terraform Cloud account. Create a new workspace and select API-driven workflow.
  • Then navigate to the Variables tab and click on Add variable. Add AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with their respective values.
  • From your Terraform Cloud User Settings, click on Tokens and generate an API token named GitHub Actions.
  • Add the token to your Github repository as a secret. Name the secret TF_API_TOKEN.

  • Clone and open your Github repo on your code editor.

  • Checkout to a new branch with git checkout -b <branch-name>.

  • Add your changes with git add . and commit the changes with a message using git commit -m "<commit-message>".

  • Then push your changes with git push.

  • Go back to the Github repository and generate a pull request from the new branch. You can view the status of the job through the pull request created, Actions tab or the Terraform Cloud workspace.

  • Then merge the pull request.

Submission Category:

DIY Deployments

Yaml File or Link to Code

Terraform Automation

A project to demonstrate how to automate terraform workflow with Github Actions.

  • Github Actions after creating a pull request image

  • Github Actions after Merging to main branch image

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development purpose.

Prerequisites

To get started with this project you need a basic knowledge of the following.

Version Control (Git)
Terraform
AWS

Automating Terraform with Github Actions

  • Login to your AWS account and generate AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY.

  • After that, login to your Terraform Cloud account. Create a new workspace and select API-driven workflow.

  • Then navigate to the Variables tab and click on Add variable. Add AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY with their respective values.

  • From your Terraform Cloud User Settings, click on Tokens and generate an API token named GitHub Actions.

  • Add the token to your Github repository as a…


This content originally appeared on DEV Community and was authored by Mariam Adedeji


Print Share Comment Cite Upload Translate Updates
APA

Mariam Adedeji | Sciencx (2021-12-03T18:35:36+00:00) Automating Terraform With Github Actions. Retrieved from https://www.scien.cx/2021/12/03/automating-terraform-with-github-actions/

MLA
" » Automating Terraform With Github Actions." Mariam Adedeji | Sciencx - Friday December 3, 2021, https://www.scien.cx/2021/12/03/automating-terraform-with-github-actions/
HARVARD
Mariam Adedeji | Sciencx Friday December 3, 2021 » Automating Terraform With Github Actions., viewed ,<https://www.scien.cx/2021/12/03/automating-terraform-with-github-actions/>
VANCOUVER
Mariam Adedeji | Sciencx - » Automating Terraform With Github Actions. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/12/03/automating-terraform-with-github-actions/
CHICAGO
" » Automating Terraform With Github Actions." Mariam Adedeji | Sciencx - Accessed . https://www.scien.cx/2021/12/03/automating-terraform-with-github-actions/
IEEE
" » Automating Terraform With Github Actions." Mariam Adedeji | Sciencx [Online]. Available: https://www.scien.cx/2021/12/03/automating-terraform-with-github-actions/. [Accessed: ]
rf:citation
» Automating Terraform With Github Actions | Mariam Adedeji | Sciencx | https://www.scien.cx/2021/12/03/automating-terraform-with-github-actions/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.