You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For "snowflake_grant_privileges_to_role" the resource ID is not changed when replacing grants, so an update-in-place is applied instead of a destroy then create.
#2072
Closed
Arnellluke opened this issue
Sep 25, 2023
· 6 comments
Describe the bug
When changing the values of "on_account_object" in "snowflake_grant_privileges_to_role" to a new value,
(for instance replacing "test_db" with "test_db1"). The ID of the resource is not changed, so terraform is updating-in-place instead of destroying the original grant and replacing with the new one.
However as Terraform does Destroy, Create, Update in that order when it gets to Update, the object no longer exists and the apply fails.
Existing Terraform State.
create_database: "test_db"
create role: "test_role"
grant_privileges_to_role: "test_db" to "test_role"
Changes made: renamed database from "test_db" to "test_db1"
Hey, @imre-kerr-sb1@Arnellluke this may be caused by the fact that the object_type and object_name fields are not marked as `ForceNew (and they probably should be because after changing their values Terraform will perform delete -> create operations on the resource, which should solve this issue). I'm currently working on re-designing / designing grant resources / data sources and in the new design I have this as a ForceNew, so we should soon go into implementing those new designs and the issue should be solved :)
Provider Version
0.71.0
Terraform Version
v1.5.7
Describe the bug
When changing the values of "on_account_object" in "snowflake_grant_privileges_to_role" to a new value,
(for instance replacing "test_db" with "test_db1"). The ID of the resource is not changed, so terraform is updating-in-place instead of destroying the original grant and replacing with the new one.
However as Terraform does Destroy, Create, Update in that order when it gets to Update, the object no longer exists and the apply fails.
Existing Terraform State.
Changes made: renamed database from "test_db" to "test_db1"
Apply fails as "test_db" no longer exists.
(Our workaround is to use Lifecycle: replace_triggered_by but this is not compatible with modules)
Expected behavior
Code samples and commands
The text was updated successfully, but these errors were encountered: