-
Notifications
You must be signed in to change notification settings - Fork 16
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
Collector resource reports installer_url_cmds is an emtpy map #104
Comments
Hi @loshea-bmcd , Can you please share the TF configuration from the main.tf which you are executing to get the terraform plan? |
I am seeing this too. Example code below: resource "logicmonitor_collector_group" "this" {
name = "${var.client_name} - ${var.client_id}"
description = "Collector group for ${var.client_name} - ."
auto_balance = true
auto_balance_strategy = "none"
}
resource "logicmonitor_collector" "this" {
for_each = { for collector in var.collectors : collector.name => collector }
arch = each.value.architecture
collector_group_id = logicmonitor_collector_group.this.id
collector_size = each.value.size
description = "Collector ${each.value.name} for ${var.client_name}"
company = "somecompanyname"
custom_properties = [
{
name = "name"
value = each.value.name
}
]
}
output "collector_install_urls" {
value = { for collector in logicmonitor_collector.this : "${collector.custom_properties[0].name}" => collector.installer_url_cmds }
}
|
After some further testing, it appears these values show the first time the collector is created, then on a subsequent run it is removed from the attributes. Additionally, there is immediate drift in config (note - I did not register the collector between runs)... # module.logicmonitor.logicmonitor_collector.this["collectorclient2"] will be updated in-place
~ resource "logicmonitor_collector" "this" {
~ arch = "N/A" -> "linux64"
- build = "0" -> null
~ collector_size = "n/a" -> "medium"
+ company = "somecompany"
- ea = true -> null
- enable_fail_back = true -> null
- enable_fail_over_on_collector_device = true -> null
id = "18"
~ monitor_others = false -> true
- need_auto_create_collector_device = true -> null
# (53 unchanged attributes hidden)
} Changes to Outputs:
~ collector_install_urls = {
~ name = {
- URL = "https://somecompany.logicmonitor.com/santaba/rest/setting/collector/collectors/18/bootstraps/linux64?token=<token>&useEA=false&monitorOthers=true&v=3&collectorSize=medium"
- "Wget cmd" = "wget -O LogicmonitorBootstrap64_18.bin 'https://somecompany.logicmonitor.com/santaba/rest/setting/collector/collectors/18/bootstraps/linux64?token=<token>&useEA=false&monitorOthers=true&v=3&collectorSize=medium'"
- "cURL cmd" = "curl -o LogicmonitorBootstrap64_18.bin 'https://somecompany.logicmonitor.com/santaba/rest/setting/collector/collectors/18/bootstraps/linux64?token=<token>&useEA=false&monitorOthers=true&v=3&collectorSize=medium'"
}
} |
I have created a set of collectors using terraform 1.8.3. I need to use an output from these collectors, installer_url_cmds["cUL cmd"] in a cloud init script, to build the vms that will be running the collector agent associated with these collectors. However, when terrafrom plan runs, the plan fails because of the error in the title. I can look in state and see that installer_url_cmds map is populated as expected. It seems like the provider just isnt' reading state and is assuming this to be an empty map.
Relavent state section:
"installer_url_cmds": {
"URL": "https://burnsmcdonnellsandbox.logicmonitor.com/santaba/rest/setting/collector/collectors/26/bootstraps/linux64?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&useEA=false&monitorOthers=true&v=3&collectorSize=medium",
"Wget cmd": "wget -O LogicmonitorBootstrap64_26.bin 'https://burnsmcdonnellsandbox.logicmonitor.com/santaba/rest/setting/collector/collectors/26/bootstraps/linux64?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&useEA=false&monitorOthers=true&v=3&collectorSize=medium'",
"cURL cmd": "curl -o LogicmonitorBootstrap64_26.bin 'https://burnsmcdonnellsandbox.logicmonitor.com/santaba/rest/setting/collector/collectors/26/bootstraps/linux64?token=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX&useEA=false&monitorOthers=true&v=3&collectorSize=medium'"
},
Error from terraform plan:
Error: Invalid index
on main.tf line 130, in module "primary_collector_vm":
custom_data = base64encode(logicmonitor_collector.primary_collector.installer_url_cmds["cURL cmd"])
logicmonitor_collector.primary_collector.installer_url_cmds is empty map of string
The given key does not identify an element in this collection value.
The text was updated successfully, but these errors were encountered: