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

Could not map JSON at 'supportingServicesToMonitor[0].monitoredMetrics[0].statistic' in dynatrace_aws_credentials modules #357

Closed
EthanZmuda opened this issue Nov 9, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@EthanZmuda
Copy link

EthanZmuda commented Nov 9, 2023

Describe the bug
We are getting the error described in the title when trying to run deploys. This error is happening on settings unrelated to our changes which have previously deployed successfully. Here is the full error:

│ Error: Could not map JSON at 'supportingServicesToMonitor[0].monitoredMetrics[0].statistic' near line 1 column 287
│ 
│   with module.production_settings[0].module.aws_credentials.dynatrace_aws_credentials.cobra-prod,
│   on production/settings/aws_credentials/cobra-prod.tf line 1, in resource "dynatrace_aws_credentials" "cobra-prod":
│    1: resource "dynatrace_aws_credentials" "cobra-prod" {

This error is inconsistently happening on many dynatrace_aws_credentials modules. Sometimes when redeploying the error resolves on some modules and starts occurring on others. Here is an example of one such module:

resource "dynatrace_aws_credentials" "cobra-prod" {
  label          = "cobra-prod - TF managed"
  partition_type = "AWS_CN"
  tagged_only    = false
  authentication_data {
    account_id = "***" # I'm not sure if the account ID is sensitive so I'm censoring it
    iam_role   = "SFGBaselineDynatraceMonitoring"
  }
  supporting_services_to_monitor {
    name = "fsx"
  }
}

This error is especially odd because this module doesn't have a .monitoredMetrics[0].statistic attribute (nor do any of our modules throwing this error), yet the error is saying the issue is with that attribute. According to the documentation, this attribute is not required. Adding this attribute does not necessarily resolve the error.

Expected behavior
Successful deploys, with no inconsistent error due to an attribute in our modules which doesn't exist.

Desktop (please complete the following information):

  • GHA Runner OS: Ubuntu
  • hashicorp/aws: v4.17.1
  • dynatrace-oss/dynatrace: v1.46.1

Additional context
This issue began occurring during deploys today. Our most recent successful deploy used version v1.46.0.

@EthanZmuda EthanZmuda added the bug Something isn't working label Nov 9, 2023
@EthanZmuda EthanZmuda changed the title Could not map JSON at 'supportingServicesToMonitor[0].monitoredMetrics[0].statistic' in dynatrace_aws_credentials modules Could not map JSON at 'supportingServicesToMonitor[0].monitoredMetrics[0].statistic' in dynatrace_aws_credentials modules Nov 9, 2023
@EthanZmuda
Copy link
Author

Just did some more testing and found that we can successfully deploy on v1.46.0, so I'm guessing this must be an issue with v1.46.1.

@Dynatrace-Reinhard-Pilz
Copy link
Member

Hello @EthanZmuda , thanks for reporting the issue.
Root cause here is like in #360 the known bug in the plugin-sdk.

What I cannot find a satisfying answer for is the question why a rollback to a specific other version leads to the problem to emerge less likely. I've checked our GitHub history - dynatrace_aws_credentials hasn't been touched for a while now. Changes between release 1.46.0 and 1.46.1 contained solely a fix for Dashboards and nothing else.

Release 1.47.1 will contain routines that are able to recognize erroneously empty blocks for this resource and ignore them.

Dynatrace-Reinhard-Pilz added a commit that referenced this issue Nov 23, 2023
@Dynatrace-Reinhard-Pilz
Copy link
Member

Hello @EthanZmuda, let me know if v1.47.1 indeed fixes your issues. Reproducing the problem is unfortunately a hit and miss, therefore I'd be grateful for feedback from your side.

@EthanZmuda
Copy link
Author

@Dynatrace-Reinhard-Pilz Thanks! I'll let you know if it's working better next time we make changes in the repo.

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