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

New Resource: aws_waf_regex_pattern_set #3913

Merged
merged 1 commit into from
Mar 27, 2018
Merged

Conversation

radeksimko
Copy link
Member

Test results

TF_ACC=1 go test ./aws -v -run=TestAccAWSWafRegexPatternSet_ -timeout 120m
=== RUN   TestAccAWSWafRegexPatternSet_basic
--- PASS: TestAccAWSWafRegexPatternSet_basic (27.71s)
=== RUN   TestAccAWSWafRegexPatternSet_changePatterns
--- PASS: TestAccAWSWafRegexPatternSet_changePatterns (45.94s)
=== RUN   TestAccAWSWafRegexPatternSet_noPatterns
--- PASS: TestAccAWSWafRegexPatternSet_noPatterns (26.19s)
=== RUN   TestAccAWSWafRegexPatternSet_disappears
--- PASS: TestAccAWSWafRegexPatternSet_disappears (21.55s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	121.408s

@radeksimko radeksimko added new-resource Introduces a new resource. service/waf Issues and PRs that pertain to the waf service. labels Mar 26, 2018
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Mar 26, 2018
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.

Some minor things below but nothing blocking merge. 👍

Delete: resourceAwsWafRegexPatternSetDelete,

Schema: map[string]*schema.Schema{
"name": &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.

Minor nitpick: Extraneous &schema.Schema here and below


resp, err := conn.GetRegexPatternSet(params)
if err != nil {
if isAWSErr(err, "WAFNonexistentItemException", "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

I see this is related to an upstream SDK issue you filed 😄 aws/aws-sdk-go#1856

Maybe we should note there's a constant available that doesn't seem to include that prefix: waf.ErrCodeNonexistentItemException in case a future traveler might go fixing this?

oldPatterns := d.Get("regex_pattern_strings").(*schema.Set).List()
if len(oldPatterns) > 0 {
noPatterns := []interface{}{}
err := updateWafRegexPatternSetPatternStrings(d.Id(), oldPatterns, noPatterns, conn)
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of my own curiosity, what error does it throw if you do not empty the patterns before attempting to delete? Maybe we should include it as a comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

WAFNonEmptyEntityException: The referenced entity is not empty.

I feel like it's a matter of being a good citizen and cleaning up after myself, rather than avoiding an error 😝

return updates
}

func sliceContainsString(slice []interface{}, s string) (int, bool) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should be moved into utils.go or helper/X?

@radeksimko radeksimko force-pushed the f-waf-regex-pattern-set branch from e2dc307 to 8064038 Compare March 27, 2018 12:19
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Mar 27, 2018
@radeksimko radeksimko force-pushed the f-waf-regex-pattern-set branch from 8064038 to 98dae17 Compare March 27, 2018 12:21
@ghost ghost added the size/L Managed by automation to categorize the size of a PR. label Mar 27, 2018
@radeksimko
Copy link
Member Author

Thanks for the review, acceptance tests still passing:

TF_ACC=1 go test ./aws -v -run=TestAccAWSWafRegexPatternSet_ -timeout 120m
=== RUN   TestAccAWSWafRegexPatternSet_basic
--- PASS: TestAccAWSWafRegexPatternSet_basic (68.05s)
=== RUN   TestAccAWSWafRegexPatternSet_changePatterns
--- PASS: TestAccAWSWafRegexPatternSet_changePatterns (114.46s)
=== RUN   TestAccAWSWafRegexPatternSet_noPatterns
--- PASS: TestAccAWSWafRegexPatternSet_noPatterns (32.77s)
=== RUN   TestAccAWSWafRegexPatternSet_disappears
--- PASS: TestAccAWSWafRegexPatternSet_disappears (27.10s)
PASS
ok  	github.com/terraform-providers/terraform-provider-aws/aws	242.422s

@radeksimko radeksimko merged commit e6b0b62 into master Mar 27, 2018
@radeksimko radeksimko deleted the f-waf-regex-pattern-set branch March 27, 2018 12:30
@bflad bflad added this to the v1.13.0 milestone Mar 29, 2018
@bflad
Copy link
Contributor

bflad commented Mar 29, 2018

This has been released in version 1.13.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 7, 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 7, 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. service/waf Issues and PRs that pertain to the waf 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.

2 participants