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

dynatrace_host_naming: Could not map JSON at 'rules[0].comparisonInfo.value' #455

Closed
ajoga opened this issue May 2, 2024 · 1 comment
Closed
Assignees
Labels
bug Something isn't working

Comments

@ajoga
Copy link

ajoga commented May 2, 2024

Describe the bug
When I try to apply my configuration [simplified for this ticket], it fails with the following error:

OpenTofu will perform the following actions:

  # dynatrace_host_naming.remove_fqdn will be created
  + resource "dynatrace_host_naming" "remove_fqdn" {
      + enabled = true
      + format  = "{Host:DetectedName}"
      + id      = (known after apply)
      + name    = "remove"

      + conditions {
          + condition {
              + os_arch {
                  + operator = "EQUALS"
                  + value    = "PARISC"
                }
            }
        }
    }

Plan: 1 to add, 0 to change, 0 to destroy.

Do you want to perform these actions?
  OpenTofu will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

dynatrace_host_naming.remove_fqdn: Creating...
╷
│ Error: Could not map JSON at 'rules[0].comparisonInfo.value' near line 1 column 165
│ 
│   with dynatrace_host_naming.remove_fqdn,
│   on environment_settings.tf line 1, in resource "dynatrace_host_naming" "remove_fqdn":
│    1: resource "dynatrace_host_naming" "remove_fqdn" {
│ 
╵

To Reproduce
Add this configuration to a terraform project that can already configure a Dynatrace environment:

resource "dynatrace_host_naming" "remove_fqdn" {
    enabled = true
    format = "{Host:DetectedName}"
    name = "remove"
    conditions {
        condition {
            os_arch {
                operator = "EQUALS"
                value = "PARISC"
            }
        }
    }
}

Run $ tofu apply

Expected behavior

The configuration is applied

Additional context

$ tofu version
OpenTofu v1.6.2
on linux_amd64
+ provider registry.opentofu.org/dynatrace-oss/dynatrace v1.56.2

Dynatrace managed version 1.284.143.20240314-155531

I followed this documentation to get key names and values: https://registry.terraform.io/providers/dynatrace-oss/dynatrace/latest/docs/resources/host_naming#nestedblock--conditions--condition--application_type

I had the same issue with provider v1.54.2

@ajoga ajoga added the bug Something isn't working label May 2, 2024
@Dynatrace-Reinhard-Pilz
Copy link
Member

Hi @ajoga , you've discovered a bug that must have existed for ages without anybody noticing. Thanks for reporting!
That bug will be fixed with the upcoming release of the provider.

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

2 participants