Add support for optional / default arguments for snowflake_procedure resources
Terraform CLI and Provider Versions
Terraform v1.7.5
on darwin_arm64
+ provider registry.terraform.io/snowflake-labs/snowflake v0.87.2
Use Cases or Problem Statement
I am trying to create a Stored Procedure using Terraform that has a default / optional argument, as specified in the Snowflake Documentation. However, there does not appear to be a way to configure within the snowflake_procedure module a way to signify if an argument for a Stored Procedure has a default value.
Proposal
To address this issue, I would propose that the arguments schema within the stored_procedure module has a new optional parameter, default. If this parameter is present, then the value of this parameter is the default value of the argument.
As an example, suppose that the usage of a stored_procedure module is like the following:
name = "SAMPLEPROC"
database = snowflake_database.db.name
schema = snowflake_schema.schema.name
language = "JAVASCRIPT"
arguments {
name = "arg1"
type = "varchar"
}
arguments {
name = "arg2"
type = "varchar"
default = "my_default_value"
}
comment = "Procedure with 2 arguments"
return_type = "VARCHAR"
execute_as = "CALLER"
return_behavior = "IMMUTABLE"
null_input_behavior = "RETURNS NULL ON NULL INPUT"
statement = <<EOT
var X=1
return X
EOT
}
In this example in the generated SnowSQL that was generated in the DDL, argument arg2 would be an optional argument with the default value my_default_value.
How much impact is this issue causing?
Medium
Additional Information
No response
Hey @Erik-vdg. Thanks for reaching out to us.
We are currently working on redesigning existing resources as part of https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#supporting-all-snowflake-ga-features. We will consider it with the procedure resource.
Thank you! I will look forward to the functionality in a future release.
Hi, I'm hoping for the exact same thing, just for functions rather than procedures. Would it be worth creating a separate issue for this?
Hey @deanmorin 👋 Yes, it would be worth it for tracking purposes. The topic is similar, but it's a different resource and we would like to close this one after it's implemented in procedures. If you want to track the change for functions you can create a similar ticket (even reference this one).
Hey @Juniper-vdg.
We introduced new procedure resources in v0.100.0. They are in preview in v1.0.0 and they contain default arguments with some Snowflake limitations. Please check it out and let us know.
Closing due to inactivity.