terraform-provider-snowflake
terraform-provider-snowflake copied to clipboard
SQL compilation error: An active warehouse is required for creating Python stored procedures.
Provider Version
0.61.0
Terraform Version
1.0.6
Describe the bug
Whilst creating a new Python Stored procedure, I get this error error: creating procedure
Expected behavior
The stored procedure is created without throwing this error.
Code samples and commands
resource "snowflake_procedure" "test_proc" { name = "stored_proc" database = "TEST" schema = "TEST" language = "PYTHON" comment = "whatever" return_type = "STRING" execute_as = "OWNER" runtime_version = "3.8" handler = "main" packages = ["snowflake-snowpark-python", "pandas"] statement = "my python code" }
Additional context
In order to create a Python stored procedure, the warehouse is required to be defined as well. Therefore, an extra argument "warehouse" needs to be added in the resource and the warehouse needs to be used before creating the procedure. @sfc-gh-jhollan was going in the right direction here: https://github.com/Snowflake-Labs/terraform-provider-snowflake/pull/1533/files, but the PR was closed in favour of https://github.com/Snowflake-Labs/terraform-provider-snowflake/pull/1516
I detected a similar problem.
Provider Version 0.86.0
Terraform Version 1.7.3
Hey @pei0804. I will add this to our consideration for the currently ongoing resources redesign (you can check our roadmap: https://github.com/Snowflake-Labs/terraform-provider-snowflake/blob/main/ROADMAP.md#our-roadmap).
This problem has been resolved. It was possible to use Warehouse with properties.
https://registry.terraform.io/providers/Snowflake-Labs/snowflake/latest/docs#warehouse
steps:
grant operate, usage on warehouse xxx_wh to role terraform
$ export SNOWFLAKE_WAREHOUSE:=xxx_wh
$ terraform apply