|
| 1 | +--- |
| 2 | +page_title: "snowflake_listings Data Source - terraform-provider-snowflake" |
| 3 | +subcategory: "Preview" |
| 4 | +description: |- |
| 5 | + Data source used to get details of filtered listings. Filtering is aligned with the current possibilities for SHOW LISTINGS query (like, starts_with, and limit are supported). The results of SHOW and DESCRIBE are encapsulated in one output collection. |
| 6 | +--- |
| 7 | + |
| 8 | +!> **Preview Feature** This data source is a preview feature and is subject to breaking changes, even without bumping the major version. To use this feature, add `snowflake_listings_datasource` to `preview_features_enabled` field in the provider configuration. Read more about preview features in our [documentation](../#preview-features). |
| 9 | + |
| 10 | +-> **Note** This data source focuses on base query commands (SHOW LISTINGS and DESCRIBE LISTING). Other query commands like SHOW AVAILABLE LISTINGS, DESCRIBE AVAILABLE LISTING, SHOW LISTING OFFERS, SHOW OFFERS, SHOW PRICING PLANS, and SHOW VERSIONS IN LISTING are not included and will be added depending on demand. |
| 11 | + |
| 12 | +# snowflake_listings (Data Source) |
| 13 | + |
| 14 | +Data source used to get details of filtered listings. Filtering is aligned with the current possibilities for SHOW LISTINGS query (`like`, `starts_with`, and `limit` are supported). The results of SHOW and DESCRIBE are encapsulated in one output collection. |
| 15 | + |
| 16 | +## Example Usage |
| 17 | + |
| 18 | +```terraform |
| 19 | +# Simple usage |
| 20 | +data "snowflake_listings" "simple" { |
| 21 | +} |
| 22 | +
|
| 23 | +output "simple_output" { |
| 24 | + value = data.snowflake_listings.simple.listings |
| 25 | +} |
| 26 | +
|
| 27 | +# Filtering (like) |
| 28 | +data "snowflake_listings" "like" { |
| 29 | + like = "listing-name" |
| 30 | +} |
| 31 | +
|
| 32 | +output "like_output" { |
| 33 | + value = data.snowflake_listings.like.listings |
| 34 | +} |
| 35 | +
|
| 36 | +# Filtering by prefix (like) |
| 37 | +data "snowflake_listings" "like_prefix" { |
| 38 | + like = "prefix%" |
| 39 | +} |
| 40 | +
|
| 41 | +output "like_prefix_output" { |
| 42 | + value = data.snowflake_listings.like_prefix.listings |
| 43 | +} |
| 44 | +
|
| 45 | +# Filtering (starts_with) |
| 46 | +data "snowflake_listings" "starts_with" { |
| 47 | + starts_with = "prefix-" |
| 48 | +} |
| 49 | +
|
| 50 | +output "starts_with_output" { |
| 51 | + value = data.snowflake_listings.starts_with.listings |
| 52 | +} |
| 53 | +
|
| 54 | +# Filtering (limit) |
| 55 | +data "snowflake_listings" "limit" { |
| 56 | + limit { |
| 57 | + rows = 10 |
| 58 | + from = "prefix-" |
| 59 | + } |
| 60 | +} |
| 61 | +
|
| 62 | +output "limit_output" { |
| 63 | + value = data.snowflake_listings.limit.listings |
| 64 | +} |
| 65 | +
|
| 66 | +# Without additional data (to limit the number of calls make for every found listing) |
| 67 | +data "snowflake_listings" "only_show" { |
| 68 | + # with_describe is turned on by default and it calls DESCRIBE LISTING for every listing found and attaches its output to listings.*.describe_output field |
| 69 | + with_describe = false |
| 70 | +} |
| 71 | +
|
| 72 | +output "only_show_output" { |
| 73 | + value = data.snowflake_listings.only_show.listings |
| 74 | +} |
| 75 | +
|
| 76 | +# Ensure the number of listings is equal to at least one element (with the use of postcondition) |
| 77 | +data "snowflake_listings" "assert_with_postcondition" { |
| 78 | + like = "listing-name%" |
| 79 | + lifecycle { |
| 80 | + postcondition { |
| 81 | + condition = length(self.listings) > 0 |
| 82 | + error_message = "there should be at least one listing" |
| 83 | + } |
| 84 | + } |
| 85 | +} |
| 86 | +
|
| 87 | +# Ensure the number of listings is equal to exactly one element (with the use of check block) |
| 88 | +check "listing_check" { |
| 89 | + data "snowflake_listings" "assert_with_check_block" { |
| 90 | + like = "listing-name" |
| 91 | + } |
| 92 | +
|
| 93 | + assert { |
| 94 | + condition = length(data.snowflake_listings.assert_with_check_block.listings) == 1 |
| 95 | + error_message = "listings filtered by '${data.snowflake_listings.assert_with_check_block.like}' returned ${length(data.snowflake_listings.assert_with_check_block.listings)} listings where one was expected" |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +-> **Note** If a field has a default value, it is shown next to the type in the schema. |
| 101 | + |
| 102 | +<!-- schema generated by tfplugindocs --> |
| 103 | +## Schema |
| 104 | + |
| 105 | +### Optional |
| 106 | + |
| 107 | +- `like` (String) Filters the output with **case-insensitive** pattern, with support for SQL wildcard characters (`%` and `_`). |
| 108 | +- `limit` (Block List, Max: 1) Limits the number of rows returned. If the `limit.from` is set, then the limit will start from the first element matched by the expression. The expression is only used to match with the first element, later on the elements are not matched by the prefix, but you can enforce a certain pattern with `starts_with` or `like`. (see [below for nested schema](#nestedblock--limit)) |
| 109 | +- `starts_with` (String) Filters the output with **case-sensitive** characters indicating the beginning of the object name. |
| 110 | +- `with_describe` (Boolean) (Default: `true`) Runs DESC LISTING for each listing returned by SHOW LISTINGS. The output of describe is saved to the description field. By default this value is set to true. |
| 111 | + |
| 112 | +### Read-Only |
| 113 | + |
| 114 | +- `id` (String) The ID of this resource. |
| 115 | +- `listings` (List of Object) Holds the aggregated output of all listings details queries. (see [below for nested schema](#nestedatt--listings)) |
| 116 | + |
| 117 | +<a id="nestedblock--limit"></a> |
| 118 | +### Nested Schema for `limit` |
| 119 | + |
| 120 | +Required: |
| 121 | + |
| 122 | +- `rows` (Number) The maximum number of rows to return. |
| 123 | + |
| 124 | +Optional: |
| 125 | + |
| 126 | +- `from` (String) Specifies a **case-sensitive** pattern that is used to match object name. After the first match, the limit on the number of rows will be applied. |
| 127 | + |
| 128 | + |
| 129 | +<a id="nestedatt--listings"></a> |
| 130 | +### Nested Schema for `listings` |
| 131 | + |
| 132 | +Read-Only: |
| 133 | + |
| 134 | +- `describe_output` (List of Object) (see [below for nested schema](#nestedobjatt--listings--describe_output)) |
| 135 | +- `show_output` (List of Object) (see [below for nested schema](#nestedobjatt--listings--show_output)) |
| 136 | + |
| 137 | +<a id="nestedobjatt--listings--describe_output"></a> |
| 138 | +### Nested Schema for `listings.describe_output` |
| 139 | + |
| 140 | +Read-Only: |
| 141 | + |
| 142 | +- `application_package` (String) |
| 143 | +- `approver_contact` (String) |
| 144 | +- `business_needs` (String) |
| 145 | +- `categories` (String) |
| 146 | +- `comment` (String) |
| 147 | +- `created_on` (String) |
| 148 | +- `customized_contact_info` (String) |
| 149 | +- `data_attributes` (String) |
| 150 | +- `data_dictionary` (String) |
| 151 | +- `data_preview` (String) |
| 152 | +- `description` (String) |
| 153 | +- `distribution` (String) |
| 154 | +- `global_name` (String) |
| 155 | +- `is_application` (Boolean) |
| 156 | +- `is_by_request` (Boolean) |
| 157 | +- `is_limited_trial` (Boolean) |
| 158 | +- `is_monetized` (Boolean) |
| 159 | +- `is_mountless_queryable` (Boolean) |
| 160 | +- `is_share` (Boolean) |
| 161 | +- `is_targeted` (Boolean) |
| 162 | +- `last_committed_version_alias` (String) |
| 163 | +- `last_committed_version_name` (String) |
| 164 | +- `last_committed_version_uri` (String) |
| 165 | +- `legacy_uniform_listing_locators` (String) |
| 166 | +- `limited_trial_plan` (String) |
| 167 | +- `listing_terms` (String) |
| 168 | +- `live_version_uri` (String) |
| 169 | +- `manifest_yaml` (String) |
| 170 | +- `monetization_display_order` (String) |
| 171 | +- `name` (String) |
| 172 | +- `organization_profile_name` (String) |
| 173 | +- `owner` (String) |
| 174 | +- `owner_role_type` (String) |
| 175 | +- `profile` (String) |
| 176 | +- `published_on` (String) |
| 177 | +- `published_version_alias` (String) |
| 178 | +- `published_version_name` (String) |
| 179 | +- `published_version_uri` (String) |
| 180 | +- `refresh_schedule` (String) |
| 181 | +- `refresh_type` (String) |
| 182 | +- `regions` (String) |
| 183 | +- `rejection_reason` (String) |
| 184 | +- `request_approval_type` (String) |
| 185 | +- `resources` (String) |
| 186 | +- `retried_on` (String) |
| 187 | +- `review_state` (String) |
| 188 | +- `revisions` (String) |
| 189 | +- `scheduled_drop_time` (String) |
| 190 | +- `share` (String) |
| 191 | +- `state` (String) |
| 192 | +- `subtitle` (String) |
| 193 | +- `support_contact` (String) |
| 194 | +- `target_accounts` (String) |
| 195 | +- `title` (String) |
| 196 | +- `trial_details` (String) |
| 197 | +- `uniform_listing_locator` (String) |
| 198 | +- `unpublished_by_admin_reasons` (String) |
| 199 | +- `updated_on` (String) |
| 200 | +- `usage_examples` (String) |
| 201 | + |
| 202 | + |
| 203 | +<a id="nestedobjatt--listings--show_output"></a> |
| 204 | +### Nested Schema for `listings.show_output` |
| 205 | + |
| 206 | +Read-Only: |
| 207 | + |
| 208 | +- `comment` (String) |
| 209 | +- `created_on` (String) |
| 210 | +- `detailed_target_accounts` (String) |
| 211 | +- `distribution` (String) |
| 212 | +- `global_name` (String) |
| 213 | +- `is_application` (Boolean) |
| 214 | +- `is_by_request` (Boolean) |
| 215 | +- `is_limited_trial` (Boolean) |
| 216 | +- `is_monetized` (Boolean) |
| 217 | +- `is_mountless_queryable` (Boolean) |
| 218 | +- `is_targeted` (Boolean) |
| 219 | +- `name` (String) |
| 220 | +- `organization_profile_name` (String) |
| 221 | +- `owner` (String) |
| 222 | +- `owner_role_type` (String) |
| 223 | +- `profile` (String) |
| 224 | +- `published_on` (String) |
| 225 | +- `regions` (String) |
| 226 | +- `rejected_on` (String) |
| 227 | +- `review_state` (String) |
| 228 | +- `state` (String) |
| 229 | +- `subtitle` (String) |
| 230 | +- `target_accounts` (String) |
| 231 | +- `title` (String) |
| 232 | +- `uniform_listing_locator` (String) |
| 233 | +- `updated_on` (String) |
| 234 | + |
0 commit comments