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

Renaming role of role_grants resource is causing an error #1590

Closed
Relativity74205 opened this issue Mar 1, 2023 · 2 comments
Closed

Renaming role of role_grants resource is causing an error #1590

Relativity74205 opened this issue Mar 1, 2023 · 2 comments
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@Relativity74205
Copy link
Contributor

Relativity74205 commented Mar 1, 2023

Provider Version

0.57.0

Terraform Version

1.2.9

Describe the bug

When renaming the role which is granted to other roles with the role_grants resource, an error is thrown:

│ Role 'FOO_TEST2' does not exist or not authorized.
│ 
│   with snowflake_role_grants.foo_to_bar,
│   on role_test.tf line 9, in resource "snowflake_role_grants" "foo_to_bar":
│    9: resource "snowflake_role_grants" "foo_to_bar" {

Expected behavior

Role is renamed without error.

Code samples and commands

Setup:

resource "snowflake_role" "foo_test" {
    name = "FOO_TEST2"
}

resource "snowflake_role" "bar_test" {
    name = "BAR_TEST2"
}

resource "snowflake_role_grants" "foo_to_bar" {
    role_name = snowflake_role.foo_test.name
    
    roles = [snowflake_role.bar_test.name]
}

Change name of snowflake_role.foo_test to e.g. "FOO_TEST".

Additional context

The problem is that the role_grants resource is not dropped before the role is renamed. A workaround is using a lifecycle policy, which forces the drop of the role_grants, when the name of the role is changed.

@Relativity74205 Relativity74205 added the bug Used to mark issues with provider's incorrect behavior label Mar 1, 2023
@Relativity74205
Copy link
Contributor Author

I haved created a PR for this issue: #1591

@Relativity74205
Copy link
Contributor Author

closed by #1591

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to mark issues with provider's incorrect behavior
Projects
None yet
Development

No branches or pull requests

1 participant