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

New resource aws_quicksight_template #30453

Merged
merged 42 commits into from
May 9, 2023

Conversation

comtef
Copy link
Contributor

@comtef comtef commented Apr 4, 2023

Description

QuickSight Template resource with source entity and definition support.

Source entity is the simpliest way to create a template but we can also use definition to configure a detailed implementation of a template.

All kind of visuals are supported. The Terraform documentation is not exhaustive, links to AWS API Documentation are provided for details.

I had to fix an issue on the dataset resource : all attributes should be added to the request for updates, otherwise, only the modified attributes are applied and all other configuration is lost (it does a PUT and not a PATCH). I updated a test to validate expected behaviour.

I splitted configuration accross several files to ease readbility and mainteance, is it the recommended approach?

Relations

Relates #10990
Closes #11834

References

Output from Acceptance Testing

$ make testacc TESTS=TestAccQuickSightTemplate PKG=quicksight
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/quicksight/... -v -count 1 -parallel 20 -run='TestAccQuickSightTemplate'  -timeout 180m
=== RUN   TestAccQuickSightTemplate_basic
=== PAUSE TestAccQuickSightTemplate_basic
=== RUN   TestAccQuickSightTemplate_disappears
=== PAUSE TestAccQuickSightTemplate_disappears
=== RUN   TestAccQuickSightTemplate_BarChart
=== PAUSE TestAccQuickSightTemplate_BarChart
=== RUN   TestAccQuickSightTemplate_Table
=== PAUSE TestAccQuickSightTemplate_Table
=== RUN   TestAccQuickSightTemplate_TemplateSourceEntity
=== PAUSE TestAccQuickSightTemplate_TemplateSourceEntity
=== CONT  TestAccQuickSightTemplate_basic
=== CONT  TestAccQuickSightTemplate_BarChart
=== CONT  TestAccQuickSightTemplate_disappears
=== CONT  TestAccQuickSightTemplate_TemplateSourceEntity
=== CONT  TestAccQuickSightTemplate_Table
--- PASS: TestAccQuickSightTemplate_disappears (55.02s)
--- PASS: TestAccQuickSightTemplate_BarChart (65.16s)
--- PASS: TestAccQuickSightTemplate_basic (67.82s)
--- PASS: TestAccQuickSightTemplate_TemplateSourceEntity (76.77s)
--- PASS: TestAccQuickSightTemplate_Table (91.98s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/quicksight 92.112s

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull 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.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added documentation Introduces or discusses updates to documentation. size/XL Managed by automation to categorize the size of a PR. service/quicksight Issues and PRs that pertain to the quicksight service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. needs-triage Waiting for first response or review from a maintainer. labels Apr 4, 2023
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Thank you for your contribution! 🚀

Please note that the CHANGELOG.md file contents are handled by the maintainers during merge. This is to prevent pull request merge conflicts, especially for contributions which may not be merged immediately. Please see the Contributing Guide for additional pull request review items.

Remove any changes to the CHANGELOG.md file and commit them in this pull request to prevent delays with reviewing and potentially merging this pull request.

@github-actions
Copy link

github-actions bot commented Apr 4, 2023

Thank you for your contribution! 🚀

Please note that typically Go dependency changes are handled in this repository by dependabot or the maintainers. This is to prevent pull request merge conflicts and further delay reviews of contributions. Remove any changes to the go.mod or go.sum files and commit them into this pull request.

Additional details:

  • Check open pull requests with the dependencies label to view other dependency updates.
  • If this pull request includes an update the AWS Go SDK (or any other dependency) version, only updates submitted via dependabot will be merged. This pull request will need to remove these changes and will need to be rebased after the existing dependency update via dependabot has been merged for this pull request to be reviewed.
  • If this pull request is for supporting a new AWS service:
    • Ensure the new AWS service changes are following the Contributing Guide section on new services, in particular that the dependency addition and initial provider support are in a separate pull request from other changes (e.g. new resources). Contributions not following this item will not be reviewed until the changes are split.
    • If this pull request is already a separate pull request from the above item, you can ignore this message.

@jar-b jar-b added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 4, 2023
@comtef
Copy link
Contributor Author

comtef commented Apr 4, 2023

@jar-b Hi, I started working on this resource, but to avoid double work, could you please tell me if you are already implementing it?

@jar-b
Copy link
Member

jar-b commented Apr 4, 2023

Hey @comtef 👋 - thanks for opening this! I assigned myself to the corresponding issue for our internal planning, but have not started any work yet. I'll assign myself as reviewer here and wait until you're ready to move out of draft.

Thanks!

Edit: Also, apologies for the errant automated comments above. We're working through some recent changes to our github actions workflow.

@jar-b jar-b self-assigned this Apr 4, 2023
@comtef comtef force-pushed the f_aws_quicksight_template branch 4 times, most recently from 8675b57 to f0291f0 Compare April 13, 2023 15:28
@github-actions github-actions bot added the flex Pertains to FLatteners and EXpanders. label Apr 13, 2023
@comtef comtef force-pushed the f_aws_quicksight_template branch 3 times, most recently from 1fc4920 to fd63614 Compare April 20, 2023 16:25
@github-actions github-actions bot added the generators Relates to code generators. label Apr 20, 2023
@comtef comtef force-pushed the f_aws_quicksight_template branch 3 times, most recently from 2797719 to 98b922e Compare April 21, 2023 10:46
@comtef comtef marked this pull request as ready for review April 21, 2023 10:47
@comtef
Copy link
Contributor Author

comtef commented Apr 21, 2023

@jar-b Ready for review, this is a huge one 😱 .

@jar-b
Copy link
Member

jar-b commented Apr 21, 2023

Thanks for the heads up @comtef, and appreciate all your effort! Planning to dig into this next week 👍

@jar-b
Copy link
Member

jar-b commented Apr 26, 2023

Started looking into this today, overall its in great shape just a lot of schema to dig through 😅 .

I did want to ask about import support. The definition object appears to be available from the DescribeTemplateDefinition API and theoretically could be included in the read call to support both import and definition drift detection:

	definitionResp, err := conn.DescribeTemplateDefinitionWithContext(ctx, &quicksight.DescribeTemplateDefinitionInput{
		AwsAccountId: aws.String(awsAccountId),
		TemplateId:   aws.String(templateId),
	})
	if err != nil {
		return diag.Errorf("describing QuickSight Template (%s) Definition: %s", d.Id(), err)
	}
	// TODO: implement flattener
	if err := d.Set("definition", quicksightschema.FlattenDefinition(definitionResp.Definition)); err != nil {
		return diag.Errorf("setting definition: %s", err)
	}

Was this something that you already investigated and found issues with? Or was it omitted for now due to the scope of the corresponding flattener functions?

If its the latter, I'd be happy to help out with rounding out and testing this portion of the resource, just let me know!

@comtef
Copy link
Contributor Author

comtef commented Apr 27, 2023

Started looking into this today, overall its in great shape just a lot of schema to dig through 😅 .

I did want to ask about import support. The definition object appears to be available from the DescribeTemplateDefinition API and theoretically could be included in the read call to support both import and definition drift detection:

	definitionResp, err := conn.DescribeTemplateDefinitionWithContext(ctx, &quicksight.DescribeTemplateDefinitionInput{
		AwsAccountId: aws.String(awsAccountId),
		TemplateId:   aws.String(templateId),
	})
	if err != nil {
		return diag.Errorf("describing QuickSight Template (%s) Definition: %s", d.Id(), err)
	}
	// TODO: implement flattener
	if err := d.Set("definition", quicksightschema.FlattenDefinition(definitionResp.Definition)); err != nil {
		return diag.Errorf("setting definition: %s", err)
	}

Was this something that you already investigated and found issues with? Or was it omitted for now due to the scope of the corresponding flattener functions?

If its the latter, I'd be happy to help out with rounding out and testing this portion of the resource, just let me know!

No issue, I noticed this API to get a full description of the resource but the scope was already wide so I decided to implement it partially. The read operation can indeed be completed with this API. We can implement the remaining flatteners if needed but it's going to be a lot of code again.
Feel free to move code around, I tried to split schemas based on features but I'm not sure it's perfect. Most of the code will be shared with the analysis resource (also based on a definition or source entity).

Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉

$ make testacc PKG=quicksight TESTS=TestAccQuickSightTemplate_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/quicksight/... -v -count 1 -parallel 20 -run='TestAccQuickSightTemplate_'  -timeout 180m
?       github.com/hashicorp/terraform-provider-aws/internal/service/quicksight/schema  [no test files]

--- PASS: TestAccQuickSightTemplate_disappears (33.61s)
--- PASS: TestAccQuickSightTemplate_BarChart (36.68s)
--- PASS: TestAccQuickSightTemplate_basic (37.21s)
--- PASS: TestAccQuickSightTemplate_TemplateSourceEntity (39.70s)
--- PASS: TestAccQuickSightTemplate_Table (58.76s)
--- PASS: TestAccQuickSightTemplate_tags (81.93s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/quicksight 85.197s
$ make testacc PKG=quicksight TESTS=TestAccQuickSightDataSet_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/quicksight/... -v -count 1 -parallel 20 -run='TestAccQuickSightDataSet_'  -timeout 180m
?       github.com/hashicorp/terraform-provider-aws/internal/service/quicksight/schema  [no test files]

--- PASS: TestAccQuickSightDataSet_disappears (34.05s)
--- PASS: TestAccQuickSightDataSet_dataSetUsageConfiguration (37.30s)
--- PASS: TestAccQuickSightDataSet_rowLevelPermissionTagConfiguration (38.45s)
--- PASS: TestAccQuickSightDataSet_columnGroups (38.49s)
--- PASS: TestAccQuickSightDataSet_columnLevelPermissionRules (38.55s)
--- PASS: TestAccQuickSightDataSet_basic (38.60s)
--- PASS: TestAccQuickSightDataSet_fieldFolders (38.64s)
--- PASS: TestAccQuickSightDataSet_logicalTableMap (60.78s)
--- PASS: TestAccQuickSightDataSet_tags (75.10s)
--- PASS: TestAccQuickSightDataSet_permissions (80.24s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/quicksight 83.401s
$ make testacc PKG=quicksight TESTS=TestAccQuickSightDataSource_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/quicksight/... -v -count 1 -parallel 20 -run='TestAccQuickSightDataSource_'  -timeout 180m
?       github.com/hashicorp/terraform-provider-aws/internal/service/quicksight/schema  [no test files]

--- PASS: TestAccQuickSightDataSource_disappears (22.25s)
--- PASS: TestAccQuickSightDataSource_basic (26.12s)
--- PASS: TestAccQuickSightDataSource_tags (57.51s)
--- PASS: TestAccQuickSightDataSource_permissions (61.55s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/quicksight 64.693s

@jar-b jar-b merged commit efb114e into hashicorp:main May 9, 2023
@github-actions github-actions bot added this to the v4.67.0 milestone May 9, 2023
@jar-b
Copy link
Member

jar-b commented May 9, 2023

Thanks for your contribution, @comtef. 🥇 This was a huge resource!

In case you're interested in future contributions, a form to join our contributors Slack channel is available here. Thanks again!

@github-actions
Copy link

This functionality has been released in v4.67.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. flex Pertains to FLatteners and EXpanders. generators Relates to code generators. new-resource Introduces a new resource. service/quicksight Issues and PRs that pertain to the quicksight service. size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Additional QuickSight resource: aws_quicksight_template
2 participants