Skip to content

Commit

Permalink
Merge branch 'v1-ready' into v1-ready-disclaimers
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jmichalak committed Dec 12, 2024
2 parents 27ee0b9 + 698c1f9 commit 3be287b
Show file tree
Hide file tree
Showing 84 changed files with 3,707 additions and 38 deletions.
34 changes: 34 additions & 0 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,40 @@ Additionally, `JWT` value is no longer available for `authenticator` field in th

## v0.99.0 ➞ v0.100.0

### *(preview feature/deprecation)* Function and procedure resources

`snowflake_function` is now deprecated in favor of 5 new preview resources:

- `snowflake_function_java`
- `snowflake_function_javascript`
- `snowflake_function_python`
- `snowflake_function_scala`
- `snowflake_function_sql`

It will be removed with the v1 release. Please check the docs for the new resources and adjust your configuration files.
For no downtime migration, follow our [guide](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md).

The new resources are more aligned with current features like:
- external access integrations support
- secrets support
- argument default values

`snowflake_procedure` is now deprecated in favor of 5 new preview resources:

- `snowflake_procedure_java`
- `snowflake_procedure_javascript`
- `snowflake_procedure_python`
- `snowflake_procedure_scala`
- `snowflake_procedure_sql`

It will be removed with the v1 release. Please check the docs for the new resources and adjust your configuration files.
For no downtime migration, follow our [guide](https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/docs/technical-documentation/resource_migration.md).

The new resources are more aligned with current features like:
- external access integrations support
- secrets support
- argument default values

### *(new feature)* Account role data source
Added a new `snowflake_account_roles` data source for account roles. Now it reflects It's based on `snowflake_roles` data source.
`account_roles` field now organizes output of show under `show_output` field.
Expand Down
2 changes: 2 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ provider "snowflake" {
<!-- Section of deprecated resources -->
## Currently deprecated resources

- [snowflake_function](./docs/resources/function)
- [snowflake_procedure](./docs/resources/procedure)
- [snowflake_unsafe_execute](./docs/resources/unsafe_execute) - use [snowflake_execute](./docs/resources/execute) instead

<!-- Section of deprecated data sources -->
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/function.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ description: |-

# snowflake_function (Resource)


~> **Deprecation** This resource is deprecated and will be removed in a future major version release. Please use snowflake_function_java, snowflake_function_javascript, snowflake_function_python, snowflake_function_scala, and snowflake_function_sql instead. <deprecation>

## Example Usage

Expand Down
46 changes: 45 additions & 1 deletion docs/resources/function_java.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,44 @@ description: |-

!> **Caution: Preview Feature** This feature is considered a preview feature in the provider, regardless of the state of the resource in Snowflake. We do not guarantee its stability. It will be reworked and marked as a stable feature in future releases. Breaking changes are expected, even without bumping the major version. To use this feature, add the relevant feature name to `preview_features_enabled field` in the [provider configuration](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs#schema). Please always refer to the [Getting Help](https://github.com/Snowflake-Labs/terraform-provider-snowflake?tab=readme-ov-file#getting-help) section in our Github repo to best determine how to get help for your questions.

-> **Note** External changes to `is_secure`, `return_results_behavior`, and `null_input_behavior` are not currently supported. They will be handled in the following versions of the provider which may still affect this resource.

-> **Note** `COPY GRANTS` and `OR REPLACE` are not currently supported.

-> **Note** `RETURN... [[ NOT ] NULL]` is not currently supported. It will be improved in the following versions of the provider which may still affect this resource.

-> **Note** Use of return type `TABLE` is currently limited. It will be improved in the following versions of the provider which may still affect this resource.

-> **Note** Snowflake is not returning full data type information for arguments which may lead to unexpected plan outputs. Diff suppression for such cases will be improved.

-> **Note** Snowflake is not returning the default values for arguments so argument's `arg_default_value` external changes cannot be tracked.

-> **Note** Limit the use of special characters (`.`, `'`, `/`, `"`, `(`, `)`, `[`, `]`, `{`, `}`, ` `) in argument names, stage ids, and secret ids. It's best to limit to only alphanumeric and underscores. There is a lot of parsing of SHOW/DESCRIBE outputs involved and using special characters may limit the possibility to achieve the correct results.

~> **Required warehouse** This resource may require active warehouse. Please, make sure you have either set a DEFAULT_WAREHOUSE for the user, or specified a warehouse in the provider configuration.

# snowflake_function_java (Resource)

Resource used to manage java function objects. For more information, check [function documentation](https://docs.snowflake.com/en/sql-reference/sql/create-function).


## Example Usage

```terraform
resource "snowflake_function_java" "w" {
database = "Database"
schema = "Schema"
name = "Name"
arguments {
arg_data_type = "VARCHAR(100)"
arg_name = "x"
}
return_type = "VARCHAR(100)"
handler = "TestFunc.echoVarchar"
function_definition = "\n\tclass TestFunc {\n\t\tpublic static String echoVarchar(String x) {\n\t\t\treturn x;\n\t\t}\n\t}\n"
}
```
-> **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).
<!-- TODO(SNOW-1634854): include an example showing both methods-->

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -175,3 +208,14 @@ Read-Only:
- `schema_name` (String)
- `secrets` (String)
- `valid_for_clustering` (Boolean)

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_function_java.example '"<database_name>"."<schema_name>"."<function_name>"(varchar, varchar, varchar)'
```

Note: Snowflake is not returning all information needed to populate the state correctly after import (e.g. data types with attributes like NUMBER(32, 10) are returned as NUMBER, default values for arguments are not returned at all).
Also, `ALTER` for functions is very limited so most of the attributes on this resource are marked as force new. Because of that, in multiple situations plan won't be empty after importing and manual state operations may be required.
48 changes: 47 additions & 1 deletion docs/resources/function_javascript.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,46 @@ description: |-

!> **Caution: Preview Feature** This feature is considered a preview feature in the provider, regardless of the state of the resource in Snowflake. We do not guarantee its stability. It will be reworked and marked as a stable feature in future releases. Breaking changes are expected, even without bumping the major version. To use this feature, add the relevant feature name to `preview_features_enabled field` in the [provider configuration](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs#schema). Please always refer to the [Getting Help](https://github.com/Snowflake-Labs/terraform-provider-snowflake?tab=readme-ov-file#getting-help) section in our Github repo to best determine how to get help for your questions.

-> **Note** External changes to `is_secure`, `return_results_behavior`, and `null_input_behavior` are not currently supported. They will be handled in the following versions of the provider which may still affect this resource.

-> **Note** `COPY GRANTS` and `OR REPLACE` are not currently supported.

-> **Note** `RETURN... [[ NOT ] NULL]` is not currently supported. It will be improved in the following versions of the provider which may still affect this resource.

-> **Note** Use of return type `TABLE` is currently limited. It will be improved in the following versions of the provider which may still affect this resource.

-> **Note** Snowflake is not returning full data type information for arguments which may lead to unexpected plan outputs. Diff suppression for such cases will be improved.

-> **Note** Snowflake is not returning the default values for arguments so argument's `arg_default_value` external changes cannot be tracked.

-> **Note** Limit the use of special characters (`.`, `'`, `/`, `"`, `(`, `)`, `[`, `]`, `{`, `}`, ` `) in argument names, stage ids, and secret ids. It's best to limit to only alphanumeric and underscores. There is a lot of parsing of SHOW/DESCRIBE outputs involved and using special characters may limit the possibility to achieve the correct results.

~> **Required warehouse** This resource may require active warehouse. Please, make sure you have either set a DEFAULT_WAREHOUSE for the user, or specified a warehouse in the provider configuration.

# snowflake_function_javascript (Resource)

Resource used to manage javascript function objects. For more information, check [function documentation](https://docs.snowflake.com/en/sql-reference/sql/create-function).


## Example Usage

```terraform
# Minimal
resource "snowflake_function_javascript" "minimal" {
database = snowflake_database.test.name
schema = snowflake_schema.test.name
name = "my_javascript_function"
arguments {
arg_data_type = "VARIANT"
arg_name = "x"
}
function_definition = <<EOF
return x;
EOF
return_type = "VARIANT"
}
```
-> **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).
<!-- TODO(SNOW-1634854): include an example showing both methods-->

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -141,3 +176,14 @@ Read-Only:
- `schema_name` (String)
- `secrets` (String)
- `valid_for_clustering` (Boolean)

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_function_javascript.example '"<database_name>"."<schema_name>"."<function_name>"(varchar, varchar, varchar)'
```

Note: Snowflake is not returning all information needed to populate the state correctly after import (e.g. data types with attributes like NUMBER(32, 10) are returned as NUMBER, default values for arguments are not returned at all).
Also, `ALTER` for functions is very limited so most of the attributes on this resource are marked as force new. Because of that, in multiple situations plan won't be empty after importing and manual state operations may be required.
53 changes: 52 additions & 1 deletion docs/resources/function_python.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,51 @@ description: |-

!> **Caution: Preview Feature** This feature is considered a preview feature in the provider, regardless of the state of the resource in Snowflake. We do not guarantee its stability. It will be reworked and marked as a stable feature in future releases. Breaking changes are expected, even without bumping the major version. To use this feature, add the relevant feature name to `preview_features_enabled field` in the [provider configuration](https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs#schema). Please always refer to the [Getting Help](https://github.com/Snowflake-Labs/terraform-provider-snowflake?tab=readme-ov-file#getting-help) section in our Github repo to best determine how to get help for your questions.

-> **Note** External changes to `is_secure`, `return_results_behavior`, and `null_input_behavior` are not currently supported. They will be handled in the following versions of the provider which may still affect this resource.

-> **Note** `COPY GRANTS` and `OR REPLACE` are not currently supported.

-> **Note** `RETURN... [[ NOT ] NULL]` is not currently supported. It will be improved in the following versions of the provider which may still affect this resource.

-> **Note** `is_aggregate` is not currently supported. It will be improved in the following versions of the provider which may still affect this resource.

-> **Note** Use of return type `TABLE` is currently limited. It will be improved in the following versions of the provider which may still affect this resource.

-> **Note** Snowflake is not returning full data type information for arguments which may lead to unexpected plan outputs. Diff suppression for such cases will be improved.

-> **Note** Snowflake is not returning the default values for arguments so argument's `arg_default_value` external changes cannot be tracked.

-> **Note** Limit the use of special characters (`.`, `'`, `/`, `"`, `(`, `)`, `[`, `]`, `{`, `}`, ` `) in argument names, stage ids, and secret ids. It's best to limit to only alphanumeric and underscores. There is a lot of parsing of SHOW/DESCRIBE outputs involved and using special characters may limit the possibility to achieve the correct results.

~> **Required warehouse** This resource may require active warehouse. Please, make sure you have either set a DEFAULT_WAREHOUSE for the user, or specified a warehouse in the provider configuration.

# snowflake_function_python (Resource)

Resource used to manage python function objects. For more information, check [function documentation](https://docs.snowflake.com/en/sql-reference/sql/create-function).


## Example Usage

```terraform
# Minimal
resource "snowflake_function_python" "minimal" {
database = snowflake_database.test.name
schema = snowflake_schema.test.name
name = "my_function_function"
runtime_version = "3.8"
arguments {
arg_data_type = "NUMBER(36, 2)"
arg_name = "x"
}
function_definition = <<EOF
def some_function(x):
return x
EOF
handler = "some_function"
return_type = "NUMBER(36, 2)"
}
```
-> **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).
<!-- TODO(SNOW-1634854): include an example showing both methods-->

<!-- schema generated by tfplugindocs -->
## Schema
Expand Down Expand Up @@ -166,3 +206,14 @@ Read-Only:
- `schema_name` (String)
- `secrets` (String)
- `valid_for_clustering` (Boolean)

## Import

Import is supported using the following syntax:

```shell
terraform import snowflake_function_python.example '"<database_name>"."<schema_name>"."<function_name>"(varchar, varchar, varchar)'
```

Note: Snowflake is not returning all information needed to populate the state correctly after import (e.g. data types with attributes like NUMBER(32, 10) are returned as NUMBER, default values for arguments are not returned at all).
Also, `ALTER` for functions is very limited so most of the attributes on this resource are marked as force new. Because of that, in multiple situations plan won't be empty after importing and manual state operations may be required.
Loading

0 comments on commit 3be287b

Please sign in to comment.