-
Notifications
You must be signed in to change notification settings - Fork 420
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Row access policy resource v1 (#3063)
<!-- Feel free to delete comments as you fill this in --> <!-- summary of changes --> - add show and desc output - rename fields - change signature to arguments - implement renaming - fix permadiff on body - adjust identifiers handling - adjust examples - gen resource asserts (config builders are not working because we have a required list argument) - improve handling data types - move parsing signature to sdk - support proper casing in arg names ## Test Plan <!-- detail ways in which this PR has been tested or needs to be tested --> * [x] acceptance tests <!-- add more below if you think they are relevant --> * [ ] … ## References <!-- issues documentation links, etc --> https://docs.snowflake.com/en/sql-reference/sql/create-row-access-policy #2053 #1151 ## TODO (next PR) - rework data source
- Loading branch information
1 parent
42fd40a
commit 6c420a4
Showing
32 changed files
with
1,756 additions
and
291 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
# format is database name | schema name | policy name | ||
terraform import snowflake_row_access_policy.example 'dbName|schemaName|policyName' | ||
terraform import snowflake_row_access_policy.example '"<database_name>"."<schema_name>"."<row_access_policy_name>"' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
130 changes: 130 additions & 0 deletions
130
pkg/acceptance/bettertestspoc/assert/objectassert/row_access_policy_snowflake_gen.go
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
pkg/acceptance/bettertestspoc/assert/resourceassert/row_access_policy_resource_ext.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package resourceassert | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
|
||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/assert" | ||
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk" | ||
) | ||
|
||
func (r *RowAccessPolicyResourceAssert) HasArguments(args []sdk.RowAccessPolicyArgument) *RowAccessPolicyResourceAssert { | ||
r.AddAssertion(assert.ValueSet("argument.#", strconv.FormatInt(int64(len(args)), 10))) | ||
for i, v := range args { | ||
r.AddAssertion(assert.ValueSet(fmt.Sprintf("argument.%d.name", i), v.Name)) | ||
r.AddAssertion(assert.ValueSet(fmt.Sprintf("argument.%d.type", i), v.Type)) | ||
} | ||
return r | ||
} |
Oops, something went wrong.