-
Notifications
You must be signed in to change notification settings - Fork 420
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
Bug report: Resource Monitors can not change triggers arguments without changing the credit_quota argument #1500
Comments
@sfc-gh-jlove this appears to be a syntax issue when modifying resource monitors triggers only, it adds |
I have a similar issue using TF Snowflake Provider v0.70.1 when I would like to update an existing Ressource Monitor with "notify_triggers", "notify_users", and "supend_immediate_trigger". Before: resource "snowflake_resource_monitor" "my_monitor" {
name = "MY_MONITOR"
credit_quota = 44 # per month
warehouses = "MY_WAREHOUSE"
} After: resource "snowflake_resource_monitor" "my_monitor" {
name = "MY_MONITOR"
credit_quota = 44 # per month
warehouses = "MY_WAREHOUSE"
notify_triggers = [50, 100] # Add
notify_users = ["MY_USER"] # Add
suspend_immediate_trigger = 100 # Add
} Error: error updating resource monitor MY_MONITOR
001003 (42000): SQL compilation error:
syntax error line 1 at position 62 unexpected 'ON'.
syntax error line 1 at position 77 unexpected 'DO'.
syntax error line 1 at position 98 unexpected 'ON'.
syntax error line 1 at position 112 unexpected 'DO'.
syntax error line 1 at position 122 unexpected 'ON'.
syntax error line 1 at position 137 unexpected 'DO'.
syntax error line 1 at position 146 unexpected '<EOF>'.�[0m
with snowflake_resource_monitor.my_monitor,
on resource_monitors.tf line 1, in resource "snowflake_resource_monitor" "my_monitor":
1: resource "snowflake_resource_monitor" "my_monitor" As temporary solution, destroy and recreate the RessourceMonitor works but you can loose Ressource Monitor current quota usage. |
Hi all 👋 |
## Changes - Add ValuePresent assert to our custom assertions - Add ToConfigValues function for every model - Update Resource Monitor SDK + unit and integration tests - Update Resource Monitor Resource + acc tests - Handle issues connected to the resource monitor (mostly timestamp format difference causing infinite plan or only trigger updates causing SQL compilation error): - #1500 - #1624 - #1716 - #1754 - #1821 - #1832 - #1990 ## Next pr - Adjust examples and update migration notes - Data source (impl, tests, examples, migration notes) ## References * [CREATE RESOURCE MONITOR](https://docs.snowflake.com/en/sql-reference/sql/create-resource-monitor)
## Changes - Add ValuePresent assert to our custom assertions - Add ToConfigValues function for every model - Update Resource Monitor SDK + unit and integration tests - Update Resource Monitor Resource + acc tests - Handle issues connected to the resource monitor (mostly timestamp format difference causing infinite plan or only trigger updates causing SQL compilation error): - #1500 - #1624 - #1716 - #1754 - #1821 - #1832 - #1990 ## Next pr - Adjust examples and update migration notes - Data source (impl, tests, examples, migration notes) ## References * [CREATE RESOURCE MONITOR](https://docs.snowflake.com/en/sql-reference/sql/create-resource-monitor)
Hey 👋 |
Closing due to long inactivity. Please, create another issue if you think the problem is still not resolved. |
Provider Version
v0.55.0
Terraform Version
1.28
Describe the bug
The snowflake provider 0.55.0 allows for Resource Monitors to change the "credit_quota" argument without running a drop/create command. However, when changing the following arguments:
the compiled SnowSQL returns an error.
Expected behavior
Terraform apply will be successful.
Code samples and commands
The Resource Monitor resource, using a user assigned the accountadmin role:
resource "snowflake_resource_monitor" "resource_monitor" { name = "resource_monitor_test" credit_quota = 100 notify_triggers = [ 50 ] suspend_triggers = [ 100 ] suspend_immediate_triggers = [ 105 ] }
Changing "notify_trigger" argument
resource "snowflake_resource_monitor" "resource_monitor" { name = "resource_monitor_test" credit_quota = 100 notify_triggers = [ 55 ] suspend_triggers = [ 100 ] suspend_immediate_triggers = [ 105 ] }
Returns the following error message:
│ 001003 (42000): SQL compilation error:
│ syntax error line 1 at position 57 unexpected 'ON'.
│ syntax error line 1 at position 72 unexpected 'DO'.
│ syntax error line 1 at position 83 unexpected 'ON'.
│ syntax error line 1 at position 98 unexpected 'DO'.
│ syntax error line 1 at position 119 unexpected 'ON'.
│ syntax error line 1 at position 133 unexpected 'DO'.
│ syntax error line 1 at position 143 unexpected 'ON'.
│ syntax error line 1 at position 157 unexpected 'DO'.
│ syntax error line 1 at position 166 unexpected ''.
Additional context
Investigation into the compiled SnowSQL:
ALTER RESOURCE MONITOR "RESOURCE_MONITOR_TEST" SET TRIGGERS ON 100 PERCENT DO SUSPEND ON 105 PERCENT DO SUSPEND_IMMEDIATE ON 55 PERCENT DO NOTIFY ;
A possible solution, is to have the compiled SnowSQL to have the "credit_quota" present, even if the the argument has not changed:
ALTER RESOURCE MONITOR "RESOURCE_MONITOR_TEST" SET CREDIT_QUOTA = 100 TRIGGERS ON 100 PERCENT DO SUSPEND ON 105 PERCENT DO SUSPEND_IMMEDIATE ON 55 PERCENT DO NOTIFY ;
The text was updated successfully, but these errors were encountered: