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

encountering non-empty plans when deploying json dashboards #504

Open
amsanmie opened this issue Jul 23, 2024 · 1 comment
Open

encountering non-empty plans when deploying json dashboards #504

amsanmie opened this issue Jul 23, 2024 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@amsanmie
Copy link

amsanmie commented Jul 23, 2024

Describe the bug
Terraform keeps trying to update the contents of the json dashboards even if there are no changes in the code. My observation is that the content it keeps trying to add is part of the dashboard json code but it's not stored in the state file thereby causing the non-empty plans.

To Reproduce
Steps to reproduce the behavior:
Use any of the preset dashboards from this link https://github.com/Dynatrace/snippets/tree/master/product/dashboarding/aws-metric-streaming and attach the json file to the dashboard resource similar to below

resource "dynatrace_json_dashboard" "dashboard" {
for_each = local.dashboard_files_classic

contents = each.value
link_id = dynatrace_json_dashboard_base.dashboard_base[each.key].id

provider = dynatrace.dashboard
}

dynatrace version 1.59.1

Expected behavior
Terraform plan only shows changes when changes are made in the code as it should be.

Screenshots
screenshot showing the code
Screenshot 2024-07-23 at 16 47 19

Screenshot showing the terraform plan
Screenshot 2024-07-23 at 16 46 32

Screenshot showing the state file, which indicate the dashboard filter being part of the code but not part of the state file
Screenshot 2024-07-23 at 16 48 05

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@amsanmie amsanmie added the bug Something isn't working label Jul 23, 2024
@Dynatrace-Reinhard-Pilz

Hello @amsanmie,

You're experiencing a well known limitation we're facing with Terraform when applying Dashboards.

Unfortunately the JSON code you're getting when exporting Dashboards as JSON via WebUI and the JSON Code that's provided via REST API aren't aligned in multiple ways.

In most cases it is simply about default values vs omitting an attribute. And within these cases it is usually about additional, optional attributes that CAN get omitted.

The only bullet proof way to ensure non-empty plans at the moment is to gradually align the local JSON code within your Terraform Module until the plan remains empty.

I'm going to keep this ticket open, however. After trying out a couple of the JSON files that are available through the link you've provided I'm sure we can reduce the possibility of non-empty plans to a bare minimum - simply by suppressing the diff for a couple of edge cases we've not been aware of yet.

We will keep you posted here about the progress.

best regards,
Reinhard

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