Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/harrisoncramer/terraform-and-gh-actions
Simple repository showing how you can combine Terraform Cloud with Github Actions to automate your IAC.
https://github.com/harrisoncramer/terraform-and-gh-actions
github-actions infrastructure-as-code terraform
Last synced: 19 days ago
JSON representation
Simple repository showing how you can combine Terraform Cloud with Github Actions to automate your IAC.
- Host: GitHub
- URL: https://github.com/harrisoncramer/terraform-and-gh-actions
- Owner: harrisoncramer
- Created: 2021-10-20T16:06:41.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-10-20T17:55:58.000Z (over 3 years ago)
- Last Synced: 2025-01-11T04:43:23.938Z (24 days ago)
- Topics: github-actions, infrastructure-as-code, terraform
- Language: HCL
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Terraform & Github Actions 🏗️
This repository is a reference for using Terraform Cloud and Github Actions.
## Github Actions
The Github Actions in this project are configured to validate, plan, and deploy the infrastructure contained in the terraform files. The actions need to connect to the Terraform Cloud, and therefore the only required environment variable for this repository is the `TF_API_TOKEN` that Terraform Cloud provides.
This token can be generated on Terraform Cloud.
The actions are configured to validate and plan all infrastructure whenever a pull request is opened to the main branch.
The infrastructure will only be applied when the pull request is actually merged into main.
The output of these actions are automatically added as a comment to the pull request, allowing users to see the results of their commits in Github, without having to open Terraform Cloud's dashboard.
## Terraform Code
This Terraform code uses Amazon's provider to create an EC2 instance in the default VPC. In order for Terraform Cloud to validate with AWS, you must provide the appropriate variables to the TF Cloud workspace. Those variables are `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY` and can be generated in the AWS Console.