-
Notifications
You must be signed in to change notification settings - Fork 426
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- Feel free to delete comments as you fill this in --> - add `tags` data source - add missing examples for `streams` data source <!-- summary of changes --> ## 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/show-tags #1372
- Loading branch information
1 parent
1f0dc94
commit 8907d9d
Showing
16 changed files
with
804 additions
and
13 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 |
---|---|---|
@@ -0,0 +1,156 @@ | ||
--- | ||
page_title: "snowflake_tags Data Source - terraform-provider-snowflake" | ||
subcategory: "" | ||
description: |- | ||
Datasource used to get details of filtered tags. Filtering is aligned with the current possibilities for SHOW TAGS https://docs.snowflake.com/en/sql-reference/sql/show-tags query. The results of SHOW are encapsulated in one output collection tags. | ||
--- | ||
|
||
!> **V1 release candidate** This data source is a release candidate for the V1. We do not expect significant changes in it before the V1. We will welcome any feedback and adjust the data source if needed. Any errors reported will be resolved with a higher priority. We encourage checking this data source out before the V1 release. Please follow the [migration guide](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/MIGRATION_GUIDE.md#v0980--v0990) to use it. | ||
|
||
# snowflake_tags (Data Source) | ||
|
||
Datasource used to get details of filtered tags. Filtering is aligned with the current possibilities for [SHOW TAGS](https://docs.snowflake.com/en/sql-reference/sql/show-tags) query. The results of SHOW are encapsulated in one output collection `tags`. | ||
|
||
## Example Usage | ||
|
||
```terraform | ||
# Simple usage | ||
data "snowflake_tags" "simple" { | ||
} | ||
output "simple_output" { | ||
value = data.snowflake_tags.simple.tags | ||
} | ||
# Filtering (like) | ||
data "snowflake_tags" "like" { | ||
like = "tag-name" | ||
} | ||
output "like_output" { | ||
value = data.snowflake_tags.like.tags | ||
} | ||
# Filtering by prefix (like) | ||
data "snowflake_tags" "like_prefix" { | ||
like = "prefix%" | ||
} | ||
output "like_prefix_output" { | ||
value = data.snowflake_tags.like_prefix.tags | ||
} | ||
# Filtering (in) | ||
data "snowflake_tags" "in_account" { | ||
in { | ||
account = true | ||
} | ||
} | ||
data "snowflake_tags" "in_database" { | ||
in { | ||
database = "<database_name>" | ||
} | ||
} | ||
data "snowflake_tags" "in_schema" { | ||
in { | ||
schema = "<database_name>.<schema_name>" | ||
} | ||
} | ||
data "snowflake_tags" "in_application" { | ||
in { | ||
application = "<application_name>" | ||
} | ||
} | ||
data "snowflake_tags" "in_application_package" { | ||
in { | ||
application_package = "<application_package_name>" | ||
} | ||
} | ||
output "in_output" { | ||
value = { | ||
"account" : data.snowflake_tags.in_account.tags, | ||
"database" : data.snowflake_tags.in_database.tags, | ||
"schema" : data.snowflake_tags.in_schema.tags, | ||
"application" : data.snowflake_tags.in_application.tags, | ||
"application_package" : data.snowflake_tags.in_application_package.tags, | ||
} | ||
} | ||
output "in_output" { | ||
value = data.snowflake_tags.in.tags | ||
} | ||
# Ensure the number of tags is equal to at least one element (with the use of postcondition) | ||
data "snowflake_tags" "assert_with_postcondition" { | ||
like = "tag-name%" | ||
lifecycle { | ||
postcondition { | ||
condition = length(self.tags) > 0 | ||
error_message = "there should be at least one tag" | ||
} | ||
} | ||
} | ||
# Ensure the number of tags is equal to at exactly one element (with the use of check block) | ||
check "tag_check" { | ||
data "snowflake_tags" "assert_with_check_block" { | ||
like = "tag-name" | ||
} | ||
assert { | ||
condition = length(data.snowflake_tags.assert_with_check_block.tags) == 1 | ||
error_message = "tags filtered by '${data.snowflake_tags.assert_with_check_block.like}' returned ${length(data.snowflake_tags.assert_with_check_block.tags)} tags where one was expected" | ||
} | ||
} | ||
``` | ||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Optional | ||
|
||
- `in` (Block List, Max: 1) IN clause to filter the list of objects (see [below for nested schema](#nestedblock--in)) | ||
- `like` (String) Filters the output with **case-insensitive** pattern, with support for SQL wildcard characters (`%` and `_`). | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The ID of this resource. | ||
- `tags` (List of Object) Holds the aggregated output of all tags details queries. (see [below for nested schema](#nestedatt--tags)) | ||
|
||
<a id="nestedblock--in"></a> | ||
### Nested Schema for `in` | ||
|
||
Optional: | ||
|
||
- `account` (Boolean) Returns records for the entire account. | ||
- `application` (String) Returns records for the specified application. | ||
- `application_package` (String) Returns records for the specified application package. | ||
- `database` (String) Returns records for the current database in use or for a specified database. | ||
- `schema` (String) Returns records for the current schema in use or a specified schema. Use fully qualified name. | ||
|
||
|
||
<a id="nestedatt--tags"></a> | ||
### Nested Schema for `tags` | ||
|
||
Read-Only: | ||
|
||
- `show_output` (List of Object) (see [below for nested schema](#nestedobjatt--tags--show_output)) | ||
|
||
<a id="nestedobjatt--tags--show_output"></a> | ||
### Nested Schema for `tags.show_output` | ||
|
||
Read-Only: | ||
|
||
- `allowed_values` (Set of String) | ||
- `comment` (String) | ||
- `created_on` (String) | ||
- `database_name` (String) | ||
- `name` (String) | ||
- `owner` (String) | ||
- `owner_role_type` (String) | ||
- `schema_name` (String) |
Oops, something went wrong.