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

terraform import snowflake_role_grants only imports role name #596

Closed
wconti1017 opened this issue Jul 7, 2021 · 4 comments
Closed

terraform import snowflake_role_grants only imports role name #596

wconti1017 opened this issue Jul 7, 2021 · 4 comments
Labels
bug Used to mark issues with provider's incorrect behavior

Comments

@wconti1017
Copy link

Provider Version

0.25.10

Terraform Version

1.0.1

Describe the bug
Given a role (ROLE_NAME) granted to other roles (CHILD_ROLE_1, CHILD_ROLE_2) and other users (USER_1, USER_2).
When using the command terraform import snowflake_role_grants.example ROLE_NAME, the console output says that everything worked fine.
However, when looking at the output of terraform show, only the role name has been imported

# snowflake_role_grants.example:
resource "snowflake_role_grants" "example" {
    id        = "ROLE_NAME"
    role_name = "ROLE_NAME"
    roles     = []
    users     = []
}

Expected behavior

The output of terraform show should be the following :

# snowflake_role_grants.example:
resource "snowflake_role_grants" "example" {
    id        = "ROLE_NAME"
    role_name = "ROLE_NAME"
    roles     = [CHILD_ROLE_1, CHILD_ROLE_2]
    users     = [USER_1, USER_2]
}
@wconti1017 wconti1017 added the bug Used to mark issues with provider's incorrect behavior label Jul 7, 2021
@frosforever
Copy link

If I'm reading this right, I think the bug may be due to #520. Specifically, if we look at roles, https://github.com/chanzuckerberg/terraform-provider-snowflake/blob/e0d74be5029f6bf73915dee07cadd03ac52bf135/pkg/resources/role_grants.go#L114-L119 the provider will only import a role that's already in the provider's state, in tfRoles, when it reads from Snowflake.

It would appear this was introduced to get around #189. However, this seems to have had the affect that importing these resources will not fetch and populate the existing role grants. I don't know enough about TF providers to know the best way around this at the moment.

@rtesselli
Copy link

I faced the same issue, but I can't understand why: I have a TF script in which the import of role grants worked correctly (Terraform 1.0.8, chanzuckerberg/snowflake 0.25.25, last updated 15/11/2021), but now, with the same code and import statements, the import does not fill the roles and users lists. I've tried also with version 0.25.26 and 0.25.29.

@Pete-rePete
Copy link

Pete-rePete commented Feb 16, 2022

Wanted to verify as well, using terraform==1.1.6 and chanzuckerberg/snowflake==0.25.35 importing role grants roles seems to be completely broken.

Even after importing all the roles into the tfstate first, it only shows an empty list. Haven't tested users but from @rtesselli it seems like this is still the case for both users and roles

@sfc-gh-asawicki
Copy link
Collaborator

We are closing this issue as part of a cleanup described in announcement. If you believe that the issue is still valid in v0.89.0, please open a new ticket.

@sfc-gh-asawicki sfc-gh-asawicki closed this as not planned Won't fix, can't repro, duplicate, stale Apr 30, 2024
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

5 participants