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

[Bug]: Perpetual diff on data_set_identifiers_declarations in aws_quicksight_dashboard and aws_quicksight_analysis #36733

Open
russ-s7 opened this issue Apr 4, 2024 · 1 comment
Labels
bug Addresses a defect in current functionality. service/quicksight Issues and PRs that pertain to the quicksight service.

Comments

@russ-s7
Copy link

russ-s7 commented Apr 4, 2024

Terraform Core Version

1.7.5

AWS Provider Version

5.43.0,5.38.0

Affected Resource(s)

  • aws_quicksight_dashboard
  • aws_quicksight_analysis

Expected Behavior

In the definition block I have specified multiple data_set_identifiers_declarations blocks. This applies correctly and that should be the end of the story.

Actual Behavior

Terraform shows a perpetual diff in the ordering of the data_set_identifiers_declarations blocks. It seems that AWS re-orders them according to some internal whim and Terraform sees this as a diff, and tries to re-apply them in the order they're specified in my definition.
I can re-order them in the definition to match this, and there's no diff for this instance of my dashboard - but I am doing this in a module, and when I do it in a different instance of the module, with different dataset names, the order is different.

Relevant Error/Panic Output Snippet

# module.example1.aws_quicksight_dashboard.example will be updated in-place
~ resource "aws_quicksight_dashboard" "example" {
	id                  = "123456789012,example"
	name                = "Example"
	# (10 unchanged attributes hidden)

  ~ definition {
	  ~ data_set_identifiers_declarations {
		  ~ data_set_arn = "arn:aws:quicksight:eu-west-2:123456789012:dataset/languages_query" -> "arn:aws:quicksight:eu-west-2:123456789012:dataset/members_gender"
		  ~ identifier   = "123456789012,languages_query" -> "123456789012,members_gender"
		}
	  ~ data_set_identifiers_declarations {
		  ~ data_set_arn = "arn:aws:quicksight:eu-west-2:123456789012:dataset/responsive_members" -> "arn:aws:quicksight:eu-west-2:123456789012:dataset/activity_level_status"
		  ~ identifier   = "123456789012,responsive_members" -> "123456789012,activity_level_status"
		}
	  ~ data_set_identifiers_declarations {
		  ~ data_set_arn = "arn:aws:quicksight:eu-west-2:123456789012:dataset/engagement_rate" -> "arn:aws:quicksight:eu-west-2:123456789012:dataset/responsive_members"
		  ~ identifier   = "123456789012,engagement_rate" -> "123456789012,responsive_members"
		}
	  ~ data_set_identifiers_declarations {
		  ~ data_set_arn = "arn:aws:quicksight:eu-west-2:123456789012:dataset/activity_level_status" -> "arn:aws:quicksight:eu-west-2:123456789012:dataset/engagement_trended"
		  ~ identifier   = "123456789012,activity_level_status" -> "123456789012,engagement_trended"
		}
	  ~ data_set_identifiers_declarations {
		  ~ data_set_arn = "arn:aws:quicksight:eu-west-2:123456789012:dataset/engagement_trended" -> "arn:aws:quicksight:eu-west-2:123456789012:dataset/engagement_rate"
		  ~ identifier   = "123456789012,engagement_trended" -> "123456789012,engagement_rate"
		}
	  ~ data_set_identifiers_declarations {
		  ~ data_set_arn = "arn:aws:quicksight:eu-west-2:123456789012:dataset/members_gender" -> "arn:aws:quicksight:eu-west-2:123456789012:dataset/languages_query"
		  ~ identifier   = "123456789012,members_gender" -> "123456789012,languages_query"
		}

		# (42 unchanged blocks hidden)
	}

	# (3 unchanged blocks hidden)
}

Terraform Configuration Files

resource "aws_quicksight_dashboard" "healthreports" {
  dashboard_id        = "example"
  name                = "Example"
  version_description = "Terraformed dashboard"

  lifecycle {
    # HACK: I can use this to prevent the perpetual diff - obviously this has downsides
    ###ignore_changes = [definition[0].data_set_identifiers_declarations]
  }

  definition {
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.activity_level_status.arn
      identifier   = aws_quicksight_data_set.activity_level_status.id
    }
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.engagement_rate.arn
      identifier   = aws_quicksight_data_set.engagement_rate.id
    }
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.engagement_trended.arn
      identifier   = aws_quicksight_data_set.engagement_trended.id
    }
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.languages_query.arn
      identifier   = aws_quicksight_data_set.languages_query.id
    }
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.members_gender.arn
      identifier   = aws_quicksight_data_set.members_gender.id
    }
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.responsive_members.arn
      identifier   = aws_quicksight_data_set.responsive_members.id
    }
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.source_panel_activity.arn
      identifier   = aws_quicksight_data_set.source_panel_activity.id
    }
    data_set_identifiers_declarations {
      data_set_arn = aws_quicksight_data_set.total_members.arn
      identifier   = aws_quicksight_data_set.total_members.id
    }
    # ...rest of definition here...
  }
}

# ...aws_quicksight_data_set resources here...

Steps to Reproduce

terraform apply to create the resource. terraform plan without changing the definition - see that AWS has re-ordered the data_set_identifiers_declarations and the plan changes them back to the order in which they're written.

Debug Output

No response

Panic Output

No response

Important Factoids

The sort ordering is always consistent within a given dashboard/analysis, even if I delete and recreate. I think the order is based on a hash of the dataset name or something. Obviously the solution is to explicitly sort the values before comparing the definition and the resource state to see if there is a difference.

As in my exampe configuration above, it is possible to use lifecycle -> ignore_changes to work around the problem.

References

No response

Would you like to implement a fix?

No

@russ-s7 russ-s7 added the bug Addresses a defect in current functionality. label Apr 4, 2024
@github-actions github-actions bot added the service/quicksight Issues and PRs that pertain to the quicksight service. label Apr 4, 2024
Copy link

github-actions bot commented Apr 4, 2024

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 4, 2024
@justinretzolk justinretzolk removed the needs-triage Waiting for first response or review from a maintainer. label Apr 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/quicksight Issues and PRs that pertain to the quicksight service.
Projects
None yet
Development

No branches or pull requests

2 participants