Skip to content

Commit 3bdf0de

Browse files
authored
Merge pull request #374 from hashicorp/RK/stacks-docs
[Hashiconf] Stacks Docs
2 parents 98e6719 + 765d3e1 commit 3bdf0de

File tree

8 files changed

+415
-0
lines changed

8 files changed

+415
-0
lines changed

website/data/cloud-docs-nav-data.json

+16
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,22 @@
375375
{ "title": "Private VCS Providers", "path": "vcs/private"},
376376
{ "title": "Troubleshooting", "path": "vcs/troubleshooting" }
377377
]
378+
},
379+
{
380+
"title": "Stacks <sup>BETA</sup>",
381+
"routes": [
382+
{ "title": "Overview", "path": "stacks" },
383+
{ "title": "Create a Stack", "path": "stacks/create" },
384+
{ "title": "Configure a Stack", "path": "stacks/configure" },
385+
{
386+
"title": "Deploy infrastructure",
387+
"routes": [
388+
{ "title": "Configuration versions", "path": "stacks/deploy/configuration-versions" },
389+
{ "title": "Review deployment plans", "path": "stacks/deploy/plans" }
390+
]
391+
},
392+
{ "title": "Destroy a Stack", "path": "stacks/destroy" }
393+
]
378394
},
379395
{
380396
"title": "Private Registry",
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
page_title: Configure a Stack
3+
description: Learn how to configure a Stack’s name, description, and VCS settings in HCP Terraform.
4+
tfc_only: true
5+
---
6+
7+
# Configure a Stack
8+
9+
This guide explains configuring a Stack’s name, description, and VCS settings in HCP Terraform.
10+
11+
## Requirements
12+
13+
To view a Stack and its configurations, you must also be a member of a team in your organization with one of the following permissions:
14+
15+
* [Organization-level **Manage all projects**](/terraform/cloud-docs/users-teams-organizations/permissions#manage-all-projects) or higher
16+
* [Project-level **Maintain**](/terraform/cloud-docs/users-teams-organizations/permissions#maintain) or higher
17+
18+
## Configure a stack
19+
20+
You can configure a Stack by performing the following steps:
21+
22+
1. In the navigation menu, click **Projects** under **Manage**.
23+
1. Select the project containing your Stack.
24+
1. Click **Stacks** in the navigation menu.
25+
1. Select the Stack you want to configure.
26+
1. Click **Stack settings** in the navigation menu.
27+
1. Update any of the following settings:
28+
* Name
29+
* Description
30+
* Version control settings, including:
31+
* Stacks automatically trigger new plans when you push them to your repositories’ default branch. To deactivate this behavior, uncheck **VCS Trigger Enabled**.
32+
* You can also configure Stacks to work from either a branch or tag-based workflow.
33+
* By default, HCP Terraform fetches your stack’s configuration after creating your Stack. To fetch your Stack configuration manually, uncheck **Fetch configuration after HCP Terraform creates stack**.
34+
1. Click **Save settings** to apply your changes.
35+
36+
## Next steps
37+
38+
After configuring your stack, you can learn more about how to [review your stack’s deployment plans](/terraform/cloud-docs/stacks/deploy/plans) or [destroy your stack](/terraform/cloud-docs/stacks/destroy).
+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
page_title: Create a Stack
3+
description: Learn how to create a Stack in HCP Terraform so you can get started deploying your infrastructure.
4+
tfc_only: true
5+
---
6+
7+
# Create a Stack
8+
9+
Stacks enable you to provision and coordinate your infrastructure lifecycle at scale, offering an organized and reusable approach that expands upon infrastructure as code (IaC).
10+
11+
> **Hands-on**: Try out the [Deploy a Stack with HCP Terraform](/terraform/tutorials/cloud/stacks-deploy) tutorial to get started with Stacks quickly.
12+
13+
This article explains how to create a Stack in HCP Terraform using a Stack’s configuration and deployment configuration files.
14+
15+
## Requirements
16+
17+
Stacks are not available for users on legacy HCP Terraform team plans. Learn more about [migrating to current HCP Terraform plans](/terraform/cloud-docs/overview/migrate-teams-standard).
18+
19+
To create a Stack in HCP Terraform, you must set up the following:
20+
* [Connect a VCS provider](/terraform/cloud-docs/vcs) using the Github App, GitHub OAuth workflow, or a GitLab VCS workflow.
21+
* A repository with a top-level [Stack configuration](/terraform/language/stacks/create/config) and a [deployment configuration](/terraform/language/stacks/reference/tfdeploy). Your Stack configuration file should include at least one `component` block, and your deployment configuration file should include at least one `deployment` block.
22+
23+
You must also be a member of a team in your organization with one of the following permissions:
24+
* [Organization-level **Manage all projects**](/terraform/cloud-docs/users-teams-organizations/permissions#manage-all-projects)
25+
* [Project-level **Maintain**](/terraform/cloud-docs/users-teams-organizations/permissions#maintain) or higher
26+
27+
## Create a Stack
28+
29+
If you are creating a Stack in an organization for the first time, you should first enable Stacks for your organization. Navigate to your organization’s **Settings** page, and in the **General** settings, check the box next to **Stacks** to enable them.
30+
31+
Stacks live alongside workspaces in a project. To create a new Stack in HCP Terraform, perform the following steps:
32+
33+
1. In the navigation menu, click **Projects** under **Manage**.
34+
1. Select the project where you want to create your Stack.
35+
1. In the project's navigation menu, select **Stacks**.
36+
1. Click **+ New stack**.
37+
1. Select a version control provider from the list.
38+
1. Choose an organization and repository from the filterable list. If your repository is missing, enter its ID in the text field below the list. The list only displays the first 100 repositories from your VCS provider.
39+
1. Enter a new **Stack Name**.
40+
* The name must be unique within the project and can include letters, numbers, dashes (`-`), and underscores (`_`). We recommend using 90 characters or less for the name of your Stack.
41+
1. You can optionally add a description for your Stack.
42+
1. You can optionally adjust your version control settings by expanding **Advanced Options.**
43+
* Stacks automatically trigger new plans when you push them to your repositories’ default branch. You can deactivate this by toggling the **VCS Trigger Enabled** setting.
44+
* You can configure Stacks to use either a branch or tag-based workflow.
45+
* By default, HCP Terraform fetches your stack’s configuration after creating your Stack. To fetch your Stack configuration manually, uncheck **Fetch configuration after HCP Terraform creates stack.**
46+
1. Click **Create Stack**.
47+
48+
## Next steps
49+
50+
After creating your Stack, you can continue to iterate on your configuration and [review configuration versions](/terraform/cloud-docs/stacks/deploy/configuration-versions) or learn how to [review your Stack’s deployment plans](/terraform/cloud-docs/stacks/deploy/plans).
51+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
---
2+
page_title: Fetch and review configuration versions
3+
description: Learn how to fetch and review configuration versions for your Stacks in HCP Terraform.
4+
tfc_only: true
5+
---
6+
7+
# Fetch and review configuration versions
8+
9+
Stacks automatically detect when you push changes to your configuration from your VCS-linked repository. Every time you push changes to your repository, HCP Terraform automatically fetches your configuration and creates a new configuration version.
10+
11+
Whether automatic or manual, every time HCP Terraform fetches a new version of your configuration file, it creates a new configuration version, whether you made changes to that file or not. HCP Terraform uses a new configuration version to [plan](/terraform/cloud-docs/stacks/deploy/plans) how that configuration version would affect each of your deployments.
12+
13+
This guide explains creating and reviewing new configuration versions in HCP Terraform.
14+
15+
## Requirements
16+
17+
To view a Stack and its configurations, you must also be a member of a team in your organization with one of the following permissions:
18+
* [Organization-level **Manage all projects**](/terraform/cloud-docs/users-teams-organizations/permissions#manage-all-projects)
19+
* [Project-level **Maintain**](/terraform/cloud-docs/users-teams-organizations/permissions#read) or higher
20+
21+
## Create configuration versions
22+
23+
Stacks automatically detect when you push changes to your configuration from your VCS-linked repository. Every time you push changes to your repository, HCP Terraform automatically fetches your configuration and creates a new configuration version.
24+
25+
Whether automatic or manual, every time HCP Terraform fetches a new version of your configuration file, it creates a new configuration version, whether you made changes to that file or not.
26+
27+
HCP Terraform then creates a new plan to roll out that new configuration version to your deployments. Learn more about [reviewing and approving deployment plans](/terraform/cloud-docs/stacks/deploy/plans).
28+
29+
### Manually fetch new configurations
30+
31+
If you are not already on your Stack’s deployment page, navigate to it:
32+
33+
1. In the navigation menu, click **Projects** under **Manage**.
34+
1. Select the project containing your Stack.
35+
1. Click **Stacks** in the navigation menu.
36+
1. Select the Stack you want to review.
37+
38+
Stacks automatically detect when you push changes to your configuration from your VCS-linked repository. Every time you push changes to your repository, HCP Terraform automatically fetches your configuration and creates a new configuration version.
39+
40+
If something changes outside of your configuration, you can fetch your configuration manually by clicking **Fetch Configurations from VCS** on a Stack’s **Overview** page or clicking **Fetch configuration** on a Stack’s **Configurations** page. For example, if someone changes resources directly in the AWS console, you can manually fetch your configuration to update your Stack.
41+
42+
## Review configurations
43+
44+
To review your configuration versions, click **Configurations** in the side navigation menu of your Stack.
45+
46+
The **Configurations** page lists the available configuration versions of your Stack. The top-level dashboard lists your configurations and the percentage of deployments that use each configuration version.
47+
48+
Clicking on an individual configuration version reveals more details, including:
49+
50+
* The ID of the configuration version.
51+
* The latest commit that HCP Terraform based this configuration version on.
52+
* The deployments using this configuration version.
53+
* The corresponding plans for each deployment, along with what triggered each plan. Clicking **Quick View** next to a plan lists the differences introduced in that plan.
54+
55+
You can use the **Deployment** filter to filter by deployment name or the **Status** filter to filter by plan status.
56+
57+
### Download configuration data
58+
59+
You can download configuration data from a Stack so you can debug and analyze how your Stack changes over time.
60+
61+
Select one of the following options in the **Inspect** drop-down to download specific information about your configuration:
62+
63+
* **Configuration event stream** downloads a log file of your configuration’s events.
64+
* **Provider schemas** downloads the schema of the providers of your configuration version.
65+
* **Source bundle** downloads the files that HCP Terraform built this configuration version.
66+
67+
## Next steps
68+
69+
The overview page for each Stack contains a chart of a Stack's configuration version and its respective deployment. You can [approve or discard deployment plans](/terraform/cloud-docs/stacks/deploy/plans) to manage your deployments.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
---
2+
page_title: Review deployment plans
3+
description: Learn how to review deployment plans in HCP Terraform Stacks.
4+
tfc_only: true
5+
---
6+
7+
# Review deployment plans
8+
9+
Deployment plans are a combination of an individual configuration version and one of your stack’s deployments. As in the traditional Terraform workflow, HCP Terraform creates plans every time a new configuration version introduces potential changes for a deployment.
10+
11+
This guide explains how to review and approve deployment plans in HCP Terraform.
12+
13+
## Requirements
14+
15+
To view a Stack and its plans, you must also be a member of a team in your organization with one of the following permissions:
16+
* [Organization-level **View all projects**](/terraform/cloud-docs/users-teams-organizations/permissions#view-all-projects) or higher
17+
* [Project-level **Write**](/terraform/cloud-docs/users-teams-organizations/permissions#write) or higher
18+
19+
## View a deployment
20+
21+
If you are not already on your stack’s deployment page, navigate to it:
22+
23+
1. In the navigation menu, click **Projects** under **Manage**.
24+
1. Select the project containing your Stack.
25+
1. Click **Stacks** in the navigation menu.
26+
1. Select the Stack you want to review.
27+
28+
A stack’s **Overview** page displays the following information:
29+
30+
* The number of your stack’s components and deployments
31+
* Your deployment’s current [health](#check-deployment-health)
32+
* The latest configuration version
33+
* A chart listing each deployment’s recent configuration versions
34+
35+
To view all of the plans for a deployment, click the name of the deployment you want to review.
36+
37+
A deployment’s page lists its components and the last five deployment plans. Clicking on a component reveals all of the resources it contains. Opening the **Inspect** dropdown menu on a deployment's page reveals the option to download:
38+
39+
* **State description** downloads that deployment’s current state.
40+
* **Provider schemas** downloads the schema of the providers of your deployment.
41+
42+
### View plans
43+
44+
A Stack deployment can have multiple plans. In a deployment's page, underneath **Latest plans**, each deployment plan lists:
45+
46+
* The plan name
47+
* The trigger why HCP Terraform created this plan
48+
* The configuration version HCP Terraform created the plan with
49+
* When HCP Terraform created the plan
50+
51+
You can see a plan’s full details by clicking the plan’s name or an abbreviated list of the plan’s changes by clicking **Quick View**. You can also click **View all plans** to display a list of all the plans for this deployment. You can filter plans by [health status](#check-deployment-health) in the list of all plans.
52+
53+
Each plan includes a timeline detailing when the plan started, when it received its configuration version, and when it was approved.
54+
55+
### Check deployment health
56+
57+
Click **Overview** in the sidebar of your Stack to view the status of each of your deployments.
58+
59+
| Status | Description |
60+
| :---- | :---- |
61+
| Healthy | HCP Terraform is not applying this deployment, no plans await approval, and no diagnostic alerts exist. |
62+
| Deploying | A plan is approved, and HCP Terraform is applying it. |
63+
| Plans waiting for approval | HCP Terraform created a plan successfully and is waiting for approval. |
64+
| Error diagnostics | The deployment has error diagnostic alerts. You can review these errors in |
65+
| Warning diagnostics | The deployment has warning diagnostic alerts. |
66+
67+
68+
## Download plan data
69+
70+
You can download Stack plan data to debug and analyze how your Stack changes over time.
71+
72+
Select one of the following options in the **Inspect** drop-down to perform the associated action:
73+
74+
* **View plan orchestration results** displays HCP Terraform's decisions while making this plan.
75+
* **Download plan event stream** downloads a log file of your plan’s events.
76+
* **Download plan description** downloads a file with all plan information.
77+
* **View apply orchestration results** displays HCP Terraform's decisions to apply this plan.
78+
* **Download apply event stream** downloads a log file of your plan’s events.
79+
* **Download apply description** downloads a file with all the information about this applied plan.
80+
81+
## Approve plans
82+
83+
Like traditional Terraform plans, Stack deployment plans list the changes that will occur if you approve that plan. Each component lists its expected resource changes, and you can review those changes as you decide whether to apply a plan.
84+
85+
When viewing a deployment plan, HCP Terraform notes if that plan is awaiting approval. Click **Approve plan** if you want HCP Terraform to apply a plan to this deployment or **Discard plan** to ignore it. You manage each deployment independently, so any plans you approve only affect the current deployment you are interacting with.
86+
87+
### Convergence checks
88+
89+
After applying any plan, HCP Terraform automatically triggers a plan called a convergence check. A convergence check is a re-plan to ensure components do not have any [deferred changes](#deferred-changes). HCP Terraform continues to trigger new plans until the convergence check returns a plan that does not contain changes.
90+
91+
By default, each Stack has an `auto-approve` rule named `empty_plan`, which auto-approves a plan if it does not contain changes. When a convergence check contains no changes, HCP Terraform auto-applies that plan.
92+
93+
## Deferred changes
94+
95+
Like with Terraform configuration files, HCP Terraform generates a dependency graph and creates resources defined in `*.tfstack.hcl` and `*.tfdeploy.hcl` files.
96+
97+
When you deploy a Stack with resources that depend on resources provisioned by other components in your stack, HCP Terraform recognizes the dependency between components and automatically defers that plan until HCP Terraform can complete it successfully. Plans with deferred changes are plans with resources that depend on resources that don't exist yet, requiring follow-up plans.
98+
99+
-> **Hands-on**: Complete the [Manage Kubernetes workloads with stacks](/terraform/tutorials/cloud/stacks-eks-deferred) tutorial to create plans with deferred changes.
100+
101+
HCP Terraform notifies you in the UI if a plan contains deferred changes. Approving a plan with deferred changes makes HCP Terraform automatically create a follow-up plan to properly set up resources in the order of operations those resources require.
102+
103+
After applying a plan with deferred changes, HCP Terraform notifies you of any replans it creates with a link to **View replan**. You can review the replan to ensure HCP Terraform created your resources as expected.

0 commit comments

Comments
 (0)