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: Fix views permadiff #3079

Merged
merged 7 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Fixes
  • Loading branch information
sfc-gh-jmichalak committed Sep 16, 2024
commit 634bada461d1674574cdd28c45cc7303dd9f0d49
11 changes: 10 additions & 1 deletion docs/data-sources/row_access_policies.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,16 @@ Read-Only:
- `body` (String)
- `name` (String)
- `return_type` (String)
- `signature` (String)
- `signature` (List of Object) (see [below for nested schema](#nestedobjatt--row_access_policies--describe_output--signature))

<a id="nestedobjatt--row_access_policies--describe_output--signature"></a>
### Nested Schema for `row_access_policies.describe_output.signature`

Read-Only:

- `name` (String)
- `type` (String)



<a id="nestedobjatt--row_access_policies--show_output"></a>
Expand Down
12 changes: 9 additions & 3 deletions docs/guides/identifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ With the combination of quotes, old parsing methods, and other factors, it was a

For example, instead of writing

```object_name = “\”${snowflake_table.database}\”.\”${snowflake_table.schema}\”.\”${snowflake_table.name}\””```
```
object_name = “\”${snowflake_table.database}\”.\”${snowflake_table.schema}\”.\”${snowflake_table.name}\””
# for procedures
object_name = “\”${snowflake_procedure.database}\”.\”${snowflake_procedure.schema}\”.\”${snowflake_procedure.name}(NUMBER, VARCHAR)\””
```

now we can write

```object_name = snowflake_table.fully_qualified_name```
```
object_name = snowflake_table.fully_qualified_name
```

This is our recommended way of referencing other objects. However, if you don't manage table in Terraform, you can construct the proper id yourself like before: `"\"database_name\".\"schema_name\".\"table_name\""` Note that quotes are necessary for correct parsing of an identifier.
This is our recommended way of referencing other objects. However, if you don't manage the referenced object in Terraform, you can construct the proper id yourself like before: `"\"database_name\".\"schema_name\".\"object_name\""` for schema-level objects, or `"\"database_name\".\"schema_name\".\"procedure_name(NUMBER, VARCHAR)\""` for procedures. Note that quotes are necessary for correct parsing of an identifier.

This change was announced in v0.95.0 [migration guide](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#new-fully_qualified_name-field-in-the-resources).

Expand Down
11 changes: 10 additions & 1 deletion docs/resources/row_access_policy.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ Read-Only:
- `body` (String)
- `name` (String)
- `return_type` (String)
- `signature` (String)
- `signature` (List of Object) (see [below for nested schema](#nestedobjatt--describe_output--signature))

<a id="nestedobjatt--describe_output--signature"></a>
### Nested Schema for `describe_output.signature`

Read-Only:

- `name` (String)
- `type` (String)



<a id="nestedatt--show_output"></a>
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/view.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ SQL

- `aggregation_policy` (Block List, Max: 1) Specifies the aggregation policy to set on a view. (see [below for nested schema](#nestedblock--aggregation_policy))
- `change_tracking` (String) Specifies to enable or disable change tracking on the table. Available options are: "true" or "false". When the value is not set in the configuration the provider will put "default" there which means to use the Snowflake default for this value.
- `column` (Block List) If you want to change the name of a column or add a comment to a column in the new view, include a column list that specifies the column names and (if needed) comments about the columns. (You do not need to specify the data types of the columns.) (see [below for nested schema](#nestedblock--column))
- `column` (Block List) If you want to change the name of a column or add a comment to a column in the new view, include a column list that specifies the column names and (if needed) comments about the columns. You do not need to specify the data types of the columns. If this field is not specified, columns are inferred from the `statement` field by Snowflake. (see [below for nested schema](#nestedblock--column))
- `comment` (String) Specifies a comment for the view.
- `copy_grants` (Boolean) Retains the access permissions from the original view when a new view is created using the OR REPLACE clause.
- `data_metric_function` (Block Set) Data metric functions used for the view. (see [below for nested schema](#nestedblock--data_metric_function))
Expand Down
18 changes: 17 additions & 1 deletion pkg/resources/view_acceptance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -888,6 +888,11 @@ func TestAcc_View_Issue3073(t *testing.T) {
Steps: []resource.TestStep{
{
Config: accconfig.FromModel(t, viewModel),
ConfigPlanChecks: resource.ConfigPlanChecks{
PostApplyPostRefresh: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("snowflake_view.test", plancheck.ResourceActionNoop),
},
},
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("snowflake_view.test", "name", id.Name()),
),
Expand All @@ -897,7 +902,18 @@ func TestAcc_View_Issue3073(t *testing.T) {
ConfigDirectory: acc.ConfigurationDirectory("TestAcc_View/basic"),
ConfigVariables: tfconfig.ConfigVariablesFromModel(t, viewModelWithColumns),
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
PostApplyPostRefresh: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("snowflake_view.test", plancheck.ResourceActionNoop),
},
},
Check: resource.ComposeAggregateTestCheckFunc(
resource.TestCheckResourceAttr("snowflake_view.test", "name", id.Name()),
),
},
{
Config: accconfig.FromModel(t, viewModel),
ConfigPlanChecks: resource.ConfigPlanChecks{
PostApplyPostRefresh: []plancheck.PlanCheck{
plancheck.ExpectResourceAction("snowflake_view.test", plancheck.ResourceActionNoop),
},
},
Expand Down
12 changes: 9 additions & 3 deletions templates/guides/identifiers.md.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,19 @@ With the combination of quotes, old parsing methods, and other factors, it was a

For example, instead of writing

```object_name = “\”${snowflake_table.database}\”.\”${snowflake_table.schema}\”.\”${snowflake_table.name}\””```
```
object_name = “\”${snowflake_table.database}\”.\”${snowflake_table.schema}\”.\”${snowflake_table.name}\””
# for procedures
object_name = “\”${snowflake_procedure.database}\”.\”${snowflake_procedure.schema}\”.\”${snowflake_procedure.name}(NUMBER, VARCHAR)\””
```

now we can write

```object_name = snowflake_table.fully_qualified_name```
```
object_name = snowflake_table.fully_qualified_name
```

This is our recommended way of referencing other objects. However, if you don't manage table in Terraform, you can construct the proper id yourself like before: `"\"database_name\".\"schema_name\".\"table_name\""` Note that quotes are necessary for correct parsing of an identifier.
This is our recommended way of referencing other objects. However, if you don't manage the referenced object in Terraform, you can construct the proper id yourself like before: `"\"database_name\".\"schema_name\".\"object_name\""` for schema-level objects, or `"\"database_name\".\"schema_name\".\"procedure_name(NUMBER, VARCHAR)\""` for procedures. Note that quotes are necessary for correct parsing of an identifier.

This change was announced in v0.95.0 [migration guide](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#new-fully_qualified_name-field-in-the-resources).

Expand Down
Loading