diff --git a/_docs-sources/guides/stay-up-to-date/terraform/terraform-13/deployment-walkthrough/step-4-update-provider-sources.md b/_docs-sources/guides/stay-up-to-date/terraform/terraform-13/deployment-walkthrough/step-4-update-provider-sources.md new file mode 100644 index 000000000..4b4b62fdd --- /dev/null +++ b/_docs-sources/guides/stay-up-to-date/terraform/terraform-13/deployment-walkthrough/step-4-update-provider-sources.md @@ -0,0 +1,33 @@ +--- +sidebar_label: Update provider sources +--- + +# Step 4: update provider sources to the new format + +Terraform 0.13 introduced a new registry for managing provider releases. This makes it easier to publish and distribute +third party providers. As a part of this, Terraform changed the way providers are tracked in the state file. When +running `terraform init` for the first time on a module that has been updated from <0.13 to 0.13+, you might notice +Terraform installing two providers: + +- `-/PROVIDER` +- `hashicorp/PROVIDER` + +The first one is used to track legacy provider sources that are mentioned in the old state file, while the latter is +what is configured in your module using the new `required_providers` blocks when you upgraded your modules in step 2. + +To avoid conflict between the two providers, it is recommended to update your state file to use the new provider +references. This can be done by using the `state replace-provider` command. + +For each provider your module uses, run the following command: + +``` +# NOTE: Use terragrunt instead of terraform if you are using terragrunt to manage your resources. +terraform state replace-provider -- -/PROVIDER registry.terraform.io/hashicorp/PROVIDER +``` + +For example, if your module uses `null` and `aws` providers, you will want to run: + +``` +terraform state replace-provider -- -/null registry.terraform.io/hashicorp/null +terraform state replace-provider -- -/aws registry.terraform.io/hashicorp/aws +``` diff --git a/docs/guides/stay-up-to-date/index.md b/docs/guides/stay-up-to-date/index.md index 4e9ae9189..f1152a280 100644 --- a/docs/guides/stay-up-to-date/index.md +++ b/docs/guides/stay-up-to-date/index.md @@ -76,8 +76,5 @@ href="/guides/stay-up-to-date/terraform/terraform-1.1" diff --git a/docs/guides/stay-up-to-date/terraform/terraform-1.1/core-concepts.md b/docs/guides/stay-up-to-date/terraform/terraform-1.1/core-concepts.md index 32d3f5723..38d8b8167 100644 --- a/docs/guides/stay-up-to-date/terraform/terraform-1.1/core-concepts.md +++ b/docs/guides/stay-up-to-date/terraform/terraform-1.1/core-concepts.md @@ -13,8 +13,5 @@ post](https://www.hashicorp.com/blog/terraform-1-1-improves-refactoring-and-the- diff --git a/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 b/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 index 9f388f84b..aa7427f6a 100644 --- a/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 +++ b/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 @@ -30,8 +30,5 @@ If you haven’t already, you need to: diff --git a/docs/guides/stay-up-to-date/terraform/terraform-1.1/deployment-walkthrough/step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md b/docs/guides/stay-up-to-date/terraform/terraform-1.1/deployment-walkthrough/step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md index afc4a971c..a9a5ca4d9 100644 --- a/docs/guides/stay-up-to-date/terraform/terraform-1.1/deployment-walkthrough/step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md +++ b/docs/guides/stay-up-to-date/terraform/terraform-1.1/deployment-walkthrough/step-2-update-references-to-the-gruntwork-infrastructure-as-code-library.md @@ -140,8 +140,5 @@ and the respective versions that are compatible with Terraform 1.1: diff --git a/docs/guides/stay-up-to-date/terraform/terraform-1.1/index.md b/docs/guides/stay-up-to-date/terraform/terraform-1.1/index.md index 61f29d24b..fd9099c5c 100644 --- a/docs/guides/stay-up-to-date/terraform/terraform-1.1/index.md +++ b/docs/guides/stay-up-to-date/terraform/terraform-1.1/index.md @@ -27,8 +27,5 @@ tag is compatible with Terraform 1.1. diff --git a/docs/guides/stay-up-to-date/terraform/terraform-1.x/core-concepts.md b/docs/guides/stay-up-to-date/terraform/terraform-1.x/core-concepts.md index 3f00813af..9fb5c502b 100644 --- a/docs/guides/stay-up-to-date/terraform/terraform-1.x/core-concepts.md +++ b/docs/guides/stay-up-to-date/terraform/terraform-1.x/core-concepts.md @@ -21,8 +21,5 @@ notes](https://github.com/hashicorp/terraform/releases/tag/v1.0.0): diff --git a/docs/guides/stay-up-to-date/terraform/terraform-1.x/index.md b/docs/guides/stay-up-to-date/terraform/terraform-1.x/index.md index e2ce43650..ff703f5c2 100644 --- a/docs/guides/stay-up-to-date/terraform/terraform-1.x/index.md +++ b/docs/guides/stay-up-to-date/terraform/terraform-1.x/index.md @@ -29,8 +29,5 @@ tag is compatible with Terraform 1.x. diff --git a/docs/guides/stay-up-to-date/terraform/terraform-13/deployment-walkthrough/step-4-update-provider-sources.md b/docs/guides/stay-up-to-date/terraform/terraform-13/deployment-walkthrough/step-4-update-provider-sources.md new file mode 100644 index 000000000..181f1c215 --- /dev/null +++ b/docs/guides/stay-up-to-date/terraform/terraform-13/deployment-walkthrough/step-4-update-provider-sources.md @@ -0,0 +1,38 @@ +--- +sidebar_label: Update provider sources +--- + +# Step 4: update provider sources to the new format + +Terraform 0.13 introduced a new registry for managing provider releases. This makes it easier to publish and distribute +third party providers. As a part of this, Terraform changed the way providers are tracked in the state file. When +running `terraform init` for the first time on a module that has been updated from <0.13 to 0.13+, you might notice +Terraform installing two providers: + +- `-/PROVIDER` +- `hashicorp/PROVIDER` + +The first one is used to track legacy provider sources that are mentioned in the old state file, while the latter is +what is configured in your module using the new `required_providers` blocks when you upgraded your modules in step 2. + +To avoid conflict between the two providers, it is recommended to update your state file to use the new provider +references. This can be done by using the `state replace-provider` command. + +For each provider your module uses, run the following command: + +``` +# NOTE: Use terragrunt instead of terraform if you are using terragrunt to manage your resources. +terraform state replace-provider -- -/PROVIDER registry.terraform.io/hashicorp/PROVIDER +``` + +For example, if your module uses `null` and `aws` providers, you will want to run: + +``` +terraform state replace-provider -- -/null registry.terraform.io/hashicorp/null +terraform state replace-provider -- -/aws registry.terraform.io/hashicorp/aws +``` + + +