-
Notifications
You must be signed in to change notification settings - Fork 218
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
Unable to move alert rules between rule groups #1332
Comments
I'd say that's expected, rule names are unique and a rule group can't take control of an existing rule. You can either destroy and recreate the resources completely or, if possible, apply an intermediate state (pretty much was is happening in your "Alternatively" steps). What would you expect to happen here (Considering Terraform's limitation that each resource is independent)? |
Rule group recreation or intermediate state would be ok in a simple scenario such as in the example. However, if you manage multiple rule groups with numerous rules, I would expect moving rules between rule groups, or taking an existing rule and creating a new rule group for it without having to change the rule's name would be seamless and done via one apply. From a technical standpoint, I would expect Terraform to either handle this error and retry (since the issue seems to be that new rule creation occurs before the previous one is destroyed, and that's why the second apply in "Alternatively" succeeds), or first destroy the rule and then try to create a new one. |
There is nothing in Terraform that allows me to fix the first case. Changes to each rule group is a conflict. Retries would not work there because none of the new resources are valid and Terraform does not give me information about other resources, so I can't know that we're switching rules between two resources. The provider also shouldn't act on anything that isn't imported into state (so I can't/shouldn't really go and delete the rule from the second group, while applying the first group), because that would be extremely unexpected behaviour. The only thing I can think of is for you to |
The first case is indeed problematic. |
Yes, it's possible to add a retry for that case |
Terraform Version
Affected Resource(s)
Terraform Configuration Files
Expected Behavior
Alert rules are moved between rule groups.
Actual Behavior
Apply fails with error.
Steps to Reproduce
There are multiple ways to get this error:
test
with ruletest
andtest2
with ruletest2
in the same folder.Alternatively:
test
with alert ruletest
.test2
with alert ruletest
, rename alert rule in rule grouptest
totest2
.Or:
test
with alert rulestest
andtest3
.test2
with alert ruletest2
.test2
to rule grouptest
and comment out rule grouptest2
to destroy it.References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:
The text was updated successfully, but these errors were encountered: