GitHub Actions
GitHub Actions are a powerful way to automate your workflows with Atmos. Use these actions to plan, apply, and manage your Terraform infrastructure with Atmos.
This collection of GitHub Actions is designed to work specifically with Atmos in an opinionated manner, enabling you to implement a modern change management system entirely within the native GitHub UI. These Actions use the standard atmos.yaml
configuration and some backing services designed to properly manage Terraform plan files, including their invalidation.
These GitHub Actions strive to be cloud-agnostic; however, most of our instructions focus on AWS, where we predominantly use them. None of these actions require hardcoded credentials, and all work using GitHub OIDC and GitHub Apps managed by your organization. These Actions do not require any subscriptions and are based entirely on open source.
GitHub Actions for Atmos
📄️ Setup Atmos
Install Atmos in your GitHub Action workflows
📄️ Component Updater
Easily update your vendored components with Pull Requests
📄️ Affected Stacks
Identify the affected stacks and components in a pull request
📄️ Terraform Plan
Run a `terraform plan` to understand the impact of changes
📄️ Terraform Apply
Run a `terraform apply` to provision changes
📄️ Terraform Drift Detection
Identify drift and create GitHub Issues for remediation
📄️ Terraform Drift Remediation
Remediate Terraform drift using IssueOps
Requirements
GitHub Actions that utilize "plan file" storage depends on a few resources:
- S3 bucket for storing planfiles
- DynamoDB table for retrieving metadata about planfiles
- 2x IAM roles for "planning" and accessing the "state" bucket
atmos.yaml
config with GitOps settings
S3 Bucket
This action can use any S3 Bucket to keep track of your planfiles. Just ensure the bucket is properly locked down since planfiles may contain secrets.
For example, vendor in the s3-component
, then using an Atmos stack configuration, define a bucket using the s3-bucket
component with this catalog configuration:
stacks/catalog/s3-bucket/gitops.yaml
Assign this S3 Bucket ARN to the terraform-plan-bucket
input.
DynamoDB Table
Similarly, a simple DynamoDB table can be provisioned using our dynamodb
component. Set the Hash Key and create a Global Secondary Index as follows:
stacks/catalog/dynamodb/gitops.yaml
Pass the ARN of this table as the input to the terraform-plan-table
of the cloudposse/github-action-atmos-terraform-plan
GitHub Action.
IAM Access Roles
First create an access role for storing and retrieving planfiles from the S3 Bucket and DynamoDB table. We deploy this role using the gitops
component. Assign this role ARN to the terraform-state-role
input.
Next, create a role for GitHub workflows to use to plan and apply Terraform. We typically create an "AWS Team" with our aws-teams
component, and then allow this team to assume terraform
in the delegated accounts with our aws-team-roles
component. Assign this role ARN to the terraform-plan-role
input
Atmos Configuration
The actions that works with atmos >= 1.63.0
expects the Atmos configuration file atmos.yaml
to be present in the repository.
The config should have the following structure:
rootfs/usr/local/etc/atmos/atmos.yaml
For actions that use atmos < 1.63.0
the settings passed as github action inputs.
Please follow documentation for each action to see the required inputs.
Compatibility Matrix
Our GitHub Actions depend on specific versions of Atmos.
Artifacts Upgrade
With version v2
of
cloudposse/github-action-atmos-terraform-drift-detection
and version v3
of
cloudposse/github-action-atmos-terraform-plan, the
artifact storage configuration was updated to use the same structure. Both will need to be updated to these versions or
later to pass artifacts across the actions.
Please see the release notes:
- https://github.com/cloudposse/github-action-atmos-terraform-plan/releases/tag/v3.0.0
- https://github.com/cloudposse/github-action-atmos-terraform-drift-detection/releases/tag/v2.0.0
Atmos < 1.63.0
If you are using Atmos < 1.63.0
, please refer to the following table:
Github action | Atmos < 1.63.0 | Atmos >= 1.63.0 |
---|---|---|
github-action-atmos-affected-stacks | v2 | v1 or greater |
github-action-atmos-terraform-plan | v1 | v2 or greater |
github-action-atmos-terraform-apply | v1 | v2 or greater |
github-action-atmos-terraform-drift-remediation | v1 | v2 or greater |
github-action-atmos-terraform-drift-detection | v0 | v1 or greater |