terraform-provider-newrelic
terraform-provider-newrelic copied to clipboard
Creating a newrelic_workflow with a predicate causes no issues to be found
- [ ] Your New Relic
provider
configuration (sensitive details redacted) - [ ] A list of affected resources and/or data sources
- [ ] The configuration of the resources and/or data sources related to the bug report (i.e. from the list mentioned above)
- [ ] Description of the current behavior (the bug)
- [ ] Description of the expected behavior
- [ ] Any related log output
Terraform Version
1.2.8
Affected Resource(s)
Please list the resources as a list, for example:
-
newrelic_workflow
Terraform Configuration
Please include your
provider
configuration (sensitive details redacted) as well as the configuration of the resources and/or data sources related to the bug report.
provider "newrelic" {
api_key = var.api_key
account_id = var.account_id
region = "US"
}
...
resource "newrelic_workflow" "issue_alerting_workflow" {
account_id = var.account_id
name = "TF_Dev Slack Synthetic Check Alerts"
destinations_enabled = true
muting_rules_handling = "NOTIFY_ALL_ISSUES"
issues_filter {
name = "environment_is_dev"
type = "FILTER"
predicate {
attribute = "tag.environment"
operator = "EXACTLY_MATCHES"
values = ["dev"]
}
}
destination {
channel_id = newrelic_notification_channel.slack_channel.id
}
}
Actual Behavior
A workflow seemed to be created with the correct predicate, but attempting to test the workflow gives the error indicating no issues were found. An identical workflow created manually through the UI works as expected.
Expected Behavior
A workflow should be created that can accurately capture issues with the given predicate.
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
- Create a valid
newrelic_workflow
resource through Terraform with a predicate. My predicate filters ontag.environment EXACTLY_MATCHES "dev"
- Attempt to test the resource through the NR UI
- See warning about no issues found
Debug Output
N/A, the output from Terraform indicates success
Important Factoids
If I manually edit the workflow through the NR UI and recreate the predicate, it works as expected. Furthermore, the auto-complete dropdown for the values in the predicate does not work until I replace the filter tag at the beginning. See screenshots below:
Workflow and predicate created through Terraform - no options available for the filter and the "Test workflow" indicates that no issues can be found
Workflow created through Terraform, predicate removed and recreated manually through the NR UI - options available for filter and the "Test workflow" works as expected
Hi @arhill05, thanks for raising the issue we will prioritise the issue.
Hi! This is not really a bug. The warning just means that none of the issues you have already had match the filter that you defined. It does not necessarily mean that you filter is incorrect (hence a warning instead of an error).
That being said, we do understand that the current behaviour is confusing and there's an ongoing effort to design a better experience. The current plans include an easy way to test your issue filter as well as a way to test workflow even if not issues matching the filter exist. No ETA for any of this at the moment, but this is relatively high on our priority list.
Thanks for the follow up @IliaShurygin!
Unfortunately what you said is not the case for my issue. There are issues that already matched the filter I had defined, and I can successfully test that with a workflow created via the New Relic UI. However, when I try to create the same workflow via Terraform, the issue persists.
@arhill05, interesting. Could you please attach a screenshot of a manually created filter that does work?
Never mind, the screenshots you have already attached should be enough. I'll try to reproduce the issue and will let you know how it goes
Sounds good! If there is any additional info I can provide, I am happy to do so.
I have managed to reproduce the issue and will escalate this as a top priority. Given the nature of the problem (see the explanation below) I cannot give you an ETA for a proper fix right now.
As a temporary solution, let me explain why this happens and how to work around this problem.
The real name of the issue field you are filtering by is accumulations.tag.environment
, and you can actually see it if you fetch your workflows via our GraphQL API:
{
"attribute": "accumulations.tag.environment",
"operator": "EXACTLY_MATCHES",
"values": [
"development"
]
}
The reason why you do not see accumulations.
prefix in the UI is that it is implicitly hidden to avoid visual clutter.
Now, given that TF provider is a first class citizen in NewRelic, this behaviour is clearly very confusing and will have to be changed. But we need to discuss this internally to understand what the best approach to fixing this would be.
For now, you can modify your TF config to use the "real" name of the issue field: accumulations.tag.environment
:
...
resource "newrelic_workflow" "issue_alerting_workflow" {
(...)
issues_filter {
(...)
predicate {
attribute = "accumulations.tag.environment"
operator = "EXACTLY_MATCHES"
values = ["dev"]
}
}
(...)
}
...
I have verified that this works, and the resulting filter should behave exactly as you expected you filter to behave.
All that being said, this is clearly a very confusing behaviour and we will address this problem ASAP, one way or another. I will post an update next week with a status and (hopefully) an ETA for a fix
By the way, @arhill05 thanks a lot of the report and the quick turnaround! And sorry for the slow initial response from our side.
Sounds great. Thanks so much for the update and the workaround!
After a number of internal discussions, we now have an approximate plan on how this address this problem.
Over the next couple of weeks we are going to introduce a simplified filter UI and treat the current one as "advanced" filter editor. With that, we are going to stop hiding accumulations.
prefix from filters and thus hopefully reduce the amount confusion.
We also plan to update TF documentation with examples and explanation on how to use various aspects of issue filters. If you have any suggestion regarding filter-related topics you'd like to see covered, please let us know here in the comments!
In the long term, we are looking into potentially changing the structure of issue fields so that the accumulations.
prefix is no longer required. But if we do decide to do this, it is going to be done in a non-disruptive way for TF users.
I am going to keep this issue open until the short-term changes I mentioned above are rolled out.
The UI was updated to show the full field name:
It might not be rolled out to everyone yet, but it will soon.
Workflow resource docs were also updated to include correct examples with tags.
I hope these two things would hopefully alleviate some confusion, so I am going to close this ticket.
In the long term, we plan to improve TF experience around filters. But it is not yet clear when we'll be able to get to it, nor do we have any specific improvement plans yet, only an understanding that the way it is done right now causes confusion to our customers.