Skip to content

Adding a new rule to existing dynatrace_autotag_v2 caused all existing rules changes #662

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

Open
son-la opened this issue Apr 3, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@son-la
Copy link

son-la commented Apr 3, 2025

Describe the bug
When adding a new rule to the existing dynatrace_autotag_v2 resource, terraform plan reports all rules to be removed, and added again with the new rule.

Similar behaviour is seen in the UI change revision history, that when I added a new rule, it seems to be added on top of the rule list and become rule #1. All other rules are reordered and shown as changes in the revision. I suspect that this caused terraform plan to report such big change, while in reality, there's only 1 rule added and the rests remain the same.

To Reproduce
Steps to reproduce the behavior:

  1. Run terraform apply to create a tag with resource dynatrace_autotag_v2 and 1 rule
  2. Add a new rule into dynatrace_autotag_v2 rules. Run terraform plan

Expected behavior
terraform plan shows 1 new rule to be added

Screenshots

      ~ rules {
          - rule {
              - enabled             = true -> null
              - type                = "ME" -> null
              - value_format        = "xxxx" -> null
              - value_normalization = "Leave text as-is" -> null
                # (1 unchanged attribute hidden)

              - attribute_rule {
                  - azure_to_pgpropagation       = false -> null
                  - azure_to_service_propagation = false -> null
                  - entity_type                  = "SERVICE" -> null
                  - host_to_pgpropagation        = false -> null
                  - pg_to_host_propagation       = false -> null
                  - pg_to_service_propagation    = false -> null
                  - service_to_host_propagation  = false -> null
                  - service_to_pgpropagation     = false -> null

                  - conditions {
                      - condition {
                          - case_sensitive     = true -> null
                          - integer_value      = 0 -> null
                          - key                = "SERVICE_DETECTED_NAME" -> null
                          - operator           = "EQUALS" -> null
                          - string_value       = "xxx" -> null
                            # (5 unchanged attributes hidden)
                        }
                    }
                }
            }
          + rule {
              + enabled             = true
              + type                = "ME"
              + value_format        = "xxxx"
              + value_normalization = "Leave text as-is"
                # (1 unchanged attribute hidden)

              + attribute_rule {
                  + entity_type                 = "SERVICE"
                  + service_to_host_propagation = false
                  + service_to_pgpropagation    = false

                  + conditions {
                      + condition {
                          + case_sensitive     = true
                          + key                = "SERVICE_DETECTED_NAME"
                          + operator           = "EQUALS"
                          + string_value       = "xxx"
                            # (5 unchanged attributes hidden)
                        }
                    }
                }
            }
          + rule {
              + enabled             = true
              + type                = "ME"
              + value_format        = "yyyy"
              + value_normalization = "Leave text as-is"
                # (1 unchanged attribute hidden)

              + attribute_rule {
                  + entity_type                 = "SERVICE"
                  + service_to_host_propagation = false
                  + service_to_pgpropagation    = false

                  + conditions {
                      + condition {
                          + case_sensitive     = true
                          + key                = "SERVICE_DETECTED_NAME"
                          + operator           = "EQUALS"
                          + string_value       = "yyyy"
                            # (5 unchanged attributes hidden)
                        }
                    }
                }
            }
        }

Desktop (please complete the following information):

  • terraform version: 1.10.4
  • dynatrace provider version: 1.75.1

Additional context
Add any other context about the problem here.

@son-la son-la added the bug Something isn't working label Apr 3, 2025
@son-la
Copy link
Author

son-la commented Apr 3, 2025

When using rules_maintained_externally=true with "dynatrace_autotag_rules", the behaviour seems to be different that the new rule is added to the bottom (checked via revision history).

Adding and removing a rule does show correctly in terraform output that the particular rule is changed (added/ deleted). However, removing a rule which is in the middle of the rule lists caused the reorder, which can be seen in the UI revision history.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant