-
Notifications
You must be signed in to change notification settings - Fork 427
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
[Bug]: migrating snowflake_user to snowflake_service_user forces recreation #3216
Comments
Hey 👋 |
Hey @jrobison-sb |
Hey @jrobison-sb |
Hi @sfc-gh-jcieslak, I'll come back to this next week and let you know how it went. Thanks. |
@sfc-gh-jcieslak, your suggestion of But as part of pushing ahead with this, I ran into another related problem with migrating to the new I need to migrate from the old resource type to the new resource type, like this:
So I do the usual resource migration dance mentioned here, and also mentioned elsewhere in the migration guide:
The above works fine and the new resource type imports successfully. But during the import, terraform presumably has no way to import the existing password, so on a subsequent
And if I go ahead and apply the above change, then I run into this error because apparently the password doesn't comply with a password policy which never applied to the old resource but apparently now does apply to the new resource?
And even if the password had the desired uppercase (or whatever) characters, password re-use would also presumably be blocked. I know I could use Usually I would expect a migration like this to take place entirely within the terraform state and without any affect to our applications, but apparently that's not how this is playing out. Thanks for any thoughts on this. |
Yeah, importing passwords is not easy due to limitations in Terraform SDK and Snowflake output (passwords are not returned in commands like SHOW and DESC). The current workaround done by the provider is to set the password again after the import. |
Thanks for your thoughts on this @sfc-gh-jcieslak. You've been very helpful on this migration, and on a few others I've been doing over the past couple months or so. Thanks. Though I still wish that Snowflake as a company wouldn't force changes like this on its users without providing a better migration path. I ended up unblocking myself by way of Anyway, in case anybody else finds themselves in the same spot, here is basically how I did the migration (with no warranty implied, this is potentially dangerous, YMMV): HCL:
Migration:
And in case your users use a If you mess up any of this is some way, you can try to roll back by way of:
|
Hey, sorry to hear that. |
Terraform CLI Version
v1.9.1
Terraform Provider Version
v0.98.0
Company Name
No response
Terraform Configuration
Category
category:import
Object type(s)
resource:user
Expected Behavior
I should be able to migrate the old way of using
snowflake_user
to the new way of usingsnowflake_service_user
by way ofterraform state rm && terraform import
, and the end result should be 0terraform plan
diffs, 0 resource recreations, and 0 effect on the deployed resources. The only changes should be entirely within the HCL and the terraform state.Actual Behavior
Steps to Reproduce
terraform state rm
the old resource to delete it from the state to start the migrationterraform import
the new resource to import it into state to finish the migrationterraform plan
to see the diffs and see that your new resource will be re-created, defeating the purpose of the migration.How much impact is this issue causing?
Medium
Logs
No response
Additional Information
I see the same behavior when migration from
snowflake_user
tosnowflake_legacy_service_user
too.Using
jq
to inspect my state file from prior to this migration, I see"user_type": ""
as one of the attributes.#3119
Would you like to implement a fix?
The text was updated successfully, but these errors were encountered: