diff --git a/docs/resources/external_table.md b/docs/resources/external_table.md
index f9cd0a5456..260806f64b 100644
--- a/docs/resources/external_table.md
+++ b/docs/resources/external_table.md
@@ -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).
@@ -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.
diff --git a/docs/resources/stage.md b/docs/resources/stage.md
index 6e8cf7841e..2957f5961d 100644
--- a/docs/resources/stage.md
+++ b/docs/resources/stage.md
@@ -21,6 +21,17 @@ resource "snowflake_stage" "example_stage" {
schema = "EXAMPLE_SCHEMA"
credentials = "AWS_KEY_ID='${var.example_aws_key_id}' AWS_SECRET_KEY='${var.example_aws_secret_key}'"
}
+
+# with an existing hardcoded file format
+# please see other examples in the resource documentation
+resource "snowflake_stage" "example_stage_with_file_format" {
+ name = "EXAMPLE_STAGE"
+ url = "s3://com.example.bucket/prefix"
+ database = "EXAMPLE_DB"
+ schema = "EXAMPLE_SCHEMA"
+ credentials = "AWS_KEY_ID='${var.example_aws_key_id}' AWS_SECRET_KEY='${var.example_aws_secret_key}'"
+ file_format = "FORMAT_NAME = DB.SCHEMA.FORMATNAME"
+}
```
-> **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).
@@ -43,7 +54,7 @@ resource "snowflake_stage" "example_stage" {
- `credentials` (String, Sensitive) Specifies the credentials for the stage.
- `directory` (String) Specifies the directory settings for the stage.
- `encryption` (String) Specifies the encryption settings for the stage.
-- `file_format` (String) Specifies the file format for the stage. Specifying the default Snowflake value (e.g. TYPE = CSV) will currently result in a permadiff (check [#2679](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2679)). For now, omit the default values; it will be fixed in the upcoming provider versions.
+- `file_format` (String) Specifies the file format for the stage. Specifying the default Snowflake value (e.g. TYPE = CSV) will currently result in a permadiff (check [#2679](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2679)). For now, omit the default values; it will be fixed in the upcoming provider versions. Examples of usage: 1. with hardcoding value: `file_format="FORMAT_NAME = DB.SCHEMA.FORMATNAME"` 2. from dynamic value: `file_format = "FORMAT_NAME = ${snowflake_file_format.myfileformat.fully_qualified_name}"` 3. from expression: `file_format = format("FORMAT_NAME =%s.%s.MYFILEFORMAT", var.db_name, each.value.schema_name)`. Reference: [#265](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/265)
- `snowflake_iam_user` (String) An AWS IAM user created for your Snowflake account. This user is the same for every external S3 stage created in your account.
- `storage_integration` (String) Specifies the name of the storage integration used to delegate authentication responsibility for external cloud storage to a Snowflake identity and access management (IAM) entity.
- `tag` (Block List, Deprecated) Definitions of a tag to associate with the resource. (see [below for nested schema](#nestedblock--tag))
diff --git a/examples/resources/snowflake_external_table/resource.tf b/examples/resources/snowflake_external_table/resource.tf
index 5f355a14db..3752c04dd8 100644
--- a/examples/resources/snowflake_external_table/resource.tf
+++ b/examples/resources/snowflake_external_table/resource.tf
@@ -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"
+ }
+}
\ No newline at end of file
diff --git a/examples/resources/snowflake_stage/resource.tf b/examples/resources/snowflake_stage/resource.tf
index 36d710f1f7..8a434db4ff 100644
--- a/examples/resources/snowflake_stage/resource.tf
+++ b/examples/resources/snowflake_stage/resource.tf
@@ -6,3 +6,14 @@ resource "snowflake_stage" "example_stage" {
schema = "EXAMPLE_SCHEMA"
credentials = "AWS_KEY_ID='${var.example_aws_key_id}' AWS_SECRET_KEY='${var.example_aws_secret_key}'"
}
+
+# with an existing hardcoded file format
+# please see other examples in the resource documentation
+resource "snowflake_stage" "example_stage_with_file_format" {
+ name = "EXAMPLE_STAGE"
+ url = "s3://com.example.bucket/prefix"
+ database = "EXAMPLE_DB"
+ schema = "EXAMPLE_SCHEMA"
+ credentials = "AWS_KEY_ID='${var.example_aws_key_id}' AWS_SECRET_KEY='${var.example_aws_secret_key}'"
+ file_format = "FORMAT_NAME = DB.SCHEMA.FORMATNAME"
+}
\ No newline at end of file
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_java_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/function_java_model_ext.go
index 3b2acbc841..b9bd0b37e8 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_java_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_java_model_ext.go
@@ -5,7 +5,6 @@ import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/collections"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
@@ -18,7 +17,7 @@ func FunctionJavaBasicInline(
handler string,
functionDefinition string,
) *FunctionJavaModel {
- return FunctionJava(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), id.SchemaName()).WithFunctionDefinitionValue(config.MultilineWrapperVariable(functionDefinition))
+ return FunctionJava(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), id.SchemaName()).WithFunctionDefinition(functionDefinition)
}
func FunctionJavaBasicStaged(
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_java_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/function_java_model_gen.go
index a4c20306ee..3308a1f337 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_java_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_java_model_gen.go
@@ -125,7 +125,7 @@ func (f *FunctionJavaModel) WithFullyQualifiedName(fullyQualifiedName string) *F
}
func (f *FunctionJavaModel) WithFunctionDefinition(functionDefinition string) *FunctionJavaModel {
- f.FunctionDefinition = tfconfig.StringVariable(functionDefinition)
+ f.FunctionDefinition = config.MultilineWrapperVariable(functionDefinition)
return f
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_ext.go
index 3c25076aab..4f799a2574 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_ext.go
@@ -3,14 +3,12 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
)
func FunctionJavascriptInline(resourceName string, id sdk.SchemaObjectIdentifierWithArguments, functionDefinition string, returnType string) *FunctionJavascriptModel {
- return FunctionJavascript(resourceName, id.DatabaseName(), functionDefinition, id.Name(), returnType, id.SchemaName()).
- WithFunctionDefinitionValue(config.MultilineWrapperVariable(functionDefinition))
+ return FunctionJavascript(resourceName, id.DatabaseName(), functionDefinition, id.Name(), returnType, id.SchemaName())
}
func (f *FunctionJavascriptModel) WithArgument(argName string, argDataType datatypes.DataType) *FunctionJavascriptModel {
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_gen.go
index e9397ff9b3..4474f6d642 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_javascript_model_gen.go
@@ -116,7 +116,7 @@ func (f *FunctionJavascriptModel) WithFullyQualifiedName(fullyQualifiedName stri
}
func (f *FunctionJavascriptModel) WithFunctionDefinition(functionDefinition string) *FunctionJavascriptModel {
- f.FunctionDefinition = tfconfig.StringVariable(functionDefinition)
+ f.FunctionDefinition = config.MultilineWrapperVariable(functionDefinition)
return f
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_python_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/function_python_model_ext.go
index ad420f07ef..d22f52da29 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_python_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_python_model_ext.go
@@ -3,14 +3,13 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/collections"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
)
func FunctionPythonBasicInline(resourceName string, id sdk.SchemaObjectIdentifierWithArguments, runtimeVersion string, returnType datatypes.DataType, handler string, functionDefinition string) *FunctionPythonModel {
- return FunctionPython(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), runtimeVersion, id.SchemaName()).WithFunctionDefinitionValue(config.MultilineWrapperVariable(functionDefinition))
+ return FunctionPython(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), runtimeVersion, id.SchemaName()).WithFunctionDefinition(functionDefinition)
}
func (f *FunctionPythonModel) WithArgument(argName string, argDataType datatypes.DataType) *FunctionPythonModel {
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_python_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/function_python_model_gen.go
index 8c0ca5904e..261f683bbd 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_python_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_python_model_gen.go
@@ -129,7 +129,7 @@ func (f *FunctionPythonModel) WithFullyQualifiedName(fullyQualifiedName string)
}
func (f *FunctionPythonModel) WithFunctionDefinition(functionDefinition string) *FunctionPythonModel {
- f.FunctionDefinition = tfconfig.StringVariable(functionDefinition)
+ f.FunctionDefinition = config.MultilineWrapperVariable(functionDefinition)
return f
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_scala_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/function_scala_model_ext.go
index bf81948f58..a0d8fa7829 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_scala_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_scala_model_ext.go
@@ -5,7 +5,6 @@ import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/collections"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
@@ -19,7 +18,7 @@ func FunctionScalaBasicInline(
handler string,
functionDefinition string,
) *FunctionScalaModel {
- return FunctionScala(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), runtimeVersion, id.SchemaName()).WithFunctionDefinitionValue(config.MultilineWrapperVariable(functionDefinition))
+ return FunctionScala(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), runtimeVersion, id.SchemaName()).WithFunctionDefinition(functionDefinition)
}
func (f *FunctionScalaModel) WithArgument(argName string, argDataType datatypes.DataType) *FunctionScalaModel {
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_scala_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/function_scala_model_gen.go
index a3f338847a..0a38b6871c 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_scala_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_scala_model_gen.go
@@ -129,7 +129,7 @@ func (f *FunctionScalaModel) WithFullyQualifiedName(fullyQualifiedName string) *
}
func (f *FunctionScalaModel) WithFunctionDefinition(functionDefinition string) *FunctionScalaModel {
- f.FunctionDefinition = tfconfig.StringVariable(functionDefinition)
+ f.FunctionDefinition = config.MultilineWrapperVariable(functionDefinition)
return f
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_sql_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/function_sql_model_ext.go
index 32c1cc7325..65638e4daf 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_sql_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_sql_model_ext.go
@@ -3,14 +3,12 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
)
func FunctionSqlBasicInline(resourceName string, id sdk.SchemaObjectIdentifierWithArguments, functionDefinition string, returnType string) *FunctionSqlModel {
- return FunctionSql(resourceName, id.DatabaseName(), functionDefinition, id.Name(), returnType, id.SchemaName()).
- WithFunctionDefinitionValue(config.MultilineWrapperVariable(functionDefinition))
+ return FunctionSql(resourceName, id.DatabaseName(), functionDefinition, id.Name(), returnType, id.SchemaName())
}
func (f *FunctionSqlModel) WithArgument(argName string, argDataType datatypes.DataType) *FunctionSqlModel {
diff --git a/pkg/acceptance/bettertestspoc/config/model/function_sql_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/function_sql_model_gen.go
index acc101088a..e754a3d28b 100644
--- a/pkg/acceptance/bettertestspoc/config/model/function_sql_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/function_sql_model_gen.go
@@ -115,7 +115,7 @@ func (f *FunctionSqlModel) WithFullyQualifiedName(fullyQualifiedName string) *Fu
}
func (f *FunctionSqlModel) WithFunctionDefinition(functionDefinition string) *FunctionSqlModel {
- f.FunctionDefinition = tfconfig.StringVariable(functionDefinition)
+ f.FunctionDefinition = config.MultilineWrapperVariable(functionDefinition)
return f
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/gen/model.go b/pkg/acceptance/bettertestspoc/config/model/gen/model.go
index 2d2908468c..c32282fa98 100644
--- a/pkg/acceptance/bettertestspoc/config/model/gen/model.go
+++ b/pkg/acceptance/bettertestspoc/config/model/gen/model.go
@@ -29,6 +29,7 @@ type ResourceConfigBuilderAttributeModel struct {
AttributeType string
Required bool
VariableMethod string
+ MethodImport string
}
func ModelFromResourceSchemaDetails(resourceSchemaDetails genhelpers.ResourceSchemaDetails) ResourceConfigBuilderModel {
@@ -38,6 +39,17 @@ func ModelFromResourceSchemaDetails(resourceSchemaDetails genhelpers.ResourceSch
continue
}
+ if v, ok := multilineAttributesOverrides[resourceSchemaDetails.Name]; ok && slices.Contains(v, attr.Name) && attr.AttributeType == schema.TypeString {
+ attributes = append(attributes, ResourceConfigBuilderAttributeModel{
+ Name: attr.Name,
+ AttributeType: "string",
+ Required: attr.Required,
+ VariableMethod: "MultilineWrapperVariable",
+ MethodImport: "config",
+ })
+ continue
+ }
+
// TODO [SNOW-1501905]: support the rest of attribute types
var attributeType string
var variableMethod string
@@ -61,6 +73,7 @@ func ModelFromResourceSchemaDetails(resourceSchemaDetails genhelpers.ResourceSch
AttributeType: attributeType,
Required: attr.Required,
VariableMethod: variableMethod,
+ MethodImport: "tfconfig",
})
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/gen/multiline_attributes_overrides.go b/pkg/acceptance/bettertestspoc/config/model/gen/multiline_attributes_overrides.go
new file mode 100644
index 0000000000..1faa489bba
--- /dev/null
+++ b/pkg/acceptance/bettertestspoc/config/model/gen/multiline_attributes_overrides.go
@@ -0,0 +1,17 @@
+package gen
+
+var multilineAttributesOverrides = map[string][]string{
+ "User": {"rsa_public_key", "rsa_public_key_2"},
+ "ServiceUser": {"rsa_public_key", "rsa_public_key_2"},
+ "LegacyServiceUser": {"rsa_public_key", "rsa_public_key_2"},
+ "FunctionJava": {"function_definition"},
+ "FunctionJavascript": {"function_definition"},
+ "FunctionPython": {"function_definition"},
+ "FunctionScala": {"function_definition"},
+ "FunctionSql": {"function_definition"},
+ "ProcedureJava": {"procedure_definition"},
+ "ProcedureJavascript": {"procedure_definition"},
+ "ProcedurePython": {"procedure_definition"},
+ "ProcedureScala": {"procedure_definition"},
+ "ProcedureSql": {"procedure_definition"},
+}
diff --git a/pkg/acceptance/bettertestspoc/config/model/gen/templates/builders.tmpl b/pkg/acceptance/bettertestspoc/config/model/gen/templates/builders.tmpl
index 6dd7a54c7b..dca9e9e383 100644
--- a/pkg/acceptance/bettertestspoc/config/model/gen/templates/builders.tmpl
+++ b/pkg/acceptance/bettertestspoc/config/model/gen/templates/builders.tmpl
@@ -11,7 +11,7 @@
{{- $attributeNameCamel := SnakeCaseToCamel .Name -}}
{{ if .AttributeType }}
func ({{ $modelVar }} *{{ $modelName }}) With{{ $attributeNameCamel }}({{ FirstLetterLowercase $attributeNameCamel }} {{ .AttributeType }}) *{{ $modelName }} {
- {{ $modelVar }}.{{ $attributeNameCamel }} = tfconfig.{{ .VariableMethod }}({{ FirstLetterLowercase $attributeNameCamel }})
+ {{ $modelVar }}.{{ $attributeNameCamel }} = {{ .MethodImport }}.{{ .VariableMethod }}({{ FirstLetterLowercase $attributeNameCamel }})
return {{ $modelVar }}
}
{{ else }}
diff --git a/pkg/acceptance/bettertestspoc/config/model/legacy_service_user_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/legacy_service_user_model_gen.go
index cd169d1dd2..3935ee5a40 100644
--- a/pkg/acceptance/bettertestspoc/config/model/legacy_service_user_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/legacy_service_user_model_gen.go
@@ -383,12 +383,12 @@ func (l *LegacyServiceUserModel) WithRowsPerResultset(rowsPerResultset int) *Leg
}
func (l *LegacyServiceUserModel) WithRsaPublicKey(rsaPublicKey string) *LegacyServiceUserModel {
- l.RsaPublicKey = tfconfig.StringVariable(rsaPublicKey)
+ l.RsaPublicKey = config.MultilineWrapperVariable(rsaPublicKey)
return l
}
func (l *LegacyServiceUserModel) WithRsaPublicKey2(rsaPublicKey2 string) *LegacyServiceUserModel {
- l.RsaPublicKey2 = tfconfig.StringVariable(rsaPublicKey2)
+ l.RsaPublicKey2 = config.MultilineWrapperVariable(rsaPublicKey2)
return l
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_ext.go
index 3440012ee5..ce9dd69bc2 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_ext.go
@@ -3,7 +3,6 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/collections"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
@@ -17,7 +16,7 @@ func ProcedureJavaBasicInline(
procedureDefinition string,
) *ProcedureJavaModel {
return ProcedureJava(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), "11", id.SchemaName(), "1.14.0").
- WithProcedureDefinitionValue(config.MultilineWrapperVariable(procedureDefinition))
+ WithProcedureDefinition(procedureDefinition)
}
func ProcedureJavaBasicStaged(
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_gen.go
index 3bbc9cf011..6dba752344 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_java_model_gen.go
@@ -173,7 +173,7 @@ func (p *ProcedureJavaModel) WithNullInputBehavior(nullInputBehavior string) *Pr
// packages attribute type is not yet supported, so WithPackages can't be generated
func (p *ProcedureJavaModel) WithProcedureDefinition(procedureDefinition string) *ProcedureJavaModel {
- p.ProcedureDefinition = tfconfig.StringVariable(procedureDefinition)
+ p.ProcedureDefinition = config.MultilineWrapperVariable(procedureDefinition)
return p
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_ext.go
index 5e1af42056..35b693c003 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_ext.go
@@ -3,7 +3,6 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
)
@@ -14,8 +13,7 @@ func ProcedureJavascriptBasicInline(
returnType datatypes.DataType,
procedureDefinition string,
) *ProcedureJavascriptModel {
- return ProcedureJavascript(resourceName, id.DatabaseName(), id.Name(), procedureDefinition, returnType.ToSql(), id.SchemaName()).
- WithProcedureDefinitionValue(config.MultilineWrapperVariable(procedureDefinition))
+ return ProcedureJavascript(resourceName, id.DatabaseName(), id.Name(), procedureDefinition, returnType.ToSql(), id.SchemaName())
}
func (f *ProcedureJavascriptModel) WithArgument(argName string, argDataType datatypes.DataType) *ProcedureJavascriptModel {
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_gen.go
index 4ff708234e..d4ed04afd8 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_javascript_model_gen.go
@@ -146,7 +146,7 @@ func (p *ProcedureJavascriptModel) WithNullInputBehavior(nullInputBehavior strin
}
func (p *ProcedureJavascriptModel) WithProcedureDefinition(procedureDefinition string) *ProcedureJavascriptModel {
- p.ProcedureDefinition = tfconfig.StringVariable(procedureDefinition)
+ p.ProcedureDefinition = config.MultilineWrapperVariable(procedureDefinition)
return p
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_ext.go
index fa65b15d42..6e48b14fed 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_ext.go
@@ -3,7 +3,6 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/collections"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
@@ -17,7 +16,7 @@ func ProcedurePythonBasicInline(
procedureDefinition string,
) *ProcedurePythonModel {
return ProcedurePython(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), "3.8", id.SchemaName(), "1.14.0").
- WithProcedureDefinitionValue(config.MultilineWrapperVariable(procedureDefinition))
+ WithProcedureDefinition(procedureDefinition)
}
func (f *ProcedurePythonModel) WithArgument(argName string, argDataType datatypes.DataType) *ProcedurePythonModel {
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_gen.go
index 330e269b45..6e7dd95e2c 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_python_model_gen.go
@@ -172,7 +172,7 @@ func (p *ProcedurePythonModel) WithNullInputBehavior(nullInputBehavior string) *
// packages attribute type is not yet supported, so WithPackages can't be generated
func (p *ProcedurePythonModel) WithProcedureDefinition(procedureDefinition string) *ProcedurePythonModel {
- p.ProcedureDefinition = tfconfig.StringVariable(procedureDefinition)
+ p.ProcedureDefinition = config.MultilineWrapperVariable(procedureDefinition)
return p
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_ext.go
index a307f5b198..69ddb67485 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_ext.go
@@ -3,7 +3,6 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/internal/collections"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
@@ -17,7 +16,7 @@ func ProcedureScalaBasicInline(
procedureDefinition string,
) *ProcedureScalaModel {
return ProcedureScala(resourceName, id.DatabaseName(), handler, id.Name(), returnType.ToSql(), "2.12", id.SchemaName(), "1.14.0").
- WithProcedureDefinitionValue(config.MultilineWrapperVariable(procedureDefinition))
+ WithProcedureDefinition(procedureDefinition)
}
func ProcedureScalaBasicStaged(
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_gen.go
index 4ec12d5ebf..ee0ae718bf 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_scala_model_gen.go
@@ -173,7 +173,7 @@ func (p *ProcedureScalaModel) WithNullInputBehavior(nullInputBehavior string) *P
// packages attribute type is not yet supported, so WithPackages can't be generated
func (p *ProcedureScalaModel) WithProcedureDefinition(procedureDefinition string) *ProcedureScalaModel {
- p.ProcedureDefinition = tfconfig.StringVariable(procedureDefinition)
+ p.ProcedureDefinition = config.MultilineWrapperVariable(procedureDefinition)
return p
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_ext.go b/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_ext.go
index a266504b2f..d41791dfaa 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_ext.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_ext.go
@@ -3,7 +3,6 @@ package model
import (
tfconfig "github.com/hashicorp/terraform-plugin-testing/config"
- "github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/acceptance/bettertestspoc/config"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk"
"github.com/Snowflake-Labs/terraform-provider-snowflake/pkg/sdk/datatypes"
)
@@ -14,8 +13,7 @@ func ProcedureSqlBasicInline(
returnType datatypes.DataType,
procedureDefinition string,
) *ProcedureSqlModel {
- return ProcedureSql(resourceName, id.DatabaseName(), id.Name(), procedureDefinition, returnType.ToSql(), id.SchemaName()).
- WithProcedureDefinitionValue(config.MultilineWrapperVariable(procedureDefinition))
+ return ProcedureSql(resourceName, id.DatabaseName(), id.Name(), procedureDefinition, returnType.ToSql(), id.SchemaName())
}
func (f *ProcedureSqlModel) WithArgument(argName string, argDataType datatypes.DataType) *ProcedureSqlModel {
diff --git a/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_gen.go
index 1d020ac852..1c559b7539 100644
--- a/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/procedure_sql_model_gen.go
@@ -146,7 +146,7 @@ func (p *ProcedureSqlModel) WithNullInputBehavior(nullInputBehavior string) *Pro
}
func (p *ProcedureSqlModel) WithProcedureDefinition(procedureDefinition string) *ProcedureSqlModel {
- p.ProcedureDefinition = tfconfig.StringVariable(procedureDefinition)
+ p.ProcedureDefinition = config.MultilineWrapperVariable(procedureDefinition)
return p
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/service_user_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/service_user_model_gen.go
index d98651c133..0f38e0ade5 100644
--- a/pkg/acceptance/bettertestspoc/config/model/service_user_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/service_user_model_gen.go
@@ -371,12 +371,12 @@ func (s *ServiceUserModel) WithRowsPerResultset(rowsPerResultset int) *ServiceUs
}
func (s *ServiceUserModel) WithRsaPublicKey(rsaPublicKey string) *ServiceUserModel {
- s.RsaPublicKey = tfconfig.StringVariable(rsaPublicKey)
+ s.RsaPublicKey = config.MultilineWrapperVariable(rsaPublicKey)
return s
}
func (s *ServiceUserModel) WithRsaPublicKey2(rsaPublicKey2 string) *ServiceUserModel {
- s.RsaPublicKey2 = tfconfig.StringVariable(rsaPublicKey2)
+ s.RsaPublicKey2 = config.MultilineWrapperVariable(rsaPublicKey2)
return s
}
diff --git a/pkg/acceptance/bettertestspoc/config/model/user_model_gen.go b/pkg/acceptance/bettertestspoc/config/model/user_model_gen.go
index f2c945fbf3..24f9df7743 100644
--- a/pkg/acceptance/bettertestspoc/config/model/user_model_gen.go
+++ b/pkg/acceptance/bettertestspoc/config/model/user_model_gen.go
@@ -413,12 +413,12 @@ func (u *UserModel) WithRowsPerResultset(rowsPerResultset int) *UserModel {
}
func (u *UserModel) WithRsaPublicKey(rsaPublicKey string) *UserModel {
- u.RsaPublicKey = tfconfig.StringVariable(rsaPublicKey)
+ u.RsaPublicKey = config.MultilineWrapperVariable(rsaPublicKey)
return u
}
func (u *UserModel) WithRsaPublicKey2(rsaPublicKey2 string) *UserModel {
- u.RsaPublicKey2 = tfconfig.StringVariable(rsaPublicKey2)
+ u.RsaPublicKey2 = config.MultilineWrapperVariable(rsaPublicKey2)
return u
}
diff --git a/pkg/datasources/users_acceptance_test.go b/pkg/datasources/users_acceptance_test.go
index 69b687a9cc..e4355d8f79 100644
--- a/pkg/datasources/users_acceptance_test.go
+++ b/pkg/datasources/users_acceptance_test.go
@@ -46,8 +46,8 @@ func TestAcc_Users_PersonUser(t *testing.T) {
WithDefaultRole("some_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
WithMinsToBypassMfa(10).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)).
+ WithRsaPublicKey(key1).
+ WithRsaPublicKey2(key2).
WithComment(comment).
WithDisableMfa("true")
@@ -204,8 +204,8 @@ func TestAcc_Users_ServiceUser(t *testing.T) {
WithDefaultNamespace("some.namespace").
WithDefaultRole("some_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)).
+ WithRsaPublicKey(key1).
+ WithRsaPublicKey2(key2).
WithComment(comment)
resource.Test(t, resource.TestCase{
@@ -364,8 +364,8 @@ func TestAcc_Users_LegacyServiceUser(t *testing.T) {
WithDefaultNamespace("some.namespace").
WithDefaultRole("some_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)).
+ WithRsaPublicKey(key1).
+ WithRsaPublicKey2(key2).
WithComment(comment)
resource.Test(t, resource.TestCase{
diff --git a/pkg/resources/external_table.go b/pkg/resources/external_table.go
index bd03b75bf6..9cdb256359 100644
--- a/pkg/resources/external_table.go
+++ b/pkg/resources/external_table.go
@@ -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,
diff --git a/pkg/resources/legacy_service_user_acceptance_test.go b/pkg/resources/legacy_service_user_acceptance_test.go
index 1931d4a1dc..f078648ddc 100644
--- a/pkg/resources/legacy_service_user_acceptance_test.go
+++ b/pkg/resources/legacy_service_user_acceptance_test.go
@@ -56,8 +56,8 @@ func TestAcc_LegacyServiceUser_BasicFlows(t *testing.T) {
WithDefaultNamespace("some.namespace").
WithDefaultRole("some_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)).
+ WithRsaPublicKey(key1).
+ WithRsaPublicKey2(key2).
WithComment(comment)
userModelAllAttributesChanged := func(loginName string) *model.LegacyServiceUserModel {
@@ -74,8 +74,8 @@ func TestAcc_LegacyServiceUser_BasicFlows(t *testing.T) {
WithDefaultNamespace("one_part_namespace").
WithDefaultRole("other_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key2)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key1)).
+ WithRsaPublicKey(key2).
+ WithRsaPublicKey2(key1).
WithComment(newComment)
}
diff --git a/pkg/resources/service_user_acceptance_test.go b/pkg/resources/service_user_acceptance_test.go
index 319b8ab61c..d511079981 100644
--- a/pkg/resources/service_user_acceptance_test.go
+++ b/pkg/resources/service_user_acceptance_test.go
@@ -51,8 +51,8 @@ func TestAcc_ServiceUser_BasicFlows(t *testing.T) {
WithDefaultNamespace("some.namespace").
WithDefaultRole("some_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)).
+ WithRsaPublicKey(key1).
+ WithRsaPublicKey2(key2).
WithComment(comment)
userModelAllAttributesChanged := func(loginName string) *model.ServiceUserModel {
@@ -67,8 +67,8 @@ func TestAcc_ServiceUser_BasicFlows(t *testing.T) {
WithDefaultNamespace("one_part_namespace").
WithDefaultRole("other_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key2)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key1)).
+ WithRsaPublicKey(key2).
+ WithRsaPublicKey2(key1).
WithComment(newComment)
}
diff --git a/pkg/resources/stage.go b/pkg/resources/stage.go
index e2ac46ed96..b2fde2bb80 100644
--- a/pkg/resources/stage.go
+++ b/pkg/resources/stage.go
@@ -57,7 +57,7 @@ var stageSchema = map[string]*schema.Schema{
"file_format": {
Type: schema.TypeString,
Optional: true,
- Description: "Specifies the file format for the stage. Specifying the default Snowflake value (e.g. TYPE = CSV) will currently result in a permadiff (check [#2679](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2679)). For now, omit the default values; it will be fixed in the upcoming provider versions.",
+ Description: "Specifies the file format for the stage. Specifying the default Snowflake value (e.g. TYPE = CSV) will currently result in a permadiff (check [#2679](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/2679)). For now, omit the default values; it will be fixed in the upcoming provider versions. Examples of usage: 1. with hardcoding value: `file_format=\"FORMAT_NAME = DB.SCHEMA.FORMATNAME\"` 2. from dynamic value: `file_format = \"FORMAT_NAME = ${snowflake_file_format.myfileformat.fully_qualified_name}\"` 3. from expression: `file_format = format(\"FORMAT_NAME =%s.%s.MYFILEFORMAT\", var.db_name, each.value.schema_name)`. Reference: [#265](https://github.com/Snowflake-Labs/terraform-provider-snowflake/issues/265)",
DiffSuppressFunc: suppressQuoting,
},
"copy_options": {
diff --git a/pkg/resources/user_acceptance_test.go b/pkg/resources/user_acceptance_test.go
index 373e5b6914..4f75ab59ef 100644
--- a/pkg/resources/user_acceptance_test.go
+++ b/pkg/resources/user_acceptance_test.go
@@ -64,8 +64,8 @@ func TestAcc_User_BasicFlows(t *testing.T) {
WithDefaultRole("some_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
WithMinsToBypassMfa(10).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key1)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key2)).
+ WithRsaPublicKey(key1).
+ WithRsaPublicKey2(key2).
WithComment(comment).
WithDisableMfa("true")
@@ -87,8 +87,8 @@ func TestAcc_User_BasicFlows(t *testing.T) {
WithDefaultRole("other_role").
WithDefaultSecondaryRolesOptionEnum(sdk.SecondaryRolesOptionAll).
WithMinsToBypassMfa(14).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key2)).
- WithRsaPublicKey2Value(config.MultilineWrapperVariable(key1)).
+ WithRsaPublicKey(key2).
+ WithRsaPublicKey2(key1).
WithComment(newComment).
WithDisableMfa("false")
}
@@ -696,15 +696,15 @@ func TestAcc_User_issue2970(t *testing.T) {
userModel := model.User(resourceName, userId.Name()).
WithPassword(pass).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(key))
+ WithRsaPublicKey(key)
newUserModelIncorrectNewKey := model.User(resourceName, userId.Name()).
WithPassword(newPass).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(incorrectlyFormattedNewKey))
+ WithRsaPublicKey(incorrectlyFormattedNewKey)
newUserModel := model.User(resourceName, userId.Name()).
WithPassword(newPass).
- WithRsaPublicKeyValue(config.MultilineWrapperVariable(newKey))
+ WithRsaPublicKey(newKey)
resource.Test(t, resource.TestCase{
ProtoV6ProviderFactories: acc.TestAccProtoV6ProviderFactories,