Skip to content

Commit 53cb9cd

Browse files
Merge branch 'main' into harshitchaudhary94/TF-30688-1-0-2-patch-release-notes
2 parents 5502bae + 8d5e9af commit 53cb9cd

File tree

3 files changed

+169
-34
lines changed

3 files changed

+169
-34
lines changed

.github/workflows/create-ga-pr.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: 📁 Create GA PR
2+
run-name: Create GA PR [${{ github.actor }}]
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
on:
9+
workflow_dispatch:
10+
inputs:
11+
targetVersion:
12+
required: true
13+
description: Preview version (e.g., "1.21.x")
14+
default: ''
15+
folderTag:
16+
required: true
17+
default: ''
18+
description: Preview dog tag (e.g., 'rc' or 'beta')
19+
product:
20+
required: true
21+
default: ''
22+
description: Product slug (e.g., 'vault')
23+
24+
env:
25+
prBranch: "${{ github.event.inputs.product }}/${{ github.event.inputs.targetVersion }}-to-ga"
26+
oldFolder: "v${{ github.event.inputs.targetVersion }} (${{ github.event.inputs.folderTag }})"
27+
newFolder: "v${{ github.event.inputs.targetVersion }}"
28+
29+
30+
jobs:
31+
32+
update-folder:
33+
runs-on: ubuntu-latest
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
steps:
37+
- name: Check out main
38+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
39+
with:
40+
fetch-depth: 0
41+
- name: Configure Git User
42+
run: |
43+
git config user.name "GitHub Actions"
44+
git config user.email "team-rel-eng@hashicorp.com"
45+
- name: Update preview folder
46+
working-directory: ./content/${{ github.event.inputs.product }}
47+
run: |
48+
git pull origin main
49+
git checkout -B "${{ env.prBranch }}"
50+
mv "./${{ env.oldFolder }}" "./${{ env.newFolder }}"
51+
git add .
52+
git commit -m "Rename ${{ env.oldFolder }}"
53+
git push --force -u origin "${{ env.prBranch }}"
54+
55+
create-pr:
56+
runs-on: ubuntu-latest
57+
env:
58+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59+
prTitle: "[PUBLISH GA] Convert ${{ github.event.inputs.targetVersion }} to GA"
60+
prBody: |
61+
🚧 \`${{ github.repository }}\` publication PR
62+
63+
**Triggered by**: @${{ github.actor }} with a Github action
64+
**Preview folder**: \`${{ github.event.inputs.product }}/v${{ github.event.inputs.targetVersion }} (${{ github.event.inputs.folderTag }})\`
65+
**New folder**: \`${{ github.event.inputs.product }}/v${{ github.event.inputs.targetVersion }}\`
66+
steps:
67+
- name: Check out repository code
68+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
69+
with:
70+
ref: ${{ env.prBranch }}
71+
fetch-depth: 0
72+
- name: Create pull request
73+
run: |
74+
gh pr create \
75+
--base main \
76+
--head ${{ env.prBranch }} \
77+
--title "${{ env.prTitle }}" \
78+
--body "${{ env.prBody }}"
79+
- name: Wrap-up
80+
run: |
81+
echo "🍏 Final job status: ${{ job.status }}"

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

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ Stacks are made up of components, and each component includes a Terraform module
1010

1111
## Add components
1212

13-
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. You must specify the source module, inputs, and providers for each component. To learn more about the `component` refer to the [`component` block reference](/terraform/language/block/stack/tfcomponent/component).
13+
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. When you define a `component` block, you specify the module that component sources its configuration from, any input variables the module requires, and provider configurations.
14+
15+
To learn more about the `component` refer to the [`component` block reference](/terraform/language/block/stack/tfcomponent/component).
1416

1517
## Remove components
1618

17-
Stacks take a systematic approach to removing components from your configuration. You must use a dedicated `removed` block in your component configuration to ensure Terraform can properly remove your component and the resources associated with that component.
19+
Stacks take a systematic approach to removing components from your configuration. To remove a component from your Stack, you must do the following:
20+
1. Delete the `component` block for the component you want to remove.
21+
1. Add a `removed` block specifying the component you want to remove.
22+
1. Push your configuration changes to HCP Terraform and apply the changes to your Stack.
23+
24+
In the `removed` block, you specify the component you want to remove, the module that component sources, and that component's provider configurations. Specifying all of a component's details ensures that Terraform can properly destroy all the resources associated with that component.
1825

19-
To remove a component, add a `removed` block to your component configuration specifying the component you want to remove. For example, if you want to remove the following `database` component:
26+
For example, if you want to remove the following `database` component:
2027

2128
<CodeBlockConfig filename="component.tfcomponent.hcl">
2229

@@ -35,44 +42,64 @@ component "database" {
3542
```
3643
</CodeBlockConfig>
3744

38-
You add a `removed` block that specifies the component to remove, module that component sources, and the providers that component uses. The `removed` block also tells Terraform to destroy the resources managed by a component.
45+
Add a `removed` block that specifies the component to remove, the module that component sources, and the providers that component uses.
3946

4047
<TIP>
4148

4249
Do not remove providers from your component configuration without first removing the components that require those providers. Terraform requires a component's providers to ensure it can successfully remove that component.
4350

4451
</TIP>
4552

46-
In the following example, Terraform removes the `database` component that sources from `./modules/database` and uses the `aws.main` provider:
53+
The following example deletes the `database` component block and adds a `removed` block to tell Terraform to remove that component from your Stack:
4754

4855
```hcl
49-
component "database" {
56+
removed {
5057
source = "./modules/database"
58+
from = component.database
5159
52-
inputs = {
53-
instance_class = "db.t3.micro"
60+
providers = {
61+
aws = provider.aws.main
5462
}
63+
}
64+
```
65+
66+
After you apply the configuration in HCP Terraform, Terraform removes the `database` component and its resources from the associated Stack deployments. You can then delete the `removed` block from your component configuration file.
67+
68+
### Remove multiple components
69+
70+
If your `component` block uses the `for_each` meta-argument to define multiple components, use the `for_each` meta-argument in a `removed` block to let Terraform destroy multiple component instances. Using `for_each` in a `removed` block lets you remove all of the instances of a component, or a subset of those instances.
71+
72+
To remove all of the instances of a component, duplicate the same `for_each` expression in the `removed` block that you use in the `component` block. For example, to remove all of the instances of `env` components:
73+
74+
```hcl
75+
component "env" {
76+
for_each = ["dev", "staging"]
77+
78+
source = "../local-component"
5579
5680
providers = {
57-
aws = provider.aws.main
81+
#...
5882
}
83+
#...
5984
}
85+
```
6086

87+
Remove the `env` component block and add a `removed` block that uses the same `for_each` expression:
88+
89+
```hcl
6190
removed {
62-
source = "./modules/database"
63-
from = component.database
91+
for_each = ["dev", "staging"]
92+
from = component.env[each.key]
6493
6594
providers = {
66-
aws = provider.aws.main
95+
#...
6796
}
6897
}
6998
```
7099

71-
After you apply the configuration in HCP Terraform, Terraform removes the `database` component and its resources from the associated Stack deployments. You can then remove both the `component` block and the `removed` block from your component configuration file.
72-
73-
If your `component` block uses the `for_each` meta-argument to define multiple components, you can define a `removed` block with the `for_each` meta-argument to ensure Terraform destroys each component instance.
100+
After you apply the configuration in HCP Terraform, Terraform removes all of the instances of the `env` component and its resources from the associated Stack deployments. You can then delete the `removed` block from your component configuration file.
74101

75-
In the following example, the `removed` block iterates through `local.deprecated_components` to remove the `staging` components and corresponding resources:
102+
If you want to remove a subset of component instances, you must keep the `component` block that defines the instances you want to keep. In the following example, the `removed` block iterates through `local.deprecated_components` to remove the `staging` components and corresponding resources:
76103

77104
```hcl
78105
locals {
@@ -101,7 +128,7 @@ removed {
101128
}
102129
```
103130

104-
In the above example, you can delete a component by removing it from the `local.components` list and adding it to the `local.removed_components` list.
131+
After you apply the configuration in HCP Terraform, Terraform removes the `staging` component but the `dev` and `prod` components remain in your Stack. You can additionally delete more components by removing them from the `local.components` list and adding them to the `local.removed_components` list.
105132

106133
## Manage resources
107134

content/terraform/v1.14.x (beta)/docs/language/stacks/component/manage.mdx

Lines changed: 44 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,20 @@ Stacks are made up of components, and each component includes a Terraform module
1010

1111
## Add components
1212

13-
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. You must specify the source module, inputs, and providers for each component. To learn more about the `component` refer to the [`component` block reference](/terraform/language/block/stack/tfcomponent/component).
13+
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. When you define a `component` block, you specify the module that component sources its configuration from, any input variables the module requires, and provider configurations.
14+
15+
To learn more about the `component` refer to the [`component` block reference](/terraform/language/block/stack/tfcomponent/component).
1416

1517
## Remove components
1618

17-
Stacks take a systematic approach to removing components from your configuration. You must use a dedicated `removed` block in your component configuration to ensure Terraform can properly remove your component and the resources associated with that component.
19+
Stacks take a systematic approach to removing components from your configuration. To remove a component from your Stack, you must do the following:
20+
1. Delete the `component` block for the component you want to remove.
21+
1. Add a `removed` block specifying the component you want to remove.
22+
1. Push your configuration changes to HCP Terraform and apply the changes to your Stack.
23+
24+
In the `removed` block, you specify the component you want to remove, the module that component sources, and that component's provider configurations. Specifying all of a component's details ensures that Terraform can properly destroy all the resources associated with that component.
1825

19-
To remove a component, add a `removed` block to your component configuration specifying the component you want to remove. For example, if you want to remove the following `database` component:
26+
For example, if you want to remove the following `database` component:
2027

2128
<CodeBlockConfig filename="component.tfcomponent.hcl">
2229

@@ -35,44 +42,64 @@ component "database" {
3542
```
3643
</CodeBlockConfig>
3744

38-
You add a `removed` block that specifies the component to remove, module that component sources, and the providers that component uses. The `removed` block also tells Terraform to destroy the resources managed by a component.
45+
Add a `removed` block that specifies the component to remove, the module that component sources, and the providers that component uses.
3946

4047
<TIP>
4148

4249
Do not remove providers from your component configuration without first removing the components that require those providers. Terraform requires a component's providers to ensure it can successfully remove that component.
4350

4451
</TIP>
4552

46-
In the following example, Terraform removes the `database` component that sources from `./modules/database` and uses the `aws.main` provider:
53+
The following example deletes the `database` component block and adds a `removed` block to tell Terraform to remove that component from your Stack:
4754

4855
```hcl
49-
component "database" {
56+
removed {
5057
source = "./modules/database"
58+
from = component.database
5159
52-
inputs = {
53-
instance_class = "db.t3.micro"
60+
providers = {
61+
aws = provider.aws.main
5462
}
63+
}
64+
```
65+
66+
After you apply the configuration in HCP Terraform, Terraform removes the `database` component and its resources from the associated Stack deployments. You can then delete the `removed` block from your component configuration file.
67+
68+
### Remove multiple components
69+
70+
If your `component` block uses the `for_each` meta-argument to define multiple components, use the `for_each` meta-argument in a `removed` block to let Terraform destroy multiple component instances. Using `for_each` in a `removed` block lets you remove all of the instances of a component, or a subset of those instances.
71+
72+
To remove all of the instances of a component, duplicate the same `for_each` expression in the `removed` block that you use in the `component` block. For example, to remove all of the instances of `env` components:
73+
74+
```hcl
75+
component "env" {
76+
for_each = ["dev", "staging"]
77+
78+
source = "../local-component"
5579
5680
providers = {
57-
aws = provider.aws.main
81+
#...
5882
}
83+
#...
5984
}
85+
```
6086

87+
Remove the `env` component block and add a `removed` block that uses the same `for_each` expression:
88+
89+
```hcl
6190
removed {
62-
source = "./modules/database"
63-
from = component.database
91+
for_each = ["dev", "staging"]
92+
from = component.env[each.key]
6493
6594
providers = {
66-
aws = provider.aws.main
95+
#...
6796
}
6897
}
6998
```
7099

71-
After you apply the configuration in HCP Terraform, Terraform removes the `database` component and its resources from the associated Stack deployments. You can then remove both the `component` block and the `removed` block from your component configuration file.
72-
73-
If your `component` block uses the `for_each` meta-argument to define multiple components, you can define a `removed` block with the `for_each` meta-argument to ensure Terraform destroys each component instance.
100+
After you apply the configuration in HCP Terraform, Terraform removes all of the instances of the `env` component and its resources from the associated Stack deployments. You can then delete the `removed` block from your component configuration file.
74101

75-
In the following example, the `removed` block iterates through `local.deprecated_components` to remove the `staging` components and corresponding resources:
102+
If you want to remove a subset of component instances, you must keep the `component` block that defines the instances you want to keep. In the following example, the `removed` block iterates through `local.deprecated_components` to remove the `staging` components and corresponding resources:
76103

77104
```hcl
78105
locals {
@@ -101,7 +128,7 @@ removed {
101128
}
102129
```
103130

104-
In the above example, you can delete a component by removing it from the `local.components` list and adding it to the `local.removed_components` list.
131+
After you apply the configuration in HCP Terraform, Terraform removes the `staging` component but the `dev` and `prod` components remain in your Stack. You can additionally delete more components by removing them from the `local.components` list and adding them to the `local.removed_components` list.
105132

106133
## Manage resources
107134

0 commit comments

Comments
 (0)