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 quicksight user resource #10401

Merged
merged 7 commits into from
Oct 11, 2019

Conversation

mjgpy3
Copy link
Contributor

@mjgpy3 mjgpy3 commented Oct 6, 2019

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

Relates #8146, also #8233 (based heavily on the latter, thanks @kterada0509 for the clean PR)

* **New Resource:** `aws_quicksight_user`

Output from acceptance testing:

go: finding github.com/terraform-providers/terraform-provider-tls
v2.1.1+incompatible
go: finding github.com/terraform-providers/terraform-provider-tls
v2.1.1+incompatible
=== RUN   TestAccAWSQuickSightUser_basic
=== PAUSE TestAccAWSQuickSightUser_basic
=== RUN   TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
=== PAUSE TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
=== RUN   TestAccAWSQuickSightUser_disappears
=== PAUSE TestAccAWSQuickSightUser_disappears
=== CONT  TestAccAWSQuickSightUser_basic
=== CONT  TestAccAWSQuickSightUser_disappears
=== CONT  TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
--- PASS: TestAccAWSQuickSightUser_disappears (14.19s)
--- PASS: TestAccAWSQuickSightUser_basic (25.44s)
--- PASS: TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
(26.08s)
PASS
ok        github.com/terraform-providers/terraform-provider-aws/aws
26.109s

@mjgpy3 mjgpy3 requested a review from a team October 6, 2019 21:26
@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 Oct 6, 2019
@bflad bflad added new-resource Introduces a new resource. service/quicksight Issues and PRs that pertain to the quicksight service. labels Oct 10, 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.

Hi @mjgpy3 👋 Thanks for submitting this and overall its off to a good start. Please see the below for an initial review and reach out if you have any questions. Your command above for running the acceptance testing looks right at first glance, so not sure why it would not be running the tests. To troubleshoot, you can try running what the make testacc command should be doing directly, e.g.

$ TF_ACC=1 go test ./aws -v -timeout 120m -parallel 20 -run='TestAccAWSQuickSightUser_'

Also, if you have not seen the Contributing Guide, would highly recommend checking that out. There's a section on running acceptance testing available here: https://github.com/terraform-providers/terraform-provider-aws/blob/master/.github/CONTRIBUTING.md#running-an-acceptance-test

CHANGELOG.md Outdated Show resolved Hide resolved
aws/resource_aws_quicksight_user.go Outdated Show resolved Hide resolved
aws/resource_aws_quicksight_user.go Outdated Show resolved Hide resolved
})
}

func TestAccAWSQuickSightUser_withRealEmail(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: This test doesn't appear to be testing real emails, so maybe worth just noting which attribute we are testing instead

Suggested change
func TestAccAWSQuickSightUser_withRealEmail(t *testing.T) {
func TestAccAWSQuickSightUser_Email(t *testing.T) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed this to TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks which is more what I was going for.

 - Using go-sdk constants
 - Running, fixing and cleaning tests

Here's my current test output
``` bash
AWS_DEFAULT_REGION=us-east-1 AWS_PROFILE=default TF_ACC=1 go test ./aws -v -timeout 120m -parallel 20 -run='TestAccAWSQuickSightUser_'
```

> go: finding github.com/terraform-providers/terraform-provider-tls
> v2.1.1+incompatible
> go: finding github.com/terraform-providers/terraform-provider-tls
> v2.1.1+incompatible
> === RUN   TestAccAWSQuickSightUser_basic
> === PAUSE TestAccAWSQuickSightUser_basic
> === RUN   TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
> === PAUSE TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
> === RUN   TestAccAWSQuickSightUser_disappears
> === PAUSE TestAccAWSQuickSightUser_disappears
> === CONT  TestAccAWSQuickSightUser_basic
> === CONT  TestAccAWSQuickSightUser_disappears
> === CONT  TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
> --- PASS: TestAccAWSQuickSightUser_disappears (14.19s)
> --- PASS: TestAccAWSQuickSightUser_basic (25.44s)
> --- PASS: TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks
> (26.08s)
> PASS
> ok  	github.com/terraform-providers/terraform-provider-aws/aws
> 26.109s

Note that the tests exposed that the `describe-user` QuickSight API does
not return the schema that is documented.

For example, when  I run it via the CLI I get

``` json
{
    "RequestId": "some-guid-looking-thing",
    "Status": 200,
    "User": {
        "Arn":
"arn:aws:quicksight:us-west-2:01234567890:user/default/some_user",
        "PrincipalId": "federated/iam/some_user",
        "Email": "someemail@pfake.com",
        "Active": true,
        "Role": "ADMIN",
        "UserName": "some_user"
    }
}
```

Notice that `IdentityType` is missing though documented!

This means that I had to remove it from attributes and remove the
importer :( since we can't reconcile that value.

If there's a way around this please let me know.

Also note that I couldn't use `acctest.RandomWithPrefix` because the
resultant username was not valid in QuickSight.
@mjgpy3
Copy link
Contributor Author

mjgpy3 commented Oct 10, 2019

@bflad if you get a moment, please check out these updates (especially the last commit message). Thanks!

@bflad bflad self-requested a review October 11, 2019 13:53
@bflad bflad added this to the v2.33.0 milestone Oct 11, 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.

Looks good, thanks so much, @mjgpy3 🚀

--- PASS: TestAccAWSQuickSightUser_disappears (11.71s)
--- PASS: TestAccAWSQuickSightUser_basic (19.19s)
--- PASS: TestAccAWSQuickSightUser_withInvalidFormattedEmailStillWorks (20.03s)

@bflad bflad merged commit ddc0fa6 into hashicorp:master Oct 11, 2019
bflad added a commit that referenced this pull request Oct 11, 2019
@bflad bflad mentioned this pull request Oct 11, 2019
@mjgpy3
Copy link
Contributor Author

mjgpy3 commented Oct 11, 2019

Thanks @bflad!

mjgpy3 added a commit to mjgpy3/terraform-provider-aws that referenced this pull request Oct 22, 2019
This makes things consistent with
hashicorp#10401
and the AWS documentation.
aeschright pushed a commit that referenced this pull request Oct 23, 2019
This makes things consistent with
#10401
and the AWS documentation.
@ghost
Copy link

ghost commented Mar 29, 2020

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 Mar 29, 2020
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.

2 participants