-
Notifications
You must be signed in to change notification settings - Fork 427
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
feat: add in more functionality for UpdateResourceMonitor #1456
Conversation
Integration tests failure for f9529f4c8c6bf8876f3b0287f94ecd58dc90f2d8 |
Integration tests success for 284080a19c3c728f63f30cb4110b3c85398a38bc |
if runSetStatement { | ||
if err := snowflake.Exec(db, stmt.Statement()); err != nil { | ||
return fmt.Errorf("error updating resource monitor %v\n%w", id, err) | ||
} | ||
} | ||
|
||
// Remove from account | ||
if d.HasChange("set_for_account") && !d.Get("set_for_account").(bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this could be combined with the add to account. something like
if d.HasChange("set_for_account")
old, new := d.GetChange("set_for_account")
if new == nil {
// remove from account
} else {
// set on new account
}
f d.Get("set_
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was intentional the issue is you can't have it set for both an account and a warehouse. So if you are going from setting a resource monitor from the account level to the warehouse level or vice versa you have to make sure it is unset first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case you should also use"ConflictsWith", it works like setting ForceNew on an attirbute. Will prevent people from setting both at the same time.
// ConflictsWith is a set of schema keys that conflict with this schema.
// This will only check that they're set in the _config_. This will not
// raise an error for a malfunctioning resource that sets a conflicting
// key.
ConflictsWith []string
Integration tests success for eea37e6d8a40c945aaa570f461b4a137ccf32e4b |
@sfc-gh-swinkler Addressed all your feedback. |
if runSetStatement { | ||
if err := snowflake.Exec(db, stmt.Statement()); err != nil { | ||
return fmt.Errorf("error updating resource monitor %v\n%w", id, err) | ||
} | ||
} | ||
|
||
// Remove from account | ||
if d.HasChange("set_for_account") && !d.Get("set_for_account").(bool) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in that case you should also use"ConflictsWith", it works like setting ForceNew on an attirbute. Will prevent people from setting both at the same time.
// ConflictsWith is a set of schema keys that conflict with this schema.
// This will only check that they're set in the _config_. This will not
// raise an error for a malfunctioning resource that sets a conflicting
// key.
ConflictsWith []string
Integration tests success for f63d1b5c94095f93a7624a5d30a157511061d3ce |
resource_monitor now can update without creation and delation for
Also fixed a typo in a comment implents to implements
Test Plan
References