-
Notifications
You must be signed in to change notification settings - Fork 248
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
Feature Request: Data Source for newrelic_synthetics_script_monitor #2750
Comments
Hi @dribblor, is your request specific to Script Monitors? If I understand this right, does your request ask for an inclusion of a data source that can "fetch" (all kinds of) Synthetic Monitors when searched with their name, so the GUID, script, etc. of such monitors can be retrieved and used with other resources? |
@pranav-new-relic My request was specific to Script Monitors. I can't remember now what the use case was because I ended up working around it, but at the time things would have been much simpler if I could just use a data source to fetch the GUID's of some synthetic script monitors. I'm not requesting data sources for other types of monitor, but I'm not saying you shouldn't do that either. |
okay, thanks for sharing this info. While we wouldn't be able to get to this soon owing to other priority items, this certainly is a usecase we shall consider sometime. Did you want to simply search for a monitor with its name via the data source and fetch its GUID and other attributes, or also filter it with other attributes? Just trying to gather ideas so we think about these when we get to do this in future, if we do :) thanks! |
Searching for a monitor by it's name is perfectly fine for me, thanks. And no rush :) |
Hey @dribblor, sorry, we weren't able to get to this owing to a heap of other priorities; however, I think we do not need to have a new data source to fit this usecase; instead, we can leverage the I've shared a sample configuration of what would be needed to get these attributes of a Synthetics Scripted monitor, by searching with its name. data "newrelic_entity" "foo" {
name = "some-synthetics-scripted-monitor"
domain = "SYNTH"
type = "MONITOR"
}
locals {
key_value_map = { for pair in jsondecode(data.newrelic_entity.foo.entity_tags) : pair.key => pair.values }
}
output "script_monitor_guid" {
value = data.newrelic_entity.foo.guid
}
output "script_monitor_entity_tags" {
value = local.key_value_map
} You'll see by the end of this (upon a You can also use the following block (additionally) to "check" via Terraform if the monitor returned actually is a Scripted Monitor - this is a relatively new feature in Terraform that might be useful for a check, so wanted to share this. However, the above block should get you what you need. check "monitor_type_exists_check" {
assert {
condition = contains(keys(local.key_value_map), "monitorType")
error_message = "The monitorType tag does not exist in key_value_map."
}
}
check "monitor_type_check" {
assert {
condition = startswith(local.key_value_map["monitorType"][0], "Script")
error_message = "The monitorType does not start with 'Script', indicating that this might not be a Synthetics Scripted Monitor."
}
} Since our team opines the |
Feature Description
Add terraform data source for synthetic scripts (newrelic_synthetics_script_monitor)
Describe Alternatives
None
Additional context
It would be useful to be able to retrieve data for synthetic scripts, such as it's GUID, for use when creating service levels (newrelic_service_level) and entity tags (newrelic_entity_tags) which require entity GUID.
The text was updated successfully, but these errors were encountered: