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

resource/securityhub_insight: new resource #18494

Merged
merged 12 commits into from
Apr 15, 2021
Merged

Conversation

anGie44
Copy link
Contributor

@anGie44 anGie44 commented Mar 31, 2021

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 #6674
Output from acceptance testing:

--- PASS: TestAccAWSSecurityHub_serial (234.62s)
    --- PASS: TestAccAWSSecurityHub_serial/Insight (234.62s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/disappears (13.31s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/DateFilters (25.59s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/KeywordFilters (27.56s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MapFilters (14.91s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/NumberFilters (35.83s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/basic (13.93s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/IpFilters (15.17s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MultipleFilters (29.22s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/Name (23.21s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/WorkflowStatus (13.35s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/GroupByAttribute (22.52s)

@anGie44 anGie44 requested a review from a team as a code owner March 31, 2021 03:39
@ghost ghost added size/XXL 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. service/securityhub Issues and PRs that pertain to the securityhub service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Mar 31, 2021
@anGie44 anGie44 added the new-resource Introduces a new resource. label Mar 31, 2021
@anGie44 anGie44 force-pushed the f-securityhub-insight-resource branch 4 times, most recently from ae4dfd4 to 1bf3741 Compare March 31, 2021 04:00
Comment on lines +351 to +376
func numberFilterSchema() *schema.Schema {
return &schema.Schema{
Type: schema.TypeSet,
Optional: true,
MaxItems: 20,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"eq": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateTypeStringNullableFloat,
},
"gte": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateTypeStringNullableFloat,
},
"lte": {
Type: schema.TypeString,
Optional: true,
ValidateFunc: validateTypeStringNullableFloat,
},
},
},
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

using a string here in place of using the Float type to help distinguish between a 0 value supplied by a user and the default we get from calling d.Get()/extracting the values from the nested map..i think this is an ok alternative atm, but wondering if we have other strategies to work with?

@anGie44 anGie44 force-pushed the f-securityhub-insight-resource branch from 1bf3741 to fca6674 Compare March 31, 2021 17:05
@YakDriver YakDriver self-assigned this Apr 15, 2021
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

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

Looks like some hardcoded ARN somewhere in there:

GovCloud is sad.

=== RUN   TestAccAWSSecurityHub_serial/Insight/Name
    resource_aws_securityhub_insight_test.go:282: Step 1/3 error: Check failed: Check 2/3 error: aws_securityhub_insight.test: Attribute 'arn' didn't match "arn:aws-us-gov:securityhub:us-gov-west-1:357342307427:insight/357342307427/custom/.+$", got "arn:aws:securityhub:us-gov-west-1:357342307427:insight/357342307427/custom/b81d92d3-7ea7-4bda-afd7-aec03030f714"
=== RUN   TestAccAWSSecurityHub_serial/Insight/NumberFilters
=== RUN   TestAccAWSSecurityHub_serial/Insight/basic
    resource_aws_securityhub_insight_test.go:22: Step 1/2 error: Check failed: Check 2/7 error: aws_securityhub_insight.test: Attribute 'arn' didn't match "arn:aws-us-gov:securityhub:us-gov-west-1:357342307427:insight/357342307427/custom/.+$", got "arn:aws:securityhub:us-gov-west-1:357342307427:insight/357342307427/custom/33b4d342-83d3-4ff8-85e2-1909eb7eade9"
=== RUN   TestAccAWSSecurityHub_serial/Insight/WorkflowStatus
--- FAIL: TestAccAWSSecurityHub_serial (253.27s)
    --- FAIL: TestAccAWSSecurityHub_serial/Insight (253.27s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/IpFilters (19.28s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/disappears (14.82s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/DateFilters (33.30s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/GroupByAttribute (30.23s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/KeywordFilters (17.89s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MapFilters (19.43s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MultipleFilters (35.18s)
        --- FAIL: TestAccAWSSecurityHub_serial/Insight/Name (10.26s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/NumberFilters (44.91s)
        --- FAIL: TestAccAWSSecurityHub_serial/Insight/basic (10.25s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/WorkflowStatus (17.73s)

@anGie44 anGie44 force-pushed the f-securityhub-insight-resource branch from dd7a520 to f243ff0 Compare April 15, 2021 17:44
@anGie44
Copy link
Contributor Author

anGie44 commented Apr 15, 2021

Output of acceptance tests (GovCloud):

--- PASS: TestAccAWSSecurityHub_serial (270.50s)
    --- PASS: TestAccAWSSecurityHub_serial/Insight (270.50s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/GroupByAttribute (31.60s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/KeywordFilters (19.14s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MapFilters (17.09s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/Name (29.53s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/NumberFilters (44.58s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/basic (17.95s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/disappears (14.95s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/DateFilters (32.53s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/IpFilters (17.18s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MultipleFilters (28.84s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/WorkflowStatus (17.10s)

Commercial:

--- PASS: TestAccAWSSecurityHub_serial (208.34s)
    --- PASS: TestAccAWSSecurityHub_serial/Insight (208.34s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/disappears (13.06s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/DateFilters (24.38s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/IpFilters (13.56s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/KeywordFilters (15.58s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MapFilters (13.51s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/NumberFilters (33.45s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/WorkflowStatus (13.45s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/basic (13.46s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/GroupByAttribute (23.03s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MultipleFilters (22.66s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/Name (22.21s)

@anGie44 anGie44 force-pushed the f-securityhub-insight-resource branch from f243ff0 to 2978e61 Compare April 15, 2021 17:54
Copy link
Member

@YakDriver YakDriver left a comment

Choose a reason for hiding this comment

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

Excellent work! 🎉 It's cool to see the new context stuff in action.

Just a few nits.

Acceptance tests in GovCloud:

--- PASS: TestAccAWSSecurityHub_serial (275.37s)
    --- PASS: TestAccAWSSecurityHub_serial/Insight (275.37s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/GroupByAttribute (36.06s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/IpFilters (18.01s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MultipleFilters (29.80s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/NumberFilters (43.84s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/WorkflowStatus (17.69s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/disappears (15.72s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/DateFilters (31.84s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/KeywordFilters (17.55s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MapFilters (17.58s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/Name (29.73s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/basic (17.54s)

Acceptance tests in commercial:

--- PASS: TestAccAWSSecurityHub_serial (216.08s)
    --- PASS: TestAccAWSSecurityHub_serial/Insight (216.08s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/Name (25.07s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/NumberFilters (34.71s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/WorkflowStatus (14.20s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/basic (14.07s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/disappears (11.97s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/DateFilters (24.90s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/KeywordFilters (14.51s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MultipleFilters (23.57s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/GroupByAttribute (23.45s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/IpFilters (15.35s)
        --- PASS: TestAccAWSSecurityHub_serial/Insight/MapFilters (14.28s)

aws/resource_aws_securityhub_insight.go Show resolved Hide resolved
website/docs/r/securityhub_insight.html.markdown Outdated Show resolved Hide resolved
website/docs/r/securityhub_insight.html.markdown Outdated Show resolved Hide resolved
website/docs/r/securityhub_insight.html.markdown Outdated Show resolved Hide resolved
website/docs/r/securityhub_insight.html.markdown Outdated Show resolved Hide resolved
Co-authored-by: Dirk Avery <31492422+YakDriver@users.noreply.github.com>
anGie44 and others added 4 commits April 15, 2021 16:08
Co-authored-by: Dirk Avery <31492422+YakDriver@users.noreply.github.com>
Co-authored-by: Dirk Avery <31492422+YakDriver@users.noreply.github.com>
Co-authored-by: Dirk Avery <31492422+YakDriver@users.noreply.github.com>
@anGie44 anGie44 force-pushed the f-securityhub-insight-resource branch from b70808f to 10213f2 Compare April 15, 2021 20:36
@anGie44 anGie44 added this to the v3.37.0 milestone Apr 15, 2021
@anGie44 anGie44 merged commit f182ca9 into main Apr 15, 2021
@anGie44 anGie44 deleted the f-securityhub-insight-resource branch April 15, 2021 22:29
github-actions bot pushed a commit that referenced this pull request Apr 15, 2021
@ghost
Copy link

ghost commented Apr 16, 2021

This has been released in version 3.37.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!

@ghost
Copy link

ghost commented May 16, 2021

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 as resolved and limited conversation to collaborators May 16, 2021
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/securityhub Issues and PRs that pertain to the securityhub service. size/XXL 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.

Feature Request: Security Hub
2 participants