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

[Bug]: grant_privileges_to_database_role - on_database - argument not expected here error from terraform. #3071

Closed
1 task
usbrandon opened this issue Sep 13, 2024 · 2 comments
Labels
general-usage General help/usage questions

Comments

@usbrandon
Copy link

Terraform CLI Version

1.9.5

Terraform Provider Version

0.95.0

Terraform Configuration

# Grant CREATE SCHEMA on DB_DEV to ETLDEVELOPER role
resource "snowflake_grant_privileges_to_account_role" "create_schema_on_db_dev" {
  provider = snowflake.securityterraformer
  on_database = snowflake_database.db_dev.name
  privileges = ["CREATE SCHEMA"]
  account_role_name = "ETLDEVELOPER"
}

Category

category:grants

Object type(s)

resource:grant_privileges_to_database_role

Expected Behavior

I followed this pattern from the examples on the terraform repository documentation
##################################

on database privileges

##################################

list of privileges

resource "snowflake_grant_privileges_to_database_role" "example" {
privileges = ["CREATE", "MONITOR"]
database_role_name = snowflake_database_role.db_role.fully_qualified_name
on_database = snowflake_database_role.db_role.database
}

Actual Behavior

Terraform plan complained about the on_database parameter
Error: Unsupported argument

│ on database_role_grants.tf line 31, in resource "snowflake_grant_privileges_to_account_role" "create_schema_on_db_dev":
│ 31: on_database = snowflake_database.db_dev.name

│ An argument named "on_database" is not expected here.

Steps to Reproduce

You just have to use the block as suggested in the documentation example and then terraform plan or terraform validate to get it to throw the errors.

How much impact is this issue causing?

High

Logs

https://gist.github.com/usbrandon/cee0481cf62ab15a1645ccb78c6004cc

Additional Information

No response

Would you like to implement a fix?

  • Yeah, I'll take it 😎
@usbrandon usbrandon added the bug Used to mark issues with provider's incorrect behavior label Sep 13, 2024
@sfc-gh-asawicki sfc-gh-asawicki added general-usage General help/usage questions and removed bug Used to mark issues with provider's incorrect behavior labels Sep 13, 2024
@sfc-gh-asawicki
Copy link
Collaborator

Hey @usbrandon. Thanks for reaching out to us.

There is no on_database in this resource: https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/resources/grant_privileges_to_account_role#example-usage. To grant on database follow the examples (search for on_account_object ).

@sfc-gh-asawicki
Copy link
Collaborator

Closing the issue due to inactivity. Please create a new one if the issue persists in the newest version of the provider.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general-usage General help/usage questions
Projects
None yet
Development

No branches or pull requests

2 participants