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

Sporadic occurrences of missing IDs in terraform generated by terraform-provider-dynatrace -export #522

Open
davidghughes opened this issue Sep 2, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@davidghughes
Copy link

Describe the bug

As I believe Adam has made known to you, occasionally, terraform-provider-dynatrace -export will omit the attribute name, like:

Writing modules ___providers___.tf
Remove Non-Referenced Modules ...
Finish Export ...
Terraform executable path:  /usr/bin/terraform
Executing 'terraform init'

Error: Invalid attribute name

  on modules/report/_YYY.report.tf line 3, in resource "dynatrace_report" "_YYY":
   3:   dashboard_id        = "${var.dynatrace_json_dashboard..id}"

An attribute name is required after a dot.

Error: Invalid attribute name

  on modules/report/_XXX.report.tf line 3, in resource "dynatrace_report" "_XXX":
   3:   dashboard_id        = "${var.dynatrace_json_dashboard..id}"

An attribute name is required after a dot.
... finished after 9 seconds

often running the same task again will succeed.

To Reproduce
Steps to reproduce the behavior:

  1. run terraform-provider-dynatrace -export -id -ref (we have this running as a GH action)

Expected behavior
Correctly formed terraform

Screenshots
As provided by AG

Additional context
Interestingly, as I was attempting a workaround of #521 it appears that using -ref "*" dynatrace_json_dashboard -exclude dynatrace_oneagent_updates fails with:

[terraform]$ ./terraform-provider-dynatrace -export -ref "*" dynatrace_alerting dynatrace_autotag_v2 dynatrace_autotag dynatrace_json_dashboard -exclude dynatrace_oneagent_updates
... finished after 0 seconds
unknown resource ``

running the following succeeds, however we ideally need the extra modules ...

./terraform-provider-dynatrace -export -ref -exclude dynatrace_oneagent_updates
@davidghughes davidghughes added the bug Something isn't working label Sep 2, 2024
@Reinhard-Pilz-Dynatrace
Copy link
Collaborator

Hello @davidghughes,

It sounds suspiciously like a race condition we're dealing with here.
Does the issue occur for a certain kind of resource more often than others? Based on the data Adam forwarded to us and the information you've posted here, it looks like Dashboards and Synthetic Monitors are definitely affected.

Let's say, it happens for Dashboards primarily. How many Dashboards can be found in your environment?
Reason for these rather weird questions is, that we need to find a way to reproduce the issue pretty reliably.

Another way to approach this would be to provide a couple of debug builds for you, so you can run them internally and provide the output for us. That, of course, only makes sense if you have the bandwidth for it - and most importantly, don't have to run these debug builds dozens of times until the issue re-emerges.

thanks,
Reinhard

@davidghughes
Copy link
Author

Hello @Reinhard-Pilz-Dynatrace and thanks for the update.

I'm more than happy to try debug builds.
From doing a couple of test runs this morning, I am able to reproduce the issue. I'll forward you the results.

I am noticing that is mainly the dynatrace_report resource that generates the error.
Running ./terraform-provider-dynatrace -export -id -ref "*" results in 27 reports and 30 json_dashboards
Running ./terraform-provider-dynatrace -export -id -ref "*" dynatrace_json_dashboard results in 27 reports and 119 dashboards

a diff of the json_dashboard terraform files between successful and failed reports shows that they are identical.

thanks,
Dave.

@Reinhard-Pilz-Dynatrace
Copy link
Collaborator

@davidghughes I would suggest that we continue this via email. We will have to exchange binaries and logs that may contain sensitive data from your environment. A public GitHub ticket isn't the right place for that.

I just responded to the email Adam sent out to connect the two of us.

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