An open API service indexing awesome lists of open source software.

https://github.com/followtheprocess/terraform-actions

Consistent, high quality, and configurable GitHub Actions for managing infrastructure with Terraform 🏗️
https://github.com/followtheprocess/terraform-actions

continuous-deployment github-actions terraform

Last synced: about 1 month ago
JSON representation

Consistent, high quality, and configurable GitHub Actions for managing infrastructure with Terraform 🏗️

Awesome Lists containing this project

README

          

# Terraform Actions

[![License](https://img.shields.io/github/license/FollowTheProcess/terraform-actions)](https://github.com/FollowTheProcess/terraform-actions)
[![GitHub](https://img.shields.io/github/v/release/FollowTheProcess/terraform-actions?logo=github&sort=semver)](https://github.com/FollowTheProcess/terraform-actions)

Consistent, high quality, and configurable GitHub Actions for managing infrastructure with Terraform 🏗️

- [Terraform Actions](#terraform-actions)
- [Plan](#plan)
- [Description](#description)
- [Inputs](#inputs)
- [Outputs](#outputs)
- [Runs](#runs)
- [Usage](#usage)
- [Apply](#apply)
- [Description](#description-1)
- [Inputs](#inputs-1)
- [Runs](#runs-1)
- [Usage](#usage-1)

## Plan

All Terraform things should start with a plan!

### Description

GitHub Actions to produce a Terraform plan

### Inputs

| name | description | required | default |
| --- | --- | --- | --- |
| `terraform-version` |

The version of Terraform to install and run

| `false` | `latest` |
| `backend-config` |

Optional path to a .tfbackend file (relative to cwd) to use for initialisation

| `false` | `""` |
| `var-file` |

Optional path to a .tfvars file (relative to cwd) to pass to terraform for the plan

| `false` | `""` |
| `plan-artifact-name` |

Explicit name for the uploaded plan artifact. When empty (the default), the name is auto-generated from cwd, github.sha, github.run_id, and github.run_attempt. Pass this when you want a deterministic, caller-controlled artifact name — typically to keep plan → apply wiring simple inside matrix jobs, where passing needs.<job>.outputs.* between matrix entries is awkward. The matching apply action already accepts plan-artifact-name as an input.

| `false` | `""` |
| `cwd` |

The working directory to be in for the duration of the action

| `false` | `.` |

### Outputs

| name | description |
| --- | --- |
| `plan-artifact-name` |

The name of the uploaded artifact, can be passed to actions/download-artifact as name

|
| `plan-artifact-id` |

The GitHub ID of the Terraform Plan artifact, can be used by the REST API

|
| `plan-download-url` |

The URL to download the produced Terraform Plan

|
| `plan-filename` |

The filename of the produced .tfplan file, can be passed to actions/download-artifact as path

|
| `run-id` |

The ID of the GitHub Actions run publishing the plan, can be used by other actions to retrieve it

|

### Runs

This action is a `composite` action.

### Usage

```yaml
- uses: FollowTheProcess/terraform-actions/plan@v1
with:
terraform-version:
# The version of Terraform to install and run
#
# Required: false
# Default: latest

backend-config:
# Optional path to a .tfbackend file (relative to `cwd`) to use for initialisation
#
# Required: false
# Default: ""

var-file:
# Optional path to a .tfvars file (relative to `cwd`) to pass to terraform for the plan
#
# Required: false
# Default: ""

plan-artifact-name:
# Explicit name for the uploaded plan artifact. When empty (the default), the name is auto-generated
# from `cwd`, `github.sha`, `github.run_id`, and `github.run_attempt`.
# Pass this when you want a deterministic, caller-controlled artifact name — typically to keep plan → apply
# wiring simple inside matrix jobs, where passing `needs..outputs.*` between matrix entries is awkward.
# The matching `apply` action already accepts `plan-artifact-name` as an input.
#
# Required: false
# Default: ""

cwd:
# The working directory to be in for the duration of the action
#
# Required: false
# Default: .
```

## Apply

### Description

GitHub Actions to apply Terraform infrastructure changes

### Inputs

| name | description | required | default |
| --- | --- | --- | --- |
| `terraform-version` |

The version of Terraform to install and run

| `false` | `latest` |
| `backend-config` |

Optional path to a .tfbackend file (relative to cwd) to use for initialisation

| `false` | `""` |
| `plan-artifact-name` |

Name of a plan artifact (produced by the plan action in an earlier job) to download and apply. This is the recommended way to chain plan → apply across jobs. Mutually exclusive with plan-filename and var-file.

| `false` | `""` |
| `plan-filename` |

Path to a previously produced terraform plan file that is already present on disk in cwd (e.g. because you downloaded the artifact yourself). For the cross-job case prefer plan-artifact-name. Mutually exclusive with plan-artifact-name and var-file.

| `false` | `""` |
| `var-file` |

The path to a .tfvars file to use for the apply. Mutually exclusive with plan-artifact-name and plan-filename.

| `false` | `""` |
| `cwd` |

The working directory to be in for the duration of the action

| `false` | `.` |

### Runs

This action is a `composite` action.

### Usage

```yaml
- uses: FollowTheProcess/terraform-actions/apply@v1
with:
terraform-version:
# The version of Terraform to install and run
#
# Required: false
# Default: latest

backend-config:
# Optional path to a .tfbackend file (relative to `cwd`) to use for initialisation
#
# Required: false
# Default: ""

plan-artifact-name:
# Name of a plan artifact (produced by the `plan` action in an earlier job) to download and apply.
# This is the recommended way to chain plan → apply across jobs.
# Mutually exclusive with `plan-filename` and `var-file`.
#
# Required: false
# Default: ""

plan-filename:
# Path to a previously produced terraform plan file that is already present on disk in `cwd`
# (e.g. because you downloaded the artifact yourself). For the cross-job case prefer `plan-artifact-name`.
# Mutually exclusive with `plan-artifact-name` and `var-file`.
#
# Required: false
# Default: ""

var-file:
# The path to a .tfvars file to use for the apply. Mutually exclusive with `plan-artifact-name` and `plan-filename`.
#
# Required: false
# Default: ""

cwd:
# The working directory to be in for the duration of the action
#
# Required: false
# Default: .
```