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: src/pages/docs/deployments/terraform/working-with-built-in-steps/index.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,15 @@ pubDate: 2023-01-01
4
4
modDate: 2023-01-01
5
5
title: Terraform step configuration with Octopus
6
6
navTitle: Terraform step configuration
7
-
description: Configuring common Terraform options using the Octopus built in steps
7
+
description: Configuring common Terraform options using the Octopus built in steps
8
8
navOrder: 20
9
9
---
10
10
11
-
Octopus provides four built-in step templates for managing and interacting with your Terraform code:
11
+
Octopus provides four built-in step templates for managing and interacting with your Terraform code:
12
+
12
13
-`Apply a Terraform template`
13
14
-`Destroy Terraform resources`
14
-
-`Plan to apply a Terraform template`
15
+
-`Plan to apply a Terraform template`
15
16
-`Plan a Terraform destroy`
16
17
17
18
:::figure
@@ -26,15 +27,16 @@ While these are the options common to each step, there are additional ways to in
26
27
27
28
## Managed Accounts
28
29
29
-
You can optionally prepare the environment that Terraform runs in using the details defined in accounts managed by Octopus. If an account is selected then those credentials do not need to be included in the Terraform template.
30
+
You can optionally prepare the environment that Terraform runs in using the details defined in [accounts](/docs/infrastructure/accounts) managed by Octopus. If an account is selected then those credentials do not need to be included in the Terraform template.
30
31
31
32
:::div{.hint}
32
-
Using credentials managed by Octopus is optional, and credentials defined in the Terraform template take precedence over any credentials defined in the step. You can learn more about creating managed cloud accounts using Octopus [here](/docs/infrastructure/accounts).
33
+
Using credentials managed by Octopus is optional, and credentials defined in the Terraform template take precedence over any credentials defined in the step.
33
34
:::
34
35
35
-
## Template section
36
+
## Template section
36
37
37
38
The Terraform template can come from three sources:
39
+
38
40
- Directly entered source code
39
41
- Files in a package
40
42
- Files in a Git repository - *New!*
@@ -100,17 +102,17 @@ If you are storing your project configuration directly in Octopus (i.e. not in a
100
102
- URL
101
103
- Credentials (either anonymous or selecting a Git credential from the Library)
102
104
103
-
When creating a Release, you choose the tip of a branch for your files. The commit hash for this branch is saved to the Release. This means redeploying that release will only ever use that specific commit and not the _new_ tip of the branch.
105
+
When creating a Release, you choose the tip of a branch for your files. The commit hash for this branch is saved to the Release. This means redeploying that release will only ever use that specific commit and not the *new* tip of the branch.
104
106
105
107
#### Version-controlled projects
106
108
107
109
If you are storing your project configuration in a Git repository using the [Configuration as code feature](/docs/projects/version-control), in addition to the option above, you can source your files from the same Git repository as your deployment process by selecting **Project** as the Git repository source. When creating a Release using this option, the commit hash used for your deployment process will also be used to source the files.
108
110
109
111
### Variable replacements
110
112
111
-
Variable replacement is performed before the template is applied or destroyed when defined in either an inline script or a package.
113
+
Variable replacement is performed before terraform is executed.
112
114
113
-
When deploying a template from a package, all `*.tf`, `*.tfvar`, `*.tf.json` and `*.tfvar.json` files will have variable substitution applied to them. You can also have variable substitution applied to additional files by defining the file names in the `Target files` field.
115
+
When deploying a template from a package or Git repository, all `*.tf`, `*.tfvar`, `*.tf.json` and `*.tfvar.json` files will have variable substitution applied to them by default. You can disable the automatic substitution by deselecting `Replace variables in default Terraform files`. You can also have variable substitution applied to additional files by defining file names in the `Target files` field.
114
116
115
117
For example, if you were deploying from a package and your template file looked like this:
116
118
@@ -136,4 +138,4 @@ See the [variable substitution](/docs/projects/variables/variable-substitutions)
136
138
137
139
The `Additional variable files` option contains a new-line separated list of variable files to use with the deployment. All files called `terraform.tfvars`, `terraform.tfvars.json`, `*.auto.tfvars` and `*.auto.tfvars.json` are automatically loaded by Terraform, and do not need to be listed here. However, you may want to reference environment specific variable files by referencing them with files names built around variable substitution such as `#{Octopus.Environment.Name}.tfvars`.
138
140
139
-
Each line entered into this field will be passed to Terraform as `-var-file '<filename>'`.
141
+
Each line entered into this field will be passed to Terraform as `-var-file '<filename>'`.
0 commit comments