Skip to content
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

tag_names is not idempotent #285

Open
valugi opened this issue Jun 24, 2024 · 1 comment
Open

tag_names is not idempotent #285

valugi opened this issue Jun 24, 2024 · 1 comment

Comments

@valugi
Copy link

valugi commented Jun 24, 2024

hi,
This is about the SSL monitor, but I guess the implementation would be the same everywhere where there is a tag_ids/tag_names.
https://registry.terraform.io/providers/site24x7/site24x7/latest/docs/resources/ssl_monitor
So I associate tags to this monitor and I apply, they apply correctly.
But on the next run, the tag is detected as new. The same applies to user_group_names.

  ~ resource "site24x7_ssl_monitor" "ssl_monitor" {
        id                        = "396627000019682039"
      ~ tag_ids                   = [
          - "396627000019682015",
        ]
      ~ user_group_ids            = [
          - "396627000019683052",
          - "396627000019675047",
          - "396627000019681043",
        ]```
@valugi
Copy link
Author

valugi commented Jun 24, 2024

So this is probably related with the fact that I have specified default values.
This is my setup, I do have an empty tag_ids - that should be ignored for being empty.

  tag_ids                   = []
  tag_names             = ["TAG_A"]

Right?

PS.
The user solution is to change from this:

variable "tag_ids" {
  type    = list(string)
  default = []
}

to this:

variable "tag_ids" {
  type    = list(string)
  default = null
}

Though, to be frank, I like it more when the default is the same type as the definition.
Maybe you can add an extra check on your side.

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant