You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+36-32Lines changed: 36 additions & 32 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
This is one of a suite of Terraform related actions - find them at [dflook/terraform-github-actions](https://github.com/dflook/terraform-github-actions).
4
4
5
-
:warning: This action uses the `terraform destroy` command to immediately destroy all resources in a terraform workspace.
5
+
:warning: This action uses the `terraform destroy` command to immediately destroy all resources in a Terraform workspace.
6
6
7
7
To generate a plan that can be reviewed you can instead use the [dflook/terraform-plan](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan)
8
8
and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/tree/main/terraform-plan) actions with the `destroy` input set to `true`.
@@ -11,23 +11,25 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
11
11
12
12
*`path`
13
13
14
-
Path to the Terraform root module
14
+
The path to the Terraform root module directory.
15
15
16
16
- Type: string
17
17
- Optional
18
18
- Default: The action workspace
19
19
20
20
*`workspace`
21
21
22
-
Terraform workspace to destroy
22
+
The name of the Terraform workspace to destroy.
23
23
24
24
- Type: string
25
25
- Optional
26
26
- Default: `default`
27
27
28
28
*`variables`
29
29
30
-
Variables to set for the terraform destroy. This should be valid Terraform syntax - like a [variable definition file](https://www.terraform.io/docs/language/values/variables.html#variable-definitions-tfvars-files).
30
+
Variables to set for the terraform destroy. This should be valid Terraform syntax - like a [variable definition file](https://developer.hashicorp.com/terraform/language/values/variables#variable-definitions-tfvars-files).
31
+
32
+
Variables set here override any given in `var_file`s.
31
33
32
34
```yaml
33
35
with:
@@ -39,16 +41,14 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
39
41
]
40
42
```
41
43
42
-
Variables set here override any given in `var_file`s.
43
-
44
44
- Type: string
45
45
- Optional
46
46
47
47
* `var_file`
48
48
49
49
List of tfvars files to use, one per line.
50
50
Paths should be relative to the GitHub Actions workspace
51
-
51
+
52
52
```yaml
53
53
with:
54
54
var_file: |
@@ -61,7 +61,7 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
61
61
62
62
* `backend_config`
63
63
64
-
List of terraform backend config values, one per line.
64
+
List of Terraform backend config values, one per line.
65
65
66
66
```yaml
67
67
with:
@@ -90,7 +90,7 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
90
90
91
91
- Type: number
92
92
- Optional
93
-
- Default: The terraform default (10)
93
+
- Default: The Terraform default (10).
94
94
95
95
## Outputs
96
96
@@ -104,6 +104,8 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
104
104
If the job fails for any other reason this will not be set.
105
105
This can be used with the Actions expression syntax to conditionally run a steps.
106
106
107
+
- Type: string
108
+
107
109
* `lock-info`
108
110
109
111
When the job outcome is `failure` and the failure-reason is `state-locked`, this output will be set.
@@ -121,6 +123,8 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
121
123
}
122
124
```
123
125
126
+
- Type: string
127
+
124
128
## Environment Variables
125
129
126
130
* `GITHUB_DOT_COM_TOKEN`
@@ -156,7 +160,7 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
156
160
157
161
* `TERRAFORM_SSH_KEY`
158
162
159
-
A SSH private key that Terraform will use to fetch git module sources.
163
+
A SSH private key that Terraform will use to fetch git/mercurial module sources.
160
164
161
165
This should be in PEM format.
162
166
@@ -169,28 +173,6 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
169
173
- Type: string
170
174
- Optional
171
175
172
-
* `TERRAFORM_PRE_RUN`
173
-
174
-
A set of commands that will be ran prior to `terraform init`. This can be used to customise the environment before running Terraform.
175
-
176
-
The runtime environment for these actions is subject to change in minor version releases. If using this environment variable, specify the minor version of the action to use.
177
-
178
-
The runtime image is currently based on `debian:bullseye`, with the command run using `bash -xeo pipefail`.
Credentials that will be used for fetching modules sources with `git::http://`, `git::https://`, `http://` & `https://` schemes.
@@ -216,6 +198,28 @@ and [dflook/terraform-apply](https://github.com/dflook/terraform-github-actions/
216
198
- Type: string
217
199
- Optional
218
200
201
+
* `TERRAFORM_PRE_RUN`
202
+
203
+
A set of commands that will be ran prior to `terraform init`. This can be used to customise the environment before running Terraform.
204
+
205
+
The runtime environment for these actions is subject to change in minor version releases. If using this environment variable, specify the minor version of the action to use.
206
+
207
+
The runtime image is currently based on `debian:bullseye`, with the command run using `bash -xeo pipefail`.
Copy file name to clipboardExpand all lines: action.yaml
+58-17Lines changed: 58 additions & 17 deletions
Original file line number
Diff line number
Diff line change
@@ -4,39 +4,80 @@ author: Daniel Flook
4
4
5
5
inputs:
6
6
path:
7
-
description: Path to the Terraform configuration
7
+
description: The path to the Terraform root module directory.
8
8
required: false
9
-
default: .
9
+
default: "."
10
10
workspace:
11
-
description: Name of the Terraform workspace
11
+
description: The name of the Terraform workspace to destroy.
12
12
required: false
13
-
default: default
14
-
backend_config:
15
-
description: List of backend config values to set, one per line
16
-
required: false
17
-
default: ""
18
-
backend_config_file:
19
-
description: Path to a backend config file
20
-
required: false
21
-
default: ""
13
+
default: "default"
22
14
variables:
23
-
description: Variable definitions
15
+
description: |
16
+
Variables to set for the terraform destroy. This should be valid Terraform syntax - like a [variable definition file](https://developer.hashicorp.com/terraform/language/values/variables#variable-definitions-tfvars-files).
17
+
18
+
Variables set here override any given in `var_file`s.
19
+
required: false
20
+
var_file:
21
+
description: |
22
+
List of tfvars files to use, one per line.
23
+
Paths should be relative to the GitHub Actions workspace
24
24
required: false
25
25
var:
26
-
description: Comma separated list of vars to set, e.g. 'foo=bar'
26
+
description: |
27
+
Comma separated list of Terraform vars to set.
28
+
This is deprecated due to the following limitations:
29
+
- Only primitive types can be set with `var` - number, bool and string.
30
+
- String values may not contain a comma.
31
+
- Values set with `var` will be overridden by values contained in `var_file`s
32
+
- Does not work with the `remote` backend
33
+
You can change from `var` to `variables` by putting each variable on a separate line and ensuring each string value is quoted.
27
34
required: false
28
35
deprecationMessage: Use the variables input instead.
29
-
var_file:
30
-
description: List of var file paths, one per line
36
+
backend_config:
37
+
description: List of Terraform backend config values, one per line.
31
38
required: false
39
+
default: ""
40
+
backend_config_file:
41
+
description: |
42
+
List of Terraform backend config files to use, one per line.
43
+
Paths should be relative to the GitHub Actions workspace
44
+
required: false
45
+
default: ""
32
46
parallelism:
33
47
description: Limit the number of concurrent operations
34
48
required: false
35
49
default: "0"
36
50
51
+
outputs:
52
+
failure-reason:
53
+
description: |
54
+
When the job outcome is `failure`, this output may be set. The value may be one of:
55
+
56
+
- `destroy-failed` - The Terraform destroy operation failed.
57
+
- `state-locked` - The Terraform state lock could not be obtained because it was already locked.
58
+
59
+
If the job fails for any other reason this will not be set.
60
+
This can be used with the Actions expression syntax to conditionally run a steps.
61
+
lock-info:
62
+
description: |
63
+
When the job outcome is `failure` and the failure-reason is `state-locked`, this output will be set.
64
+
65
+
It is a json object containing any available state lock information and typically has the form:
0 commit comments