Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for the moved block #1411

Closed
sfc-gh-jcieslak opened this issue Jan 17, 2025 · 3 comments
Closed

Support for the moved block #1411

sfc-gh-jcieslak opened this issue Jan 17, 2025 · 3 comments
Labels
enhancement New feature or request terraform-plugin-framework Resolved in terraform-plugin-framework

Comments

@sfc-gh-jcieslak
Copy link

SDK version

This is our current version, but I guess this proposes an improvement that can be added in the later versions.

github.com/hashicorp/terraform-plugin-sdk/v2 v2.33.0

Use-cases

My team and I are developing a provider (Snowflake Terraform Provider) that, in recent versions, contains many migrations between old deprecated resources and their new counterparts. This is very frustrating for our customers and for us because there's no easy option to help them with the use of SDK.
We had a lot of questions about utilizing the moved block to somehow support the migration, but as we checked this feature is only available in the new plugin framework. Some day, we would like to move to the plugin framework, but until that, we have to support the current migration.
Would it be possible to bring in the moved block to the SDKv2?
If not, are there any better alternatives than removing the state from the old resource and importing the new one?

Attempted Solutions

As far as we know, the SDK is pretty limited in that area. The only thing we were able to find was put into our migration guide, which basically suggests removing the state of the deprecated resource and importing the new one.

Proposal

We are not familiar with the SDK's implementation details, so we need a little help in this one.

References

-

@austinvalle
Copy link
Member

Hey there @sfc-gh-jcieslak 👋🏻 ,

Apologies, but there currently aren't any plans to introduce support for moving across resource types (which is tied to the new MoveResourceState RPC) in the legacy terraform-plugin-sdk/v2 Go module. All managed resources (regardless of SDK implementation) can be referenced in a moved block as long as the resource types are the same, but moving across resource types is a relatively small/new feature so it is only supported in terraform-plugin-framework: https://developer.hashicorp.com/terraform/plugin/framework/resources/state-move

terraform-plugin-sdk/v2 is not deprecated ATM, but the majority of our resources go into introducing support for new features in terraform-plugin-framework, only introducing new features in SDKv2 where it's unavoidable.

@austinvalle austinvalle closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025
@austinvalle austinvalle added the terraform-plugin-framework Resolved in terraform-plugin-framework label Jan 17, 2025
@sfc-gh-jcieslak
Copy link
Author

Hey @austinvalle 👋
Thanks for the explanation. We are more interested in providing support for moving resources between different types (e.g. function to the newly introduced java_function resource). Could you confirm that there's no option for such migrations other than removing resources from the state and importing them as other types? I posted our migration guide and saw in other providers that the same migrations are recommended (e.g. azure guide), but I'm asking just to be sure there's no other alternative.

@austinvalle
Copy link
Member

austinvalle commented Jan 24, 2025

Yeah that is the only option I can think of if migrating the resource to terraform-plugin-framework is off the table (removing from state and then importing).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request terraform-plugin-framework Resolved in terraform-plugin-framework
Projects
None yet
Development

No branches or pull requests

2 participants