terraform-provider-uptimerobot icon indicating copy to clipboard operation
terraform-provider-uptimerobot copied to clipboard

Special characters in friendly name cause modification on every apply

Open innovate-invent opened this issue 4 years ago • 4 comments

For example:

resource "uptimerobot_monitor" "id783840372" {
  friendly_name = "Galaxy for IslandCompare (AWS)"

results in

  # uptimerobot_monitor.id783840372 will be updated in-place
  ~ resource "uptimerobot_monitor" "id783840372" {
        custom_http_headers = {}
      ~ friendly_name       = "Galaxy for IslandCompare (AWS)" -> "Galaxy for IslandCompare (AWS)"

on every apply

innovate-invent avatar Sep 03 '20 15:09 innovate-invent

This is sadly expetect behaviour and the uptime robot Api is doing this ( which is kinda bad)

You can fix this by changing your monitor name to not use the special chars or to just encode them as the Api returns them.

This should be documented though...

drubin avatar Sep 04 '20 16:09 drubin

Wouldn't it be appropriate for the provider to handle the necessary encoding between human readable and what the API requires?

innovate-invent avatar Sep 04 '20 17:09 innovate-invent

I wouldn't think so because this is a not how core Terraform works it's also not documented how to unencode/encode or how to handle it.

This is how gpc and aws plugins work too when things get in

drubin avatar Sep 04 '20 17:09 drubin

This is obviously bad api behaviour, but I wonder whether calling html#UnescapeString on that field when fetching would fix this and make the UX a bit nicer. Should be easy to test and hopefully wouldn't introduce any unexpected issues.

louy avatar Sep 05 '20 23:09 louy