terraform-provider-dynatrace icon indicating copy to clipboard operation
terraform-provider-dynatrace copied to clipboard

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

Open davidghughes opened this issue 5 months ago • 3 comments

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 https://github.com/dynatrace-oss/terraform-provider-dynatrace/issues/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 avatar Sep 02 '24 06:09 davidghughes