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

Add aws_quicksight_group resource #8233

Conversation

teraken0509
Copy link
Contributor

Community Note

  • Please vote on this pull request by adding a 👍 reaction to the original pull request comment to help the community and maintainers prioritize this request
  • Please do not leave "+1" comments, they generate extra noise for pull request followers and do not help prioritize the request

Reference #8146

Changes proposed in this pull request:

  • Add aws_quicksight_group resource

Output from acceptance testing:

$  make testacc TEST=./aws TESTARGS='-run=TestAccAWSQuickSightGroup_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSQuickSightGroup_ -timeout 120m
=== RUN   TestAccAWSQuickSightGroup_basic
=== PAUSE TestAccAWSQuickSightGroup_basic
=== RUN   TestAccAWSQuickSightGroup_withDescription
=== PAUSE TestAccAWSQuickSightGroup_withDescription
=== RUN   TestAccAWSQuickSightGroup_disappears
=== PAUSE TestAccAWSQuickSightGroup_disappears
=== CONT  TestAccAWSQuickSightGroup_basic
=== CONT  TestAccAWSQuickSightGroup_withDescription
=== CONT  TestAccAWSQuickSightGroup_disappears
--- PASS: TestAccAWSQuickSightGroup_disappears (35.70s)
--- PASS: TestAccAWSQuickSightGroup_withDescription (55.69s)
--- PASS: TestAccAWSQuickSightGroup_basic (56.63s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	56.694s

@ghost ghost added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. provider Pertains to the provider itself, rather than any interaction with AWS. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 6, 2019
@teraken0509 teraken0509 force-pushed the feature/add-support-for-aws_quicksight_group-resource branch from 677ed94 to d29ac40 Compare April 9, 2019 09:51
@bflad bflad added new-resource Introduces a new resource. service/quicksight Issues and PRs that pertain to the quicksight service. labels Apr 10, 2019
@aeschright aeschright requested a review from a team June 26, 2019 16:49
@teraken0509
Copy link
Contributor Author

@bflad
Could you review this pr ?

Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

Hey @kterada0509 👋 Good job as usual. Left some feedback below, please reach out with any questions or if you do not have time to implement the items.

"namespace": {
Type: schema.TypeString,
Optional: true,
Default: "default",
Copy link
Contributor

Choose a reason for hiding this comment

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

While there are currently no other valid values for this attribute, it also doesn't support in-place updates either so we should include ForceNew: true for now. This can prevent potential issues in the future when other values are supported. 👍

Suggested change
Default: "default",
ForceNew: true,
Default: "default",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.


func resourceAwsQuickSightGroupParseID(id string) (string, string, string, error) {
parts := strings.SplitN(id, "/", 3)
if parts[0] == "" || parts[1] == "" || parts[2] == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if parts[0] == "" || parts[1] == "" || parts[2] == "" {
if len(parts) < 3 || parts[0] == "" || parts[1] == "" || parts[2] == "" {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

return err
}

if output.Group == nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if output.Group == nil {
if output == nil || output.Group == nil {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

Namespace: aws.String(namespace),
GroupName: aws.String(groupName),
})
if !isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

We generally prefer to split this out so we can display any API errors 👍

if isAWSErr(err, quicksight.ErrCodeResourceNotFoundException, "") {
	continue
}

if err != nil {
	return err
}

return fmt.Errorf("Quick Sight Group '%s' was not deleted properly", rs.Primary.ID)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.


func testAccAWSQuickSightGroupConfig(rName string) string {
return fmt.Sprintf(`
provider "aws" {
Copy link
Contributor

Choose a reason for hiding this comment

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

For now, please omit hardcoded provider configurations in test configurations and rely on the environment variable handling. We'll eventually be circling around to fix the problems caused by this type of testing setup. 😄 See also: #8316 and #8983

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed.


"aws_account_id": {
Type: schema.TypeString,
Required: true,
Copy link
Contributor

Choose a reason for hiding this comment

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

This argument can be made optional by reading the AWS Account ID information from the provider itself, e.g.

	awsAccountID := meta.(*AWSClient).accountid
	namespace := d.Get("namespace").(string)

	if v, ok := d.GetOk("aws_account_id"); ok {
		awsAccountID = v.(string)
	}

	createOpts := &quicksight.CreateGroupInput{
		AwsAccountId: aws.String(awsAccountID),
		Namespace:    aws.String(namespace),
		GroupName:    aws.String(d.Get("group_name").(string)),
	}

Then the testing can/should omit the aws_caller_identity data source. 👍

Suggested change
Required: true,
Optional: true,

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

Manages a Resource Quick Sight Group.
---

# aws_quicksight_group
Copy link
Contributor

Choose a reason for hiding this comment

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

We likely added this to the other resource pages after this PR was submitted

Suggested change
# aws_quicksight_group
# Resource: aws_quicksight_group

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed


```hcl
resource "aws_quicksight_group" "example" {
aws_account_id = "123456789123"
Copy link
Contributor

Choose a reason for hiding this comment

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

When this argument is made optional, let's omit this here as well. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.

```hcl
resource "aws_quicksight_group" "example" {
aws_account_id = "123456789123"
group_name = "tf-example"
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: formatting

Suggested change
group_name = "tf-example"
group_name = "tf-example"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed.


* `aws_account_id` - (Required) The ID for the AWS account that the group is in. Currently, you use the ID for the AWS account that contains your Amazon QuickSight account.
* `group_name` - (Required) A name for the group.
given by `source_ami_region`.
Copy link
Contributor

Choose a reason for hiding this comment

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

This looks extraneous 😉

Suggested change
given by `source_ami_region`.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed. 😅

@bflad bflad added the waiting-response Maintainers are waiting on response from community or contributor. label Jul 18, 2019
@teraken0509 teraken0509 force-pushed the feature/add-support-for-aws_quicksight_group-resource branch from d29ac40 to ee54c16 Compare July 18, 2019 11:04
@teraken0509
Copy link
Contributor Author

Re-run acctest

ture/add-support-for-aws_quicksight_group-resource *)$ make testacc TEST=./aws TESTARGS='-run=TestAccAWSQuickSightGroup_'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws -v -parallel 20 -run=TestAccAWSQuickSightGroup_ -timeout 120m
=== RUN   TestAccAWSQuickSightGroup_basic
=== PAUSE TestAccAWSQuickSightGroup_basic
=== RUN   TestAccAWSQuickSightGroup_withDescription
=== PAUSE TestAccAWSQuickSightGroup_withDescription
=== RUN   TestAccAWSQuickSightGroup_disappears
=== PAUSE TestAccAWSQuickSightGroup_disappears
=== CONT  TestAccAWSQuickSightGroup_basic
=== CONT  TestAccAWSQuickSightGroup_disappears
=== CONT  TestAccAWSQuickSightGroup_withDescription
--- PASS: TestAccAWSQuickSightGroup_disappears (28.91s)
--- PASS: TestAccAWSQuickSightGroup_basic (65.12s)
--- PASS: TestAccAWSQuickSightGroup_withDescription (69.85s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	69.965s

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Jul 18, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the updates, @kterada0509 🚀 (One minor note: after activating the subscription it looks like operators choose where the directory is located, so I removed the AWS_DEFAULT_REGION handling in the testing so it can be adjusted by anyone running the testing)

--- PASS: TestAccAWSQuickSightGroup_disappears (10.96s)
--- PASS: TestAccAWSQuickSightGroup_basic (22.27s)
--- PASS: TestAccAWSQuickSightGroup_withDescription (22.77s)

@bflad bflad added this to the v2.20.0 milestone Jul 18, 2019
@bflad bflad merged commit ee54c16 into hashicorp:master Jul 18, 2019
bflad added a commit that referenced this pull request Jul 18, 2019
@nywilken
Copy link
Member

The new aws_quicksight_group resource, has been released in version 2.20.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 resource, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Nov 2, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Nov 2, 2019
@teraken0509 teraken0509 deleted the feature/add-support-for-aws_quicksight_group-resource branch March 5, 2020 14:03
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. new-resource Introduces a new resource. provider Pertains to the provider itself, rather than any interaction with AWS. 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.

None yet

3 participants