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

fix: Reverted enable_multiple_grants #1225

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/resources/account_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ resource snowflake_account_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the account.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/database_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ resource snowflake_database_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the database.
- `roles` (Set of String) Grants privilege to these roles.
- `shares` (Set of String) Grants privilege to these shares.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/external_table_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ resource snowflake_external_table_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `external_table_name` (String) The name of the external table on which to grant privileges immediately (only valid if on_future is false).
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future external tables in the given schema. When this is true and no schema_name is provided apply this grant on all future external tables in the given database. The external_table_name and shares fields must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future external table.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/file_format_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource snowflake_file_format_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `file_format_name` (String) The name of the file format on which to grant privileges immediately (only valid if on_future is false).
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future file formats in the given schema. When this is true and no schema_name is provided apply this grant on all future file formats in the given database. The file_format_name field must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future file format.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/function_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ resource snowflake_function_grant grant {
### Optional

- `arguments` (Block List) List of the arguments for the function (must be present if function has arguments and function_name is present) (see [below for nested schema](#nestedblock--arguments))
- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `function_name` (String) The name of the function on which to grant privileges immediately (only valid if on_future is false).
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future functions in the given schema. When this is true and no schema_name is provided apply this grant on all future functions in the given database. The function_name, arguments, return_type, and shares fields must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future function. Must be one of `USAGE` or `OWNERSHIP`.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/integration_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ resource snowflake_integration_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the integration.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/masking_policy_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ description: |-

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the masking policy.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/materialized_view_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ resource "snowflake_materialized_view_grant" "grant" {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `materialized_view_name` (String) The name of the materialized view on which to grant privileges immediately (only valid if on_future is false).
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future materialized views in the given schema. When this is true and no schema_name is provided apply this grant on all future materialized views in the given database. The materialized_view_name and shares fields must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future materialized view view.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/pipe_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource snowflake_pipe_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future pipes in the given schema. When this is true and no schema_name is provided apply this grant on all future pipes in the given database. The pipe_name field must be unset in order to use on_future.
- `pipe_name` (String) The name of the pipe on which to grant privileges immediately (only valid if on_future is false).
- `privilege` (String) The privilege to grant on the current or future pipe.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/procedure_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ resource snowflake_procedure_grant grant {
### Optional

- `arguments` (Block List) List of the arguments for the procedure (must be present if procedure has arguments and procedure_name is present) (see [below for nested schema](#nestedblock--arguments))
- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future procedures in the given schema. When this is true and no schema_name is provided apply this grant on all future procedures in the given database. The procedure_name and shares fields must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future procedure.
- `procedure_name` (String) The name of the procedure on which to grant privileges immediately (only valid if on_future is false).
Expand Down
1 change: 0 additions & 1 deletion docs/resources/resource_monitor_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ resource "snowflake_resource_monitor_grant" "grant" {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the resource monitor.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/role_grants.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ resource "snowflake_role_grants" "grants" {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `roles` (Set of String) Grants role to this specified role.
- `users` (Set of String) Grants role to this specified user.

Expand Down
1 change: 0 additions & 1 deletion docs/resources/row_access_policy_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource "snowflake_row_access_policy_grant" "grant" {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the row access policy.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/schema_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource snowflake_schema_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true, apply this grant on all future schemas in the given database. The schema_name and shares fields must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future schema. Note that if "OWNERSHIP" is specified, ensure that the role that terraform is using is granted access.
- `roles` (Set of String) Grants privilege to these roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/sequence_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource snowflake_sequence_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future sequences in the given schema. When this is true and no schema_name is provided apply this grant on all future sequences in the given database. The sequence_name field must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future sequence.
- `roles` (Set of String) Grants privilege to these roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/stage_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ resource snowflake_stage_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future stages in the given schema. When this is true and no schema_name is provided apply this grant on all future stages in the given database. The stage_name field must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the stage.
- `roles` (Set of String) Grants privilege to these roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/stream_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource snowflake_stream_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future streams in the given schema. When this is true and no schema_name is provided apply this grant on all future streams in the given database. The stream_name field must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future stream.
- `roles` (Set of String) Grants privilege to these roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/table_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ resource snowflake_table_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future tables in the given schema. When this is true and no schema_name is provided apply this grant on all future tables in the given database. The table_name and shares fields must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future table.
- `roles` (Set of String) Grants privilege to these roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/tag_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ resource "snowflake_tag_grant" "example" {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the tag.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/task_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ resource snowflake_task_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future tasks in the given schema. When this is true and no schema_name is provided apply this grant on all future tasks in the given database. The task_name field must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future task.
- `roles` (Set of String) Grants privilege to these roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/user_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ resource snowflake_user_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.

Expand Down
1 change: 0 additions & 1 deletion docs/resources/view_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ resource snowflake_view_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `on_future` (Boolean) When this is set to true and a schema_name is provided, apply this grant on all future views in the given schema. When this is true and no schema_name is provided apply this grant on all future views in the given database. The view_name and shares fields must be unset in order to use on_future.
- `privilege` (String) The privilege to grant on the current or future view.
- `roles` (Set of String) Grants privilege to these roles.
Expand Down
1 change: 0 additions & 1 deletion docs/resources/warehouse_grant.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ resource snowflake_warehouse_grant grant {

### Optional

- `enable_multiple_grants` (Boolean) When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.
- `privilege` (String) The privilege to grant on the warehouse.
- `roles` (Set of String) Grants privilege to these roles.
- `with_grant_option` (Boolean) When this is set to true, allows the recipient role to grant the privileges to other roles.
Expand Down
8 changes: 0 additions & 8 deletions pkg/resources/account_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,6 @@ var accountGrantSchema = map[string]*schema.Schema{
Default: false,
ForceNew: true,
},
"enable_multiple_grants": {
Type: schema.TypeBool,
Optional: true,
Description: "When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.",
Default: false,
},
}

// AccountGrant returns a pointer to the resource representing an account grant
Expand All @@ -83,7 +77,6 @@ func AccountGrant() *TerraformGrantResource {
func CreateAccountGrant(d *schema.ResourceData, meta interface{}) error {
priv := d.Get("privilege").(string)
grantOption := d.Get("with_grant_option").(bool)
roles := expandStringList(d.Get("roles").(*schema.Set).List())

builder := snowflake.AccountGrant()

Expand All @@ -96,7 +89,6 @@ func CreateAccountGrant(d *schema.ResourceData, meta interface{}) error {
ResourceName: "ACCOUNT",
Privilege: priv,
GrantOption: grantOption,
Roles: roles,
}
dataIDInput, err := grantID.String()
if err != nil {
Expand Down
10 changes: 1 addition & 9 deletions pkg/resources/database_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package resources
import (
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/snowflake"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
"github.com/pkg/errors"
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/validation"
"github.com/pkg/errors"
)

var validDatabasePrivileges = NewPrivilegeSet(
Expand Down Expand Up @@ -52,12 +52,6 @@ var databaseGrantSchema = map[string]*schema.Schema{
Default: false,
ForceNew: true,
},
"enable_multiple_grants": {
Type: schema.TypeBool,
Optional: true,
Description: "When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.",
Default: false,
},
}

// DatabaseGrant returns a pointer to the resource representing a database grant
Expand All @@ -84,7 +78,6 @@ func CreateDatabaseGrant(d *schema.ResourceData, meta interface{}) error {
builder := snowflake.DatabaseGrant(dbName)
priv := d.Get("privilege").(string)
grantOption := d.Get("with_grant_option").(bool)
roles := expandStringList(d.Get("roles").(*schema.Set).List())

err := createGenericGrant(d, meta, builder)
if err != nil {
Expand All @@ -95,7 +88,6 @@ func CreateDatabaseGrant(d *schema.ResourceData, meta interface{}) error {
ResourceName: dbName,
Privilege: priv,
GrantOption: grantOption,
Roles: roles,
}
dataIDInput, err := grant.String()
if err != nil {
Expand Down
3 changes: 0 additions & 3 deletions pkg/resources/database_grant_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ func TestAcc_DatabaseGrant(t *testing.T) {
ResourceName: "snowflake_database_grant.test",
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{
"enable_multiple_grants", // feature flag attribute not defined in Snowflake, can't be imported
},
},
},
})
Expand Down
9 changes: 0 additions & 9 deletions pkg/resources/external_table_grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ var externalTableGrantSchema = map[string]*schema.Schema{
Default: false,
ForceNew: true,
},
"enable_multiple_grants": {
Type: schema.TypeBool,
Optional: true,
Description: "When this is set to true, multiple grants of the same type can be created. This will cause Terraform to not revoke grants applied to roles and objects outside Terraform.",
Default: false,
ForceNew: true,
},
}

// ExternalTableGrant returns a pointer to the resource representing a external table grant
Expand Down Expand Up @@ -105,7 +98,6 @@ func CreateExternalTableGrant(d *schema.ResourceData, meta interface{}) error {
priv := d.Get("privilege").(string)
futureExternalTables := d.Get("on_future").(bool)
grantOption := d.Get("with_grant_option").(bool)
roles := expandStringList(d.Get("roles").(*schema.Set).List())

if (externalTableName == "") && !futureExternalTables {
return errors.New("external_table_name must be set unless on_future is true.")
Expand Down Expand Up @@ -135,7 +127,6 @@ func CreateExternalTableGrant(d *schema.ResourceData, meta interface{}) error {
ObjectName: externalTableName,
Privilege: priv,
GrantOption: grantOption,
Roles: roles,
}
dataIDInput, err := grant.String()
if err != nil {
Expand Down
Loading