Skip to content

Commit ae0d973

Browse files
authored
README update (hashicorp#174)
1 parent 9ed5049 commit ae0d973

File tree

1 file changed

+3
-112
lines changed

1 file changed

+3
-112
lines changed

README.md

Lines changed: 3 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,5 @@
1-
# Terraform GitHub Actions
1+
# hashicorp/terraform-github-actions
22

3-
Terraform GitHub Actions allow you to execute Terraform commands within GitHub Actions.
3+
This `hashicorp/terraform-github-actions` repository is no longer actively developed or maintained. It has been superseded by the [hashicorp/setup-terraform](https://github.com/hashicorp/setup-terraform) GitHub action.
44

5-
The output of the actions can be viewed from the Actions tab in the main repository view. If the actions are executed on a pull request event, a comment may be posted on the pull request.
6-
7-
Terraform GitHub Actions are a single GitHub Action that executes different Terraform subcommands depending on the content of the GitHub Actions YAML file.
8-
9-
## Success Criteria
10-
11-
An exit code of `0` is considered a successful execution.
12-
13-
## Usage
14-
15-
The most common workflow is to run `terraform fmt`, `terraform init`, `terraform validate`, `terraform plan`, and `terraform taint` on all of the Terraform files in the root of the repository when a pull request is opened or updated. A comment will be posted to the pull request depending on the output of the Terraform subcommand being executed. This workflow can be configured by adding the following content to the GitHub Actions workflow YAML file.
16-
17-
```yaml
18-
name: 'Terraform GitHub Actions'
19-
on:
20-
- pull_request
21-
env:
22-
tf_version: 'latest'
23-
tf_working_dir: '.'
24-
jobs:
25-
terraform:
26-
name: 'Terraform'
27-
runs-on: ubuntu-latest
28-
steps:
29-
- name: 'Checkout'
30-
uses: actions/checkout@master
31-
- name: 'Terraform Format'
32-
uses: hashicorp/terraform-github-actions@master
33-
with:
34-
tf_actions_version: ${{ env.tf_version }}
35-
tf_actions_subcommand: 'fmt'
36-
tf_actions_working_dir: ${{ env.tf_working_dir }}
37-
tf_actions_comment: true
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
- name: 'Terraform Init'
41-
uses: hashicorp/terraform-github-actions@master
42-
with:
43-
tf_actions_version: ${{ env.tf_version }}
44-
tf_actions_subcommand: 'init'
45-
tf_actions_working_dir: ${{ env.tf_working_dir }}
46-
tf_actions_comment: true
47-
env:
48-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49-
- name: 'Terraform Validate'
50-
uses: hashicorp/terraform-github-actions@master
51-
with:
52-
tf_actions_version: ${{ env.tf_version }}
53-
tf_actions_subcommand: 'validate'
54-
tf_actions_working_dir: ${{ env.tf_working_dir }}
55-
tf_actions_comment: true
56-
env:
57-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58-
- name: 'Terraform Plan'
59-
uses: hashicorp/terraform-github-actions@master
60-
with:
61-
tf_actions_version: ${{ env.tf_version }}
62-
tf_actions_subcommand: 'plan'
63-
tf_actions_working_dir: ${{ env.tf_working_dir }}
64-
tf_actions_comment: true
65-
env:
66-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67-
```
68-
69-
This was a simplified example showing the basic features of these Terraform GitHub Actions. Please refer to the examples within the `examples` directory for other common workflows.
70-
71-
## Inputs
72-
73-
Inputs configure Terraform GitHub Actions to perform different actions.
74-
75-
* `tf_actions_subcommand` - (Required) The Terraform subcommand to execute. Valid values are `fmt`, `init`, `validate`, `plan`, and `apply`.
76-
* `tf_actions_version` - (Required) The Terraform version to install and execute. If set to `latest`, the latest stable version will be used.
77-
* `tf_actions_cli_credentials_hostname` - (Optional) Hostname for the CLI credentials file. Defaults to `app.terraform.io`.
78-
* `tf_actions_cli_credentials_token` - (Optional) Token for the CLI credentials file.
79-
* `tf_actions_comment` - (Optional) Whether or not to comment on GitHub pull requests. Defaults to `true`.
80-
* `tf_actions_working_dir` - (Optional) The working directory to change into before executing Terraform subcommands. Defaults to `.` which means use the root of the GitHub repository.
81-
* `tf_actions_fmt_write` - (Optional) Whether or not to write `fmt` changes to source files. Defaults to `false`.
82-
83-
## Outputs
84-
85-
Outputs are used to pass information to subsequent GitHub Actions steps.
86-
87-
* `tf_actions_output` - The Terraform outputs in (stringified) JSON format.
88-
* `tf_actions_plan_has_changes` - `'true'` if the Terraform plan contained changes, otherwise `'false'`.
89-
* `tf_actions_plan_output` - The Terraform plan output.
90-
* `tf_actions_fmt_written` - Whether or not the Terraform formatting from `fmt` was written to source files.
91-
92-
## Secrets
93-
94-
Secrets are similar to inputs except that they are encrypted and only used by GitHub Actions. It's a convenient way to keep sensitive data out of the GitHub Actions workflow YAML file.
95-
96-
* `GITHUB_TOKEN` - (Optional) The GitHub API token used to post comments to pull requests. Not required if the `tf_actions_comment` input is set to `false`.
97-
98-
Other secrets may be needed to authenticate with Terraform backends and providers.
99-
100-
**WARNING:** These secrets could be exposed if the action is executed on a malicious Terraform file. To avoid this, it is recommended not to use these Terraform GitHub Actions on repositories where untrusted users can submit pull requests.
101-
102-
## Environment Variables
103-
104-
Environment variables are exported in the environment where the Terraform GitHub Actions are executed. This allows a user to modify the behavior of certain GitHub Actions.
105-
106-
The usual [Terraform environment variables](https://www.terraform.io/docs/commands/environment-variables.html) are supported. Here are a few of the more commonly used environment variables.
107-
108-
* [`TF_LOG`](https://www.terraform.io/docs/commands/environment-variables.html#tf_log)
109-
* [`TF_VAR_name`](https://www.terraform.io/docs/commands/environment-variables.html#tf_var_name)
110-
* [`TF_CLI_ARGS`](https://www.terraform.io/docs/commands/environment-variables.html#tf_cli_args-and-tf_cli_args_name)
111-
* [`TF_CLI_ARGS_name`](https://www.terraform.io/docs/commands/environment-variables.html#tf_cli_args-and-tf_cli_args_name)
112-
* `TF_WORKSPACE`
113-
114-
Other environment variables may be configured to pass data into Terraform. If the data is sensitive, consider using [secrets](#secrets) instead.
5+
Thank you to all of the users and contributors that made this repository possible. Hope to see you using the new `hashicorp/setup-terraform` GitHub action!

0 commit comments

Comments
 (0)