Skip to content

Commit

Permalink
website: Additional terraform.InstanceState and resource.Retry clarif…
Browse files Browse the repository at this point in the history
…ications in migration guide (#251)

These items came up during an official provider migration which:

- Implemented terraform-plugin-sdk based resource with state migrations and covering unit testing that needed to remain.
- Had not migrated `resource.Retry` to `resource.RetryContext` yet, so needed the extra entry
  • Loading branch information
bflad authored Dec 19, 2023
1 parent b4bd223 commit a4dd140
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions website/docs/plugin/testing/migrating.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,16 @@ Change all instances of the following Go import statements in `*_test.go` files:
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource` | `github.com/hashicorp/terraform-plugin-testing/helper/resource` |
| `github.com/hashicorp/terraform-plugin-sdk/v2/terraform` | `github.com/hashicorp/terraform-plugin-testing/terraform` |

If the provider implements terraform-plugin-sdk based state migration unit testing with `github.com/hashicorp/terraform-plugin-sdk/v2/terraform.InstanceState`, this must remain with the original import since it is testing terraform-plugin-sdk functionality.

Change all instances of the following in **non-test** `*.go` files:

| Original Reference | Migrated Reference |
|---|---|
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.NonRetryableError` | `github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.NonRetryableError` |
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.NotFoundError` | `github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.NotFoundError` |
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.PrefixedUniqueId` | `github.com/hashicorp/terraform-plugin-sdk/v2/helper/id.PrefixedUniqueId` |
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.Retry` | `github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.Retry` |
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.RetryableError` | `github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.RetryableError` |
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.RetryContext` | `github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.RetryContext` |
| `github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource.RetryError` | `github.com/hashicorp/terraform-plugin-sdk/v2/helper/retry.RetryError` |
Expand Down

0 comments on commit a4dd140

Please sign in to comment.