Skip to content

Commit 56c3123

Browse files
committed
Backend docs up to date
1 parent 22d16d3 commit 56c3123

File tree

15 files changed

+494
-246
lines changed

15 files changed

+494
-246
lines changed

content/terraform-docs-common/data/cloud-docs-nav-data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
},
2828
{
2929
"title": "Migrate to HCP Terraform",
30-
"path": "migrate"
30+
"path": "migrate"
3131
},
3232
{
3333
"title": "API",

content/terraform/v1.13.x/data/language-nav-data.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
{ "title": "Override files", "path": "files/override" },
3232
{ "title": "Dependency lock file", "path": "files/dependency-lock" },
3333
{ "title": "Test files", "path": "files/tests" },
34-
{ "title": "Stack Files", "path": "files/stack" }
34+
{ "title": "Stack files", "path": "files/stack" }
3535
]
3636
},
3737
{

content/terraform/v1.13.x/docs/language/block/stack/component_configuration/index.mdx

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,9 @@ Each Stack requires at least one `component` block, and you must add a `componen
2020
You can define the following blocks in component configuration files:
2121

2222
- The [`component`](/terraform/language/block/stack/configuration/component) block sources individual modules that make up your Stack. Each component receives input variables and accepts providers that you declare at the Stack level.
23-
2423
- The [`required_providers`](/terraform/language/block/stack/configuration/required_providers) block declares which providers your component configuration requires so that Terraform can install and use them.
25-
2624
- The [`provider`](/terraform/language/block/stack/configuration/provider) block configures providers and passes that configuration to components.
27-
2825
- The [`removed`](/terraform/language/block/stack/configuration/removed) block defines components you want to remove from your Stack while ensuring proper cleanup of resources.
29-
3026
- The [`variable`](/terraform/language/block/stack/configuration/variable) block defines input variables that your deployments can set with different values.
31-
3227
- The [`output`](/terraform/language/block/stack/configuration/output) block defines values to expose in the HCP Terraform UI and to make available to deployments.
33-
3428
- The [`locals`](/terraform/language/block/locals) block defines local values that you can reference within your component configuration.

content/terraform/v1.13.x/docs/language/block/stack/deploy/deployment.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ deployment "<LABEL>" {
120120
}
121121
```
122122

123-
You can use deployment groups to enable orchestration rules which can manage your deployment's lifecycle. For more details on deployment groups, refer to the [Set conditions for deployment plans](/terraform/language/stacks/deploy/conditions).
123+
You can use deployment groups to enable orchestration rules which can manage your deployment's lifecycle. For more details on deployment groups, refer to the [Set conditions for deployment runs](/terraform/language/stacks/deploy/conditions).
124124

125125
If a deployment does not specify a deployment group, Terraform automatically generates an independent deployment group for it named `<DEPLOYMENT_NAME>_default`.
126126

@@ -215,7 +215,7 @@ deployment "web" {
215215
}
216216
```
217217

218-
You can use deployment groups to enable orchestration rules which can manage your deployment's lifecycle. For more details on deployment groups, refer to the [Set conditions for deployment plans](/terraform/language/stacks/deploy/conditions).
218+
You can use deployment groups to enable orchestration rules which can manage your deployment's lifecycle. For more details on deployment groups, refer to the [Set conditions for deployment runs](/terraform/language/stacks/deploy/conditions).
219219

220220
### Multiple deployments
221221

content/terraform/v1.13.x/docs/language/block/stack/deploy/deployment_group.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Deployment groups only support one deployment per group at this time.
1717

1818
The `deployment_group` block defines a new group that you can assign individual deployments to join. You can assign a deployment to a group [using the `deployment_group` argument in a `deployment` block](/terraform/language/block/stack/deploy/deployment#deployment_group). If you don't assign a deployment to a group, Terraform automatically creates a default deployment group for that deployment.
1919

20-
Deployment groups let you enforce orchestration rules on the deployments within the group. To learn more, refer to [Set conditions for deployment plans](/terraform/language/stacks/deploy/conditions).
20+
Deployment groups let you enforce orchestration rules on the deployments within the group. To learn more, refer to [Set conditions for deployment runs](/terraform/language/stacks/deploy/conditions).
2121

2222
## Configuration model
2323

content/terraform/v1.13.x/docs/language/block/stack/deploy/index.mdx

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,10 @@ To learn more, refer to [Define deployment configuration](/terraform/language/st
2020
You can define the following blocks in deployment configuration files:
2121

2222
- The [`deployment`](/terraform/language/block/stack/deployment/deployment) block defines how many times you want to deploy your Stack's infrastructure and with what input values.
23-
2423
- The [`deployment_group`](/terraform/language/block/stack/deployment/deployment_group) block groups deployments together to configure shared settings and auto-approval rules.
25-
2624
- The [`deployment_auto_approve`](/terraform/language/block/stack/deployment/deployment_auto_approve) block defines rules that automatically approve deployment plans based on specific conditions.
27-
2825
- The [`identity_token`](/terraform/language/block/stack/deployment/identity_token) block defines JSON Web Tokens (JWT) that Terraform generates for OIDC authentication with cloud providers.
29-
3026
- The [`store`](/terraform/language/block/stack/deployment/store) block provides access to external secret stores and variable sets from your deployment configuration.
31-
3227
- The [`publish_output`](/terraform/language/block/stack/deployment/publish_output) block exports values from your Stack that other Stacks in the same project can consume.
33-
3428
- The [`upstream_input`](/terraform/language/block/stack/deployment/upstream_input) block consumes outputs from another Stack in the same project and uses them as inputs in your current Stack.
35-
3629
- The [`locals`](/terraform/language/block/locals) block defines local values that you can reference within your deployment configuration.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
page_title: Stack configuration files for Terraform
3+
description: |-
4+
Learn about the two types of configuration files that make up a Stack. The component configuration file defines the pieces that make up a Stack, and deployment configuration files defines how to deploy that infrastructure.
5+
---
6+
7+
# Stack configuration files
8+
9+
[Stacks](/terraform/language/stacks) use two types of configuration files to separate defining the components of your infrastructure from deployment details. Use a component configuration to define your infrastructure once, and a deployment configuration to deploy that infrastructure multiple times with different configurations.
10+
11+
## File types
12+
13+
A Stack configuration is made up of of two different file types:
14+
15+
- Component files, ending in `.tfcomponent.hcl`, declare the infrastructure components that this Stack creates and the input values of those components.
16+
- Deployment files, ending in `.tfdeploy.hcl`, declare how many times to deploy a stack and the input values for each deployment.
17+
18+
### Component configuration files
19+
20+
Component files, ending in `.tfcomponent.hcl`, define the infrastructure components that make up your Stack. Component configuration files focus on what infrastructure you want to create, without specifying where or how many times to deploy it.
21+
22+
The component configuration replaces Terraform's traditional root module structure and declares which modules to include, how to configure providers, and what variables your Stack accepts. Each Stack requires at least one `component` block, and you must add a `component` block for every module you want to include in your Stack. Learn more about [writing a component configuration](/terraform/language/stacks/component/config).
23+
24+
You can define the following blocks in component configuration files:
25+
26+
- The [`component`](/terraform/language/block/stack/configuration/component) block sources individual modules that make up your Stack. Each component receives input variables and accepts providers that you declare at the Stack level.
27+
- The [`required_providers`](/terraform/language/block/stack/configuration/required_providers) block declares which providers your component configuration requires so that Terraform can install and use them.
28+
- The [`provider`](/terraform/language/block/stack/configuration/provider) block configures providers and passes that configuration to components.
29+
- The [`removed`](/terraform/language/block/stack/configuration/removed) block defines components you want to remove from your Stack while ensuring proper cleanup of resources.
30+
- The [`variable`](/terraform/language/block/stack/configuration/variable) block defines input variables that your deployments can set with different values.
31+
- The [`output`](/terraform/language/block/stack/configuration/output) block defines values to expose in the HCP Terraform UI and to make available to deployments.
32+
- The [`locals`](/terraform/language/block/locals) block defines local values that you can reference within your component configuration.
33+
34+
You can separate your component configuration into several files for easier navigability. For example, the following file structure separates a Stack's components from the other other blocks that help configure those components:
35+
36+
- `components.tfcomponent.hcl` - Defines your Stack's components
37+
- `providers.tfcomponent.hcl` - Configures providers in this Stack
38+
- `variables.tfcomponent.hcl` - Declares input variables in this Stack
39+
- `outputs.tfcomponent.hcl` - Defines output values of this Stack
40+
41+
### Deployment configuration files
42+
43+
Deployment configuration files (`.tfdeploy.hcl`) define how HCP Terraform deploys your Stack's infrastructure. Deployment configuration files focus on where and how to deploy your infrastructure, using the components you defined in your component configuration.
44+
45+
Your Stack must have at least one `deployment` block. The deployment configuration file specifies how many deployments to create, what values to pass to each deployment, and how to orchestrate the deployment run process.
46+
47+
You can define the following blocks in deployment configuration files:
48+
49+
- The [`deployment`](/terraform/language/block/stack/deployment/deployment) block defines how many times you want to deploy your Stack's infrastructure and with what input values.
50+
- The [`deployment_group`](/terraform/language/block/stack/deployment/deployment_group) block groups deployments together to configure shared settings and auto-approval rules.
51+
- The [`deployment_auto_approve`](/terraform/language/block/stack/deployment/deployment_auto_approve) block defines rules that automatically approve deployment plans based on specific conditions.
52+
- The [`identity_token`](/terraform/language/block/stack/deployment/identity_token) block defines JSON Web Tokens (JWT) that Terraform generates for OIDC authentication with cloud providers.
53+
- The [`store`](/terraform/language/block/stack/deployment/store) block provides access to external secret stores and variable sets from your deployment configuration.
54+
- The [`publish_output`](/terraform/language/block/stack/deployment/publish_output) block exports values from your Stack that other Stacks in the same project can consume.
55+
- The [`upstream_input`](/terraform/language/block/stack/deployment/upstream_input) block consumes outputs from another Stack in the same project and uses them as inputs in your current Stack.
56+
- The [`locals`](/terraform/language/block/locals) block defines local values that you can reference within your deployment configuration.
57+
58+
## File organization
59+
60+
HCP Terraform processes all the configuration files in your Stack's root directory, regardless of their names. You can organize your configuration across multiple files based on your preferences, similar to traditional Terraform configurations.
61+
62+
Both component configuration and deployment configurations must reside at the root level of your Stack repository. HCP Terraform automatically discovers and processes all `.tfcomponent.hcl` and `.tfdeploy.hcl` files in dependency order.
63+
64+
## Next steps
65+
66+
- Learn how to write [component configuration](/terraform/language/stacks/component/config) files
67+
- Learn how to write [deployment configuration](/terraform/language/stacks/deploy/create) files

content/terraform/v1.13.x/docs/language/stacks/component/config.mdx

Lines changed: 50 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,27 @@ Your component configuration file defines multiple components that share a lifec
1313

1414
You declare the infrastructure that makes up your Stack in the component configuration file. Component configuration files replace Terraform’s traditional root module and serve as the blueprint for what your Stack deploys.
1515

16-
Component configuration files use a new file type, `tfcomponent.hcl`, to define everything that shares your Stack’s lifecycle. After writing your component configuration, you can write a deployment configuration to dictate how HCP Terraform deploys your Stack’s infrastructure.
16+
Component configuration files use the `<NAME>.tfcomponent.hcl` file type, and define everything that shares your Stack’s lifecycle. After writing your component configuration, you can write a [deployment configuration](/terraform/language/stacks/deploy/config) to dictate how HCP Terraform deploys your Stack’s infrastructure.
1717

18-
As with Terraform configuration files, HCP Terraform processes all of the blocks in your component configuration and deployment configuration files in your Stack's root directory in dependency order. You can organize your component configuration into multiple files as in traditional Terraform configurations.
18+
As with Terraform configuration files, HCP Terraform processes all of the blocks in your component configuration and deployment configuration files in your Stack's root directory in dependency order. You can organize your component configuration into multiple files, as in traditional Terraform configurations.
1919

2020
### Requirements
2121

22-
Before you begin writing your component configuration, ensure you have the `terraform-stacks-cli` for initializing and validating your component configurations. For installation guidance, refer to the [Stacks CLI reference](/terraform/language/stacks/reference/tfcomponents-cli).
22+
Use Terraform v1.13.x or later to access the Stacks CLI plugin, and run `terraform stacks` CLI commands.
23+
24+
During the beta release, Stacks had a separate [Terraform Stacks CLI](/terraform/language/v1.12.x/stacks/reference/tfstacks-cli), which no longer supports current functionality.
25+
26+
## Create a version file
27+
28+
Begin by adding a `.terraform-version` file to your Stack's root directory to specify the Terraform version required for your Stack. For example, the following file specifies Terraform v1.13.0:
29+
30+
<CodeBlockConfig filename=".terraform-version">
31+
32+
```hcl
33+
1.13.0
34+
```
35+
36+
</CodeBlockConfig>
2337

2438
## Define your component configuration
2539

@@ -29,9 +43,9 @@ All of your Stack’s configuration files must use the `.tfcomponent.hcl` file t
2943

3044
The `component` block defines the pieces that make up your Stack. Add a `component` block for each top-level module you want to include in the Stack. Specify the source module, inputs, and providers for each component.
3145

32-
```hcl
33-
# components.tfcomponent.hcl
46+
<CodeBlockConfig filename="components.tfcomponent.hcl">
3447

48+
```hcl
3549
component "cluster" {
3650
source = "./eks"
3751
inputs = {
@@ -48,15 +62,16 @@ component "cluster" {
4862
}
4963
```
5064

51-
After establishing your top-level modules, you can use child modules without adding additional `component` blocks.
65+
</CodeBlockConfig>
66+
5267

53-
The component configuration file type accepts most classic Terraform configuration blocks but with some key differences. For more details on declaring providers in Stacks, refer to [Declare providers](/terraform/language/stacks/component/declare-providers). For more information on the component configuration file type and all the blocks and attributes it accepts, refer to the [Configuration file reference](/terraform/language/stacks/reference/tfcomponent).
68+
After establishing your top-level modules, you can use child modules without adding additional `component` blocks.
5469

5570
The `component` block supports the `for_each` meta-argument if you need to replicate components across multiple instances. For example, the following configuration uses `for_each` to provision modules in multiple AWS regions for a given environment.
5671

57-
```hcl
58-
# components.tfcomponent.hcl
72+
<CodeBlockConfig filename="components.tfcomponent.hcl">
5973

74+
```hcl
6075
component "s3" {
6176
for_each = var.regions
6277
@@ -73,19 +88,40 @@ component "s3" {
7388
}
7489
```
7590

76-
After writing your component configuration, use the Terraform Stacks CLI to validate it.
91+
</CodeBlockConfig>
92+
93+
94+
You can define the following blocks in component configuration files to configure your Stack's components:
95+
96+
- The [`component`](/terraform/language/block/stack/configuration/component) block sources individual modules that make up your Stack. Each component receives input variables and accepts providers that you declare at the Stack level.
97+
- The [`required_providers`](/terraform/language/block/stack/configuration/required_providers) block declares which providers your component configuration requires so that Terraform can install and use them.
98+
- The [`provider`](/terraform/language/block/stack/configuration/provider) block configures providers and passes that configuration to components.
99+
- The [`removed`](/terraform/language/block/stack/configuration/removed) block defines components you want to remove from your Stack while ensuring proper cleanup of resources.
100+
- The [`variable`](/terraform/language/block/stack/configuration/variable) block defines input variables that your deployments can set with different values.
101+
- The [`output`](/terraform/language/block/stack/configuration/output) block defines values to expose in the HCP Terraform UI and to make available to deployments.
102+
- The [`locals`](/terraform/language/block/locals) block defines local values that you can reference within your component configuration.
103+
104+
Provider authentication works differently for a Stack, for more details on declaring providers in Stacks, refer to [Declare providers](/terraform/language/stacks/component/declare-providers).
105+
106+
After writing your component configuration, you can validate your configuration locally using the Terraform CLI.
77107

78108
## Validate your configuration
79109

80-
Once you have finished your component configuration, use the `terraform-stacks-cli` tool to validate your configuration and generate the necessary provider lock files.
110+
Once you have finished your component configuration, you can use [`terraform stacks` CLI](/terraform/cli/commands/stacks) commands to validate your configuration and generate the necessary provider lock files.
81111

82112
```shell-session
83-
$ tfcomponents init
84-
$ tfcomponents validate
113+
$ terraform stacks init
114+
$ terraform stacks validate
85115
```
86116

87-
For installation guidance and more details, refer to the [Stacks CLI](/terraform/language/stacks/reference/tfcomponents-cli).
117+
You can also re-format your configuration files using the `terraform fmt` command to ensure consistent styling:
118+
119+
```shell-session
120+
$ terraform stacks fmt
121+
```
88122

89123
## Next steps
90124

91125
If you have not yet defined the providers for your Stack, proceed to [Declare providers](/terraform/language/stacks/component/declare-providers). You can also learn how to [Authenticate your Stack](/terraform/language/stacks/deploy/authenticate) to ensure your providers are properly set up.
126+
127+
After completing your component configuration, the next step is to [define your deployment configuration](/terraform/language/stacks/deploy/config) to specify how you want to deploy your Stack's infrastructure.

0 commit comments

Comments
 (0)