Skip to content

Commit 1f8ade8

Browse files
yorinasub17rhoboat
andauthored
Add new step in terraform 13 upgrade guide mentioning need to replace provider (#282)
* Add new step in terraform 13 upgrade guide mentioning need to replace provider * Run local regen * Apply suggestions from code review Co-authored-by: Rho <[email protected]> * Regen Co-authored-by: Rho <[email protected]>
1 parent 8db1a61 commit 1f8ade8

File tree

9 files changed

+78
-28
lines changed

9 files changed

+78
-28
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
sidebar_label: Update provider sources
3+
---
4+
5+
# Step 4: update provider sources to the new format
6+
7+
Terraform 0.13 introduced a new registry for managing provider releases. This makes it easier to publish and distribute
8+
third party providers. As a part of this, Terraform changed the way providers are tracked in the state file. When
9+
running `terraform init` for the first time on a module that has been updated from <0.13 to 0.13+, you might notice
10+
Terraform installing two providers:
11+
12+
- `-/PROVIDER`
13+
- `hashicorp/PROVIDER`
14+
15+
The first one is used to track legacy provider sources that are mentioned in the old state file, while the latter is
16+
what is configured in your module using the new `required_providers` blocks when you upgraded your modules in step 2.
17+
18+
To avoid conflict between the two providers, it is recommended to update your state file to use the new provider
19+
references. This can be done by using the `state replace-provider` command.
20+
21+
For each provider your module uses, run the following command:
22+
23+
```
24+
# NOTE: Use terragrunt instead of terraform if you are using terragrunt to manage your resources.
25+
terraform state replace-provider -- -/PROVIDER registry.terraform.io/hashicorp/PROVIDER
26+
```
27+
28+
For example, if your module uses `null` and `aws` providers, you will want to run:
29+
30+
```
31+
terraform state replace-provider -- -/null registry.terraform.io/hashicorp/null
32+
terraform state replace-provider -- -/aws registry.terraform.io/hashicorp/aws
33+
```

docs/guides/stay-up-to-date/index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,5 @@ href="/guides/stay-up-to-date/terraform/terraform-1.1"
7676

7777

7878
<!-- ##DOCS-SOURCER-START
79-
{
80-
"sourcePlugin": "local-copier",
81-
"hash": "6108197b36342bbac59c8d32d9e3dfbb"
82-
}
79+
{"sourcePlugin":"local-copier","hash":"6108197b36342bbac59c8d32d9e3dfbb"}
8380
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/terraform/terraform-1.1/core-concepts.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,5 @@ post](https://www.hashicorp.com/blog/terraform-1-1-improves-refactoring-and-the-
1313

1414

1515
<!-- ##DOCS-SOURCER-START
16-
{
17-
"sourcePlugin": "local-copier",
18-
"hash": "49defa1819542396936b1f0481640f93"
19-
}
16+
{"sourcePlugin":"local-copier","hash":"49defa1819542396936b1f0481640f93"}
2017
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/terraform/terraform-1.1/deployment-walkthrough/step-1-update-your-code-to-be-compatible-with-terraform-1-x.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,5 @@ If you haven’t already, you need to:
3030

3131

3232
<!-- ##DOCS-SOURCER-START
33-
{
34-
"sourcePlugin": "local-copier",
35-
"hash": "901f5f12726f3f8ebba1f5058c1e957a"
36-
}
33+
{"sourcePlugin":"local-copier","hash":"901f5f12726f3f8ebba1f5058c1e957a"}
3734
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/terraform/terraform-1.1/deployment-walkthrough/step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,5 @@ and the respective versions that are compatible with Terraform 1.1:
140140

141141

142142
<!-- ##DOCS-SOURCER-START
143-
{
144-
"sourcePlugin": "local-copier",
145-
"hash": "2b2b98d7e75d84cb9b1df09cf54a734e"
146-
}
143+
{"sourcePlugin":"local-copier","hash":"2b2b98d7e75d84cb9b1df09cf54a734e"}
147144
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/terraform/terraform-1.1/index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,5 @@ tag is compatible with Terraform 1.1.
2727

2828

2929
<!-- ##DOCS-SOURCER-START
30-
{
31-
"sourcePlugin": "local-copier",
32-
"hash": "de75607ce00354136cfc3f917a2f047b"
33-
}
30+
{"sourcePlugin":"local-copier","hash":"de75607ce00354136cfc3f917a2f047b"}
3431
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/terraform/terraform-1.x/core-concepts.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,5 @@ notes](https://github.com/hashicorp/terraform/releases/tag/v1.0.0):
2121
2222

2323
<!-- ##DOCS-SOURCER-START
24-
{
25-
"sourcePlugin": "local-copier",
26-
"hash": "ee2c203478dfbf3301d71f56df87cb65"
27-
}
24+
{"sourcePlugin":"local-copier","hash":"ee2c203478dfbf3301d71f56df87cb65"}
2825
##DOCS-SOURCER-END -->

docs/guides/stay-up-to-date/terraform/terraform-1.x/index.md

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,5 @@ tag is compatible with Terraform 1.x.
2929

3030

3131
<!-- ##DOCS-SOURCER-START
32-
{
33-
"sourcePlugin": "local-copier",
34-
"hash": "b902a9ed1b8a8c7ee812f8b2588235fa"
35-
}
32+
{"sourcePlugin":"local-copier","hash":"b902a9ed1b8a8c7ee812f8b2588235fa"}
3633
##DOCS-SOURCER-END -->
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
sidebar_label: Update provider sources
3+
---
4+
5+
# Step 4: update provider sources to the new format
6+
7+
Terraform 0.13 introduced a new registry for managing provider releases. This makes it easier to publish and distribute
8+
third party providers. As a part of this, Terraform changed the way providers are tracked in the state file. When
9+
running `terraform init` for the first time on a module that has been updated from <0.13 to 0.13+, you might notice
10+
Terraform installing two providers:
11+
12+
- `-/PROVIDER`
13+
- `hashicorp/PROVIDER`
14+
15+
The first one is used to track legacy provider sources that are mentioned in the old state file, while the latter is
16+
what is configured in your module using the new `required_providers` blocks when you upgraded your modules in step 2.
17+
18+
To avoid conflict between the two providers, it is recommended to update your state file to use the new provider
19+
references. This can be done by using the `state replace-provider` command.
20+
21+
For each provider your module uses, run the following command:
22+
23+
```
24+
# NOTE: Use terragrunt instead of terraform if you are using terragrunt to manage your resources.
25+
terraform state replace-provider -- -/PROVIDER registry.terraform.io/hashicorp/PROVIDER
26+
```
27+
28+
For example, if your module uses `null` and `aws` providers, you will want to run:
29+
30+
```
31+
terraform state replace-provider -- -/null registry.terraform.io/hashicorp/null
32+
terraform state replace-provider -- -/aws registry.terraform.io/hashicorp/aws
33+
```
34+
35+
36+
<!-- ##DOCS-SOURCER-START
37+
{"sourcePlugin":"local-copier","hash":"0c5aa574c82b473c254f163ea660dffa"}
38+
##DOCS-SOURCER-END -->

0 commit comments

Comments
 (0)