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

[WIP] Add aws_guardduty_filter provider #11086

Closed
wants to merge 1 commit into from

Conversation

phundisk
Copy link

@phundisk phundisk commented Dec 2, 2019

Attempted to add provider per #9647

Still need to add tests and tags resource but looking for general feedback on my approach and any go best practices since I am new to Go.

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

Closes #9647

Release note for CHANGELOG:

Adding provider aws_guardduty_filter resource
Adding tag capability to AWS GuardDuty resources

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccXXX'

...

@phundisk phundisk requested a review from a team December 2, 2019 16:25
@ghost ghost added needs-triage Waiting for first response or review from a maintainer. size/L 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. labels Dec 2, 2019
@ghost
Copy link

ghost commented Dec 2, 2019

Hello, and thank you for your contribution!

This project recently migrated to the standalone Terraform Plugin SDK. While the migration helps speed up future feature requests and bug fixes to the Terraform AWS Provider's interface with Terraform, it has the unfortunate consequence of requiring minor changes to pull requests created using the old SDK.

This pull request appears to include the Go import path "github.com/hashicorp/terraform/helper/resource", which was from the older SDK. The newer SDK uses import paths beginning with github.com/hashicorp/terraform-plugin-sdk/.

To resolve this situation without losing any existing work, you may be able to Git rebase your branch against the current master branch (example below); replacing any remaining old import paths with the newer ones.

$ git fetch --all
$ git rebase origin/master

Another option is to create a new branch from the current master with the same code changes (replacing the import paths), submit a new pull request, and close this existing pull request.

We apologize for this inconvenience and appreciate your effort. Thank you for contributing and helping make the Terraform AWS Provider better for everyone.

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.

Thanks @phundisk, this is a good start. I have a few comments.

We try to keep the Terraform parameters consistent with the AWS API parameters, and I see that there are a few places where you've changed it a bit.

I've found that writing the acceptance tests as you go alongside the resource code can be very helpful. YMMV, of course.

You'll also need to rebase on the current code as the bot above mentioned

@gdavison gdavison added new-resource Introduces a new resource. and removed needs-triage Waiting for first response or review from a maintainer. labels Jan 7, 2020

Schema: map[string]*schema.Schema{
"detector_id": {
Type: schema.TypeString,
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a validator with a min length of 1 and max length 300

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

Choose a reason for hiding this comment

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

This isn't required by the API, so Terraform shouldn't require it. It also has a max length of 512.

Required: true,
ForceNew: true,
},
"name": {
Copy link
Contributor

Choose a reason for hiding this comment

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

Min length of 3, max 64.

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

Choose a reason for hiding this comment

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

This should be action, and allow either NOOP or ARCHIVE

Type: schema.TypeInt,
Required: true,
},
"filters": {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be finding_criteria to match the API

Type: schema.TypeList,
Required: true,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
Copy link
Contributor

Choose a reason for hiding this comment

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

These elements should match the non-deprecated values of the guardduty.Condition struct. You can make all of the attributes Optional, and then combinations of ConflictsWith, ExactlyOneOf, and AtLeastOneOf as applicable for the filter combinations.

@gdavison gdavison self-assigned this Jan 7, 2020
@idubinskiy
Copy link
Contributor

@gdavison Looks like someone also made an attempt in #10676. Any chance of getting a review for that one, in case it's in a more mergeable state or the opener of it is able to respond more quickly?

@phundisk
Copy link
Author

Hey I am going to take a look at the comments this weekend and get the PR is a good state! Thanks so much for your comments @glasser

@phundisk
Copy link
Author

The one at https://github.com/terraform-providers/terraform-provider-aws/pull/10676/files looks good and a bit more robust than my initial PR. It might make more sense to get that one merged. I can take a look this weekend if we decide to go with my initial PR instead

@gdavison
Copy link
Contributor

Thanks, @phundisk. I've reviewed #10676

@gdavison
Copy link
Contributor

gdavison commented Mar 9, 2020

As mentioned above, we're going to go with #10676. I'm going to close this ticket

@gdavison gdavison closed this Mar 9, 2020
@ghost
Copy link

ghost commented Apr 10, 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 Apr 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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/L Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AWS GuardDuty: Add support for creating filters
3 participants