Skip to main content

GitHub Action: terraform-auto-context

This is a Github Action that will automatically update the context.tf file in the calling repo against the most recent version published by Cloud Posse. If a new version is detected, a Pull Request will be opened to update it. If the repo version is found to be out of date, a pull request is opened to update it.

Usage

Copy this repository's .github/workflows/auto-context.yml file into the .github/workflows folder of the repository to which you'd like to add Terraform Auto-context functionality. This will cause Auto-context functionality to execute daily at the time specified by the cron option (all times are UTC).

If you'd like to modify the schedule of the Auto-context action, you can follow the standard cron syntax, as detailed below:

schedule:
# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

# Update README.md nightly at 4am UTC
- cron: '0 4 * * *'

The default username and email address attached to the commits generated by the Auto-context action are cloudpossebot and [email protected]. If you would like to change these defaults, please set the bot-name and bot-email inputs in the workflow file:

with:
bot-name: github-action-terraform-auto-context
bot-email: [email]

Quick Start

Here's how to get started...

  1. Copy this repository's .github/workflows/auto-context.yml file into the .github/workflows folder of the repository to which you'd like to add Terraform Auto-context functionality.
  2. (Optional) Update the main pin inside auto-context.yml to a fixed version. Consult https://github.com/cloudposse/github-action-auto-context/releases for a list of available versions.

Examples

Here are some real world examples: