Skip to content
This repository was archived by the owner on May 6, 2020. It is now read-only.

Commit 2608642

Browse files
authored
Documentation updates (#112)
* Updating README * Updating README
1 parent 0faa5b7 commit 2608642

File tree

2 files changed

+26
-22
lines changed

2 files changed

+26
-22
lines changed

README.md

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
# Terraform GitHub Actions
22

3-
Terraform GitHub Actions allow you to run Terraform commands within GitHub Actions.
3+
Terraform GitHub Actions allow you to execute Terraform commands within GitHub Actions.
44

55
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.
66

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+
79
## Success Criteria
810

911
An exit code of `0` is considered a successful execution.
1012

1113
## Usage
1214

13-
The most common use case is to run `terraform fmt`, `terraform init`, `terraform validate`, and `terraform plan` on a pull request. A comment will be posted to the pull request depending on the output of the Terraform command being executed.
15+
The most common workflow is to run `terraform fmt`, `terraform init`, `terraform validate`, and `terraform plan` 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.
1416

1517
```yaml
16-
name: 'Terraform Pull Request Workflow'
18+
name: 'Terraform GitHub Actions'
1719
on:
1820
- pull_request
1921
jobs:
20-
example:
21-
name: 'Terraform Actions'
22+
terraform:
23+
name: 'Terraform'
2224
runs-on: ubuntu-latest
2325
steps:
2426
- name: 'Checkout'
@@ -61,36 +63,38 @@ jobs:
6163
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6264
```
6365
64-
This was a simplified example showing the basic features of these Terraform GitHub Actions. Please refer to the examples within the `examples` directory for more examples of common workflows.
66+
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.
6567

6668
## Inputs
6769

68-
| Name | Required | Default | Description |
69-
|--------------------------|----------|---------|---------------------------------------------------------------------------------------------------|
70-
| `tf_actions_version` | `true` | | Terraform version to install and execute. |
71-
| `tf_actions_subcommand` | `true` | | Terraform subcommand to execute. Valid values are `fmt`, `init`, `validate`, `plan`, and `apply`. |
72-
| `tf_actions_working_dir` | `false` | `.` | The working directory to change into before executing Terraform commands. |
73-
| `tf_actions_comment` | `false` | `true` | Whether or not to comment on pull requests. |
70+
Inputs configure Terraform GitHub Actions to perform different actions.
71+
72+
* `tf_actions_version` - (Required) The Terraform version to install and execute.
73+
* `tf_actions_subcommand` - (Required) The Terraform subcommand to execute. Valid values are `fmt`, `init`, `validate`, `plan`, and `apply`.
74+
* `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.
75+
* `tf_actions_comment` - (Optional) Whether or not to comment on GitHub pull requests. Defaults to `true`.
7476

7577
## Outputs
7678

77-
| Name | Description |
78-
|-------------------------------|------------------------------------------------------|
79-
| `tf_actions_plan_has_changes` | Whether or not the Terraform plan contained changes. |
79+
Outputs are used to pass information to subsequent GitHub Actions steps.
80+
81+
* `tf_actions_plan_has_changes` - Whether or not the Terraform plan contained changes.
8082

8183
## Secrets
8284

83-
| Name | Description |
84-
|--------------------------|----------------------------------------------------------------------------------------------------------------------|
85-
| `GITHUB_TOKEN` | The GitHub API token used to post comments to pull requests. Not required if `tf_actions_comment` is set to `false`. |
85+
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.
8686

87-
Other secrets may be needed to authenticate with Terraform backends and providers.
87+
* `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`.
8888

89-
**WARNING:** These secrets could be exposed if the action is executed on a malicious Terraform file. To avoid this, it is recommended to not use this action on public repos or repos where untrusted users can submit pull requests.
89+
Other secrets may be needed to authenticate with Terraform backends and providers.
90+
91+
**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.
9092

9193
## Environment Variables
9294

93-
The usual [Terraform environment variables](https://www.terraform.io/docs/commands/environment-variables.html) are supported. Here are the environment variables that might be the most beneficial.
95+
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.
96+
97+
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.
9498

9599
* [`TF_LOG`](https://www.terraform.io/docs/commands/environment-variables.html#tf_log)
96100
* [`TF_VAR_name`](https://www.terraform.io/docs/commands/environment-variables.html#tf_var_name)

src/terraform_validate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
function terraformValidate {
4-
# Gather the ouput of `terraform validate`.
4+
# Gather the output of `terraform validate`.
55
echo "validate: info: validating Terraform configuration in ${tfWorkingDir}"
66
validateOutput=$(terraform validate ${*} 2>&1)
77
validateExitCode=${?}

0 commit comments

Comments
 (0)