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

docs: NO-SNOW (issue #1040) add a little bit more clarification how to spec… #3321

Merged
merged 4 commits into from
Jan 9, 2025
Merged
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
16 changes: 15 additions & 1 deletion docs/resources/external_table.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,20 @@ resource "snowflake_external_table" "external_table" {
type = "text"
}
}

# with a location pointing to an existing stage
# name is hardcoded, please see resource documentation for other options
resource "snowflake_external_table" "external_table_with_location" {
database = "db"
schema = "schema"
name = "external_table_with_location"
location = "@MYDB.MYSCHEMA.MYSTAGE"

column {
name = "id"
type = "int"
}
}
```

-> **Note** Instead of using fully_qualified_name, you can reference objects managed outside Terraform by constructing a correct ID, consult [identifiers guide](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs/guides/identifiers#new-computed-fully-qualified-name-field-in-resources).
Expand All @@ -44,7 +58,7 @@ resource "snowflake_external_table" "external_table" {
- `column` (Block List, Min: 1) Definitions of a column to create in the external table. Minimum one required. (see [below for nested schema](#nestedblock--column))
- `database` (String) The database in which to create the external table.
- `file_format` (String) Specifies the file format for the external table.
- `location` (String) Specifies a location for the external table.
- `location` (String) Specifies a location for the external table, using its FQDN. You can hardcode it (`"@MYDB.MYSCHEMA.MYSTAGE"`), or populate dynamically (`"@${snowflake_stage.mystage.fully_qualified_name}"`)
- `name` (String) Specifies the identifier for the external table; must be unique for the database and schema in which the externalTable is created.
- `schema` (String) The schema in which to create the external table.

Expand Down
14 changes: 14 additions & 0 deletions examples/resources/snowflake_external_table/resource.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,17 @@ resource "snowflake_external_table" "external_table" {
type = "text"
}
}

# with a location pointing to an existing stage
# name is hardcoded, please see resource documentation for other options
resource "snowflake_external_table" "external_table_with_location" {
database = "db"
schema = "schema"
name = "external_table_with_location"
location = "@MYDB.MYSCHEMA.MYSTAGE"

column {
name = "id"
type = "int"
}
}
2 changes: 1 addition & 1 deletion pkg/resources/external_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ var externalTableSchema = map[string]*schema.Schema{
Type: schema.TypeString,
Required: true,
ForceNew: true,
Description: "Specifies a location for the external table.",
Description: "Specifies a location for the external table, using its FQDN. You can hardcode it (`\"@MYDB.MYSCHEMA.MYSTAGE\"`), or populate dynamically (`\"@${snowflake_stage.mystage.fully_qualified_name}\"`)",
},
"file_format": {
Type: schema.TypeString,
Expand Down
Loading