Skip to content

Commit b2bb911

Browse files
authored
Merge pull request #3074 from OctopusDeploy/timnicholas/terraform-steps-tweak
Adjust built in terraform step doc to better address git source use case
2 parents 5f4d410 + 36fe025 commit b2bb911

File tree

1 file changed

+12
-10
lines changed
  • src/pages/docs/deployments/terraform/working-with-built-in-steps

1 file changed

+12
-10
lines changed

src/pages/docs/deployments/terraform/working-with-built-in-steps/index.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ pubDate: 2023-01-01
44
modDate: 2023-01-01
55
title: Terraform step configuration with Octopus
66
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
88
navOrder: 20
99
---
1010

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+
1213
- `Apply a Terraform template`
1314
- `Destroy Terraform resources`
14-
- `Plan to apply a Terraform template`
15+
- `Plan to apply a Terraform template`
1516
- `Plan a Terraform destroy`
1617

1718
:::figure
@@ -26,15 +27,16 @@ While these are the options common to each step, there are additional ways to in
2627

2728
## Managed Accounts
2829

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.
3031

3132
:::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.
3334
:::
3435

35-
## Template section
36+
## Template section
3637

3738
The Terraform template can come from three sources:
39+
3840
- Directly entered source code
3941
- Files in a package
4042
- 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
100102
- URL
101103
- Credentials (either anonymous or selecting a Git credential from the Library)
102104

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.
104106

105107
#### Version-controlled projects
106108

107109
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.
108110

109111
### Variable replacements
110112

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.
112114

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.
114116

115117
For example, if you were deploying from a package and your template file looked like this:
116118

@@ -136,4 +138,4 @@ See the [variable substitution](/docs/projects/variables/variable-substitutions)
136138

137139
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`.
138140

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

Comments
 (0)