Skip to content
This repository has been archived by the owner on Jul 5, 2023. It is now read-only.

Commit

Permalink
Fixing broken links
Browse files Browse the repository at this point in the history
  • Loading branch information
sudomateo committed Nov 9, 2019
1 parent 529151a commit aaad3ae
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 48 deletions.
2 changes: 1 addition & 1 deletion content/scripts/testdata/incoming-links.txt
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@
/docs/extend/testing/acceptance-tests/testcase.html
/docs/extend/testing/index.html
/docs/extend/writing-custom-providers.html
/docs/github-actions/getting-started/index.html
/docs/github-actions/getting-started.html
/docs/github-actions/index.html
/docs/import/importability.html
/docs/import/index.html
Expand Down
64 changes: 64 additions & 0 deletions content/source/docs/github-actions/workflows/arguments.html.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
---
layout: "github-actions"
page_title: "Arguments- Terraform GitHub Actions"
sidebar_current: "docs-github-actions-workflows-arguments"
---

# Arguments

Arguments can be passed to each subcommand in two ways.

## Using Arguments

GitHub Actions supports an `args` attribute that will pass arguments to the Terraform subcommand. Using this `args` attribute will place the arguments at the end of the entire `terraform` command, even after all of the arguments defined in the source code. In this example, the argument `-var="env=dev"` will be appended to the `terraform init` command.

```yaml
name: 'Terraform GitHub Actions'
on:
- pull_request
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
- name: 'Terraform Init'
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: 'init'
tf_actions_working_dir: '.'
tf_actions_comment: true
args: '-var="env=dev"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
## Using Environment Variables
Terraform supports environment variables named `TF_CLI_ARGS` and `TF_CLI_ARG_name` where `name` is the subcommand that is being executed. Using these environment variables will place the arguments after the subcommand but before any arguments defined in the source code. In this example, the argument `-var="env=dev"` will be appended to the `terraform init` command.

```yaml
name: 'Terraform GitHub Actions'
on:
- pull_request
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
- name: 'Terraform Init'
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: 'init'
tf_actions_working_dir: '.'
tf_actions_comment: true
env:
TF_CLI_ARGS_init: '-var="env=dev"'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
31 changes: 3 additions & 28 deletions content/source/docs/github-actions/workflows/backends.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ sidebar_current: "docs-github-actions-workflows-backends"

# Terraform Backends

Terraform GitHub Actions supports initializing a `backend` block using the `TF_CLI_ARGS_init` environment variable.
Terraform GitHub Actions supports initializing a `backend` block using the `-backend-config` option.

The example below shows how to pass the `token` and `organization` arguments to the `remote` backend block.
The example below shows how to pass the `token` and `organization` arguments to the `remote` backend block. The `token` argument is passed using GitHub Actions secrets while the organization is hardcoded.

```yaml
name: 'Terraform GitHub Actions'
Expand All @@ -28,32 +28,7 @@ jobs:
tf_actions_subcommand: 'init'
tf_actions_working_dir: '.'
tf_actions_comment: true
args: '-backend-config="token=${{ secrets.TF_API_TOKEN }}" -backend-config="organization=CHANGE_ME"'
env:
TF_CLI_ARGS_init: '-backend-config="token=CHANGE_ME" -backend-config="organization=CHANGE_ME"'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
For sensitive values, consider using secrets instead.
```yaml
name: 'Terraform GitHub Actions'
on:
- pull_request
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
- name: 'Terraform Init'
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: 'init'
tf_actions_working_dir: '.'
tf_actions_comment: true
env:
TF_CLI_ARGS_init: '-backend-config="token=${{ secrets.TOKEN }}" -backend-config="organization=CHANGE_ME"'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
10 changes: 5 additions & 5 deletions content/source/docs/github-actions/workflows/index.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ Terraform GitHub Actions are designed to be configurable for most workflows.

See the links below for examples of common workflows.

- [fmt](./fmt.html)
- [init](./init.html)
- [validate](./validate.html)
- [plan](./plan.html)
- [apply](./apply.html)
- [Backends](./backends.html)
- [Terraform Versions](./terraform-versions.html)
- [Variables](./variables.html)
- [Working Directory](./working-directory.html)
- [Workspaces](./workspaces.html)
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
layout: "github-actions"
page_title: "Terraform Versions - Terraform GitHub Actions"
sidebar_current: "docs-github-actions-workflows-tf-versions"
sidebar_current: "docs-github-actions-workflows-terraform-versions"
---

# Terraform Versions

Specify the version of Terraform to be executed using the `tf_actions_version` input.
Specify the version of Terraform to be executed using the `tf_actions_version` input. Here, Terraform 0.12.13 is being used.

```yaml
name: 'Terraform GitHub Actions'
Expand Down
40 changes: 32 additions & 8 deletions content/source/docs/github-actions/workflows/variables.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,34 @@ sidebar_current: "docs-github-actions-workflows-variables"

Variables can be configured directly in the GitHub Actions workflow YAML a few ways.

## Using an Environment Variable
## Using Arguments

The `TF_VAR_name` environment variable can be used to define a value for a variable. When using `TF_VAR_name`,`name` is the name of the Terraform variable as declared in the Terraform files.
This example shows how to pass variables using the `-var` argument.

Here, the Terraform variable `environment` is set to the value `development`.
```yaml
name: 'Terraform GitHub Actions'
on:
- pull_request
jobs:
terraform:
name: 'Terraform'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@master
- name: 'Terraform Init'
uses: hashicorp/terraform-github-actions@master
with:
tf_actions_version: 0.12.13
tf_actions_subcommand: 'init'
tf_actions_working_dir: '.'
tf_actions_comment: true
args: '-var="env=dev"'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
This example shows how to use a variable file using the `-var-file` argument.

```yaml
name: 'Terraform GitHub Actions'
Expand All @@ -32,16 +55,17 @@ jobs:
tf_actions_subcommand: 'init'
tf_actions_working_dir: '.'
tf_actions_comment: true
args: '-var-file="dev.tfvars"'
env:
TF_VAR_environment: 'development'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

## Using a Variable File

Terraform can be configured to use a variable file.
## Using an Environment Variable

The `TF_VAR_name` environment variable can be used to define a value for a variable. When using `TF_VAR_name`,`name` is the name of the Terraform variable as declared in the Terraform files.

Here, Terraform is configured to use the variable file `development.tfvars`.
Here, the Terraform variable `env` is set to the value `dev`.

```yaml
name: 'Terraform GitHub Actions'
Expand All @@ -62,6 +86,6 @@ jobs:
tf_actions_working_dir: '.'
tf_actions_comment: true
env:
TF_CLI_ARGS_init: '-var-file="development.tfvars"'
TF_VAR_env: 'dev'
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ jobs:
tf_actions_working_dir: '.'
tf_actions_comment: true
env:
TF_WORKSPACE: development
TF_WORKSPACE: dev
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
If using the `remote` backend with the `name` argument, the configured workspace will be created for you. If using the `remote` backend with the `prefix` arugmnet, the configured workspace must already exist and will not be created for you.
If using the `remote` backend with the `name` argument, the configured workspace will be created for you. If using the `remote` backend with the `prefix` argument, the configured workspace must already exist and will not be created for you.
7 changes: 5 additions & 2 deletions content/source/layouts/github-actions.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ul class="nav docs-sidenav">

<li<%= sidebar_current("docs-github-actions-started") %>>
<a href="/docs/github-actions/getting-started/index.html">Getting Started</a>
<a href="/docs/github-actions/getting-started.html">Getting Started</a>
</li>

<li<%= sidebar_current("docs-github-actions-configuration") %>>
Expand All @@ -32,10 +32,13 @@
<li<%= sidebar_current("docs-github-actions-workflows") %>>
<a href="/docs/github-actions/workflows/index.html">Workflows</a>
<ul class="nav">
<li<%= sidebar_current("docs-github-actions-workflows-arguments") %>>
<a href="/docs/github-actions/workflows/arguments.html">Arguments</a>
</li>
<li<%= sidebar_current("docs-github-actions-workflows-backends") %>>
<a href="/docs/github-actions/workflows/backends.html">Backends</a>
</li>
<li<%= sidebar_current("docs-github-actions-workflows-tf-versions") %>>
<li<%= sidebar_current("docs-github-actions-workflows-terraform-versions") %>>
<a href="/docs/github-actions/workflows/terraform-versions.html">Terraform Versions</a>
</li>
<li<%= sidebar_current("docs-github-actions-workflows-variables") %>>
Expand Down

0 comments on commit aaad3ae

Please sign in to comment.