Terraform v0.11.11
resource "newrelic_infra_alert_condition" "iis_service_stopped_sweb" {
comparison = "equal"
critical {
duration = 5
}
enabled = true
event = "ProcessSample"
name = "IIS Service stopped for Library Web"
policy_id = data.newrelic_alert_policy.ops_notify_pagerduty.id
process_where = "(`processDisplayName` = 'w3wp.exe')"
select = "processId"
type = "infra_process_running"
where = "(`apmApplicationNames` LIKE '|LibraryService.WebRole%')"
}
resource "newrelic_infra_alert_condition" "redis_load" {
comparison = "above"
critical {
duration = "10"
time_function = "all"
value = "25"
}
enabled = "true"
integration_provider = "AzureRedisCache"
name = "Redis Server Load Percentage"
policy_id = data.newrelic_alert_policy.ops_notify_pagerduty.id
select = "serverLoadPercent.Average"
type = "infra_metric"
}
# newrelic_infra_alert_condition.iis_service_stopped_lsweb will be updated in-place
~ resource "newrelic_infra_alert_condition" "iis_service_stopped_lsweb" {
comparison = "equal"
created_at = 1565738328870
enabled = true
+ event = "ProcessSample"
id = "439821:10857215"
name = "IIS Service stopped for LiveShare Web"
policy_id = 439821
process_where = "(`processDisplayName` = 'w3wp.exe')"
+ select = "processId"
type = "infra_process_running"
updated_at = 1575490744865
where = "(`apmApplicationNames` LIKE '|LiveShare.WebRole%')"
critical {
duration = 15
value = 0
}
}
# newrelic_infra_alert_condition.redis_load will be updated in-place
~ resource "newrelic_infra_alert_condition" "redis_load" {
comparison = "above"
created_at = 1572375196070
enabled = true
- event = "AzureRedisCacheSample" -> null
id = "439821:11115711"
integration_provider = "AzureRedisCache"
name = "Redis Server Load Percentage"
policy_id = 439821
select = "serverLoadPercent.Average"
type = "infra_metric"
updated_at = 1572375196160
critical {
duration = 10
time_function = "all"
value = 25
}
}
With no code changes, no configuration drift should appear after upgrading the provider from 1.8.0 to 1.9.0
Instead, the output above appeared. Applying the changes did not clear the configuration drift.
Please list the steps required to reproduce the issue, for example:
terraform plan shows no changes after creation.terraform plan and observe unexpected changes like above.terraform apply (which is successful) and then re-run terraform plan and observe the changes are still present.@ctrombley I suspect this may be related to
https://github.com/terraform-providers/terraform-provider-newrelic/pull/254/files
In the state file, I noticed that some of the fields such as "event" had been changed from
"event": null,
to
"event": "AzureRedisCacheSample",
(for the second example above)
Note that there were two scenarios scene, but they are most likely related. For the first case, the state file difference was something like
],
"enabled": true,
- "event": "",
+ "event": "ProcessSample",
"id": "439821:11264590",
"integration_provider": null,
"name": "IIS Service stopped for LiveShare Web",
"policy_id": 439821,
"process_where": "(`processDisplayName` = 'w3wp.exe')",
"runbook_url": "",
- "select": "",
+ "select": "processId",
"type": "infra_process_running",
"updated_at": 1575592976189,
"warning": [],`
@pickgr I've reproduced this locally. You uncovered two separate issues here:
event and select attributes for the infra_process_running condition type, which doesn't support them. The Infra API is ignoring those fields on resource creation and returning a payload that doesn't contain them. Previous versions of the provider didn't track these values in state and therefore didn't result in drift. We recommend that you remove those attributes from your config file to resolve the drift for that resource. We'll follow this up with a PR for stricter validation and some documentation updates.event can act as a computed value. I'll address this with a PR shortly.@ctrombley Thanks for the quick turn-around on this. I've updated our provider version to v1.10.0 and verified this is fixed. Really appreciate all the recent attention to supporting this provider!
@pickgr You're welcome! We (New Relic) are actively working to improve the tools available for automated workflows, and the Terraform provider is a major part of that initiative. If you're interested in seeing / participating on the overall vision we'd love some feedback on the public roadmap. We've created a space for an RFC here: https://discuss.newrelic.com/t/rfc-developer-toolkit-roadmap-2020/90528