What's the point of the import step in resource migration? #3003
-
Hello, I have a question about the necessity of the import step in the resource migration guide : Here are the big steps in the guide (with no downtime)
Goals Question In the final migration step, rather than importing the new resources into the state, couldn't we simply run an apply terraform? Since these are I tried this on a test environment and it worked well. The apply command creates the new resources in the terraform state and RBAC model is not modified on Snowflake. Next terraform plan is also ok : So it seems to be transparent for users and I don't understand the point of the import step. Am I missing an important point? Thanks for your help |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @ppo-38. In your case, it should work like you described. It won't work for the objects where the underlying statements are not idempotent. So let's say you are migrating a warehouse, then the underlying command is CREATE, which will fail because the object already exists. That's where import comes in handy. We recommend it as a general route because it works in almost all situations without thinking about the underlying statements. |
Beta Was this translation helpful? Give feedback.
-
HI @sfc-gh-asawicki and thanks for your response ! |
Beta Was this translation helpful? Give feedback.
Hey @ppo-38.
In your case, it should work like you described. It won't work for the objects where the underlying statements are not idempotent. So let's say you are migrating a warehouse, then the underlying command is CREATE, which will fail because the object already exists. That's where import comes in handy. We recommend it as a general route because it works in almost all situations without thinking about the underlying statements.