terraform-provider-grafana
terraform-provider-grafana copied to clipboard
`grafana_synthetic_monitoring_probe` could not get labels
Terraform Version
- Terraform:
1.2.0 - Terraform Grafana Provider:
1.24.0 - Grafana:
8.0+
Affected Resource(s)
Please list the resources as a list, for example:
grafana_synthetic_monitoring_probedata.grafana_synthetic_monitoring_probes
Terraform Configuration Files
data "grafana_synthetic_monitoring_probes" "this" {}
Debug Output
Please provider a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
- Running from CI so if you need I can show the output later.
Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.
Expected Behavior
What should have happened?
- No issues
Actual Behavior
What actually happened?
│ Error: probe list request: status="500 Internal Server Error", msg="status: Internal Server Error, error: loading probe 2432: extracting probe labels: extracting label "0": expected name=value", err="loading probe 2432: extracting probe labels: extracting label "0": expected name=value"
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform apply
Important Factoids
Are there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? Custom version of OpenStack? Tight ACLs? N/A
References
Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example: N/A
This one looks like something we need to fix in the terraform provider.
It seems like it's passing invalid labels to the API.
I tried a test here: https://github.com/grafana/terraform-provider-grafana/pull/573 and I couldn't reproduce it. Do you have a custom probe? And if so can you post its configuration here?
@julienduchesne yes I am using private probes right now. It is a little bit complex but can be summarized with this one.
# terraform.tfvars
probes = [
{
name = probe.name
latitude = probe.latitude
longitude = probe.longitude
region = probe.region
uuid = probe.uuid
alt_region = lookup( # convert AZ to Region via probe's name.
{
"aws" = substr(regex("(.*)_(.*)_(.*)", probe.name)[2], 0, length(regex("(.*)_(.*)_(.*)", probe.name)[2]) - 1)
"gcp" = substr(regex("(.*)_(.*)_(.*)", probe.name)[2], 0, length(regex("(.*)_(.*)_(.*)", probe.name)[2]) - 2)
},
regex("(.*)_(.*)_(.*)", probe.name)[1], probe.region
)
},
...
]
# main.tf
resource "grafana_synthetic_monitoring_probe" "private" {
for_each = { for probe in var.probes : probe.name => probe }
name = lower(each.value.name)
latitude = each.value.latitude
longitude = each.value.longitude
region = each.value.region
public = false # Private probe is not public by default
labels = merge(each.value.labels, {
"uuid" = each.value.uuid
"alt_region" = each.value.alt_region
})
lifecycle {
create_before_destroy = true
}
}
Hey @anhdle14. This is probably caused by a comma in your label's value. The API has a bit of trouble with it. It will be fixed, but in the meantime, if you sanitize your label value, it should work. Let me know if that helps!
Hey @julienduchesne, we do not have comma or custom characters anywhere I think, except for _ and -. So I am not sure how to fix.
Do you still have the issue? I believe a fix was implemented on the API side
Right, we recently deployed a new version of the API that addresses this.
I'll close this until there is confirmation that this is still happening. Feel free to reopen!
Sorry, it is fixed now. Thank you for the support ^^!
No worries. Thanks for reporting!