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

service/guardduty: Support GuardDuty Organizations #13034

Merged
merged 2 commits into from
Apr 30, 2020

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Apr 27, 2020

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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #13005
Closes #13006

Release note for CHANGELOG:

FEATURES:

* **New Resource:** `aws_guardduty_organization_admin_account`
* **New Resource:** `aws_guardduty_organization_configuration`

Output from acceptance testing (from the Organizations testing account):

--- PASS: TestAccAWSGuardDuty (137.70s)
    --- PASS: TestAccAWSGuardDuty/Detector (58.97s)
        --- PASS: TestAccAWSGuardDuty/Detector/basic (41.45s)
        --- PASS: TestAccAWSGuardDuty/Detector/import (17.52s)
    --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount (31.74s)
        --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount/basic (31.74s)
    --- PASS: TestAccAWSGuardDuty/OrganizationConfiguration (46.99s)
        --- PASS: TestAccAWSGuardDuty/OrganizationConfiguration/basic (46.99s)

Reference: #13005
Reference: #13006

Changes:

```
FEATURES:

* **New Resource:** `aws_guardduty_organization_admin_account`
* **New Resource:** `aws_guardduty_organization_configuration`
```

Output from acceptance testing:

```
--- PASS: TestAccAWSGuardDuty (137.70s)
    --- PASS: TestAccAWSGuardDuty/Detector (58.97s)
        --- PASS: TestAccAWSGuardDuty/Detector/basic (41.45s)
        --- PASS: TestAccAWSGuardDuty/Detector/import (17.52s)
    --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount (31.74s)
        --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount/basic (31.74s)
    --- PASS: TestAccAWSGuardDuty/OrganizationConfiguration (46.99s)
        --- PASS: TestAccAWSGuardDuty/OrganizationConfiguration/basic (46.99s)
```
@bflad bflad added the new-resource Introduces a new resource. label Apr 27, 2020
@bflad bflad requested a review from a team April 27, 2020 13:49
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/XL Managed by automation to categorize the size of a PR. provider Pertains to the provider itself, rather than any interaction with AWS. service/guardduty Issues and PRs that pertain to the guardduty service. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Apr 27, 2020
@bflad bflad removed the needs-triage Waiting for first response or review from a maintainer. label Apr 27, 2020
Copy link
Contributor

@gdavison gdavison left a comment

Choose a reason for hiding this comment

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

A couple comments, otherwise LGTM 🚀

--- PASS: TestAccAWSGuardDuty (129.63s)
--- PASS: TestAccAWSGuardDuty/OrganizationConfiguration (1.07s)
--- SKIP: TestAccAWSGuardDuty/OrganizationConfiguration/basic (1.07s)
--- PASS: TestAccAWSGuardDuty/ThreatIntelSet (34.41s)
--- PASS: TestAccAWSGuardDuty/ThreatIntelSet/basic (21.10s)
--- PASS: TestAccAWSGuardDuty/ThreatIntelSet/import (13.32s)
--- PASS: TestAccAWSGuardDuty/Member (10.06s)
--- PASS: TestAccAWSGuardDuty/Member/basic (10.06s)
--- SKIP: TestAccAWSGuardDuty/Member/inviteOnUpdate (0.00s)
--- SKIP: TestAccAWSGuardDuty/Member/inviteDisassociate (0.00s)
--- SKIP: TestAccAWSGuardDuty/Member/invitationMessage (0.00s)
--- PASS: TestAccAWSGuardDuty/Detector (49.98s)
--- PASS: TestAccAWSGuardDuty/Detector/basic (27.82s)
--- PASS: TestAccAWSGuardDuty/Detector/datasource_basic (12.88s)
--- PASS: TestAccAWSGuardDuty/Detector/datasource_id (9.28s)
--- PASS: TestAccAWSGuardDuty/InviteAccepter (0.00s)
--- SKIP: TestAccAWSGuardDuty/InviteAccepter/basic (0.00s)
--- PASS: TestAccAWSGuardDuty/IPSet (33.09s)
--- PASS: TestAccAWSGuardDuty/IPSet/import (13.31s)
--- PASS: TestAccAWSGuardDuty/IPSet/basic (19.78s)
--- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount (1.02s)
--- SKIP: TestAccAWSGuardDuty/OrganizationAdminAccount/basic (1.02s)


if aws.StringValue(adminAccount.AdminAccountId) == adminAccountID {
result = adminAccount
break
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we've found the result here, we could return false to stop iterating pages

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Yes, we should return there. 👍

}

if _, err := waiter.AdminAccountNotFound(conn, d.Id()); err != nil {
return fmt.Errorf("error waiting for GuardDuty Organization Admin Account (%s) disable: %w", d.Id(), err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: to disable

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Will update that. 👍

@bflad bflad added this to the v2.60.0 milestone Apr 29, 2020
…comments

Reference: #13034 (review)

Output from acceptance testing:

```
    --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount (44.91s)
        --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount/basic (44.91s)
```
@bflad
Copy link
Contributor Author

bflad commented Apr 29, 2020

Acceptance testing good after returning early:

    --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount (44.91s)
        --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount/basic (44.91s)

Will merge tomorrow if CI looks good still. 👍

@bflad bflad merged commit c423a44 into master Apr 30, 2020
@bflad bflad deleted the f-aws_guardduty_organization_configuration branch April 30, 2020 12:23
bflad added a commit that referenced this pull request Apr 30, 2020
@ghost
Copy link

ghost commented May 1, 2020

This has been released in version 2.60.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 for triage. Thanks!

adamdecaf pushed a commit to adamdecaf/terraform-provider-aws that referenced this pull request May 28, 2020
* service/guardduty: Support GuardDuty Organizations

Reference: hashicorp#13005
Reference: hashicorp#13006

Changes:

```
FEATURES:

* **New Resource:** `aws_guardduty_organization_admin_account`
* **New Resource:** `aws_guardduty_organization_configuration`
```

Output from acceptance testing:

```
--- PASS: TestAccAWSGuardDuty (137.70s)
    --- PASS: TestAccAWSGuardDuty/Detector (58.97s)
        --- PASS: TestAccAWSGuardDuty/Detector/basic (41.45s)
        --- PASS: TestAccAWSGuardDuty/Detector/import (17.52s)
    --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount (31.74s)
        --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount/basic (31.74s)
    --- PASS: TestAccAWSGuardDuty/OrganizationConfiguration (46.99s)
        --- PASS: TestAccAWSGuardDuty/OrganizationConfiguration/basic (46.99s)
```

* resource/aws_guardduty_organization_admin_account: Adjust for review comments

Reference: hashicorp#13034 (review)

Output from acceptance testing:

```
    --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount (44.91s)
        --- PASS: TestAccAWSGuardDuty/OrganizationAdminAccount/basic (44.91s)
```
@ghost
Copy link

ghost commented May 30, 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 May 30, 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/guardduty Issues and PRs that pertain to the guardduty 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
2 participants