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/aws_wafregional_web_acl: Add arn attribute and logging_configuration argument #7480

Merged
merged 1 commit into from
Feb 11, 2019

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Feb 8, 2019

This also enhances the documentation organization and adds an example of group rule usage.

Reference: #5760

Output from acceptance testing:

--- PASS: TestAccAWSWafRegionalWebAcl_noRules (18.11s)
--- PASS: TestAccAWSWafRegionalWebAcl_createGroup (31.70s)
--- PASS: TestAccAWSWafRegionalWebAcl_basic (36.22s)
--- PASS: TestAccAWSWafRegionalWebAcl_createRateBased (41.71s)
--- PASS: TestAccAWSWafRegionalWebAcl_changeDefaultAction (49.67s)
--- PASS: TestAccAWSWafRegionalWebAcl_changeNameForceNew (51.45s)
--- PASS: TestAccAWSWafRegionalWebAcl_disappears (57.65s)
--- PASS: TestAccAWSWafRegionalWebAcl_changeRules (59.63s)
--- PASS: TestAccAWSWafRegionalWebAcl_LoggingConfiguration (86.47s)

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. service/waf Issues and PRs that pertain to the waf service. labels Feb 8, 2019
@bflad bflad requested a review from a team February 8, 2019 16:47
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Feb 8, 2019
…guration argument

This also enhances the documentation organization and adds an example of group rule usage.

Reference: #5760

Output from acceptance testing:

```
--- PASS: TestAccAWSWafRegionalWebAcl_noRules (18.11s)
--- PASS: TestAccAWSWafRegionalWebAcl_createGroup (31.70s)
--- PASS: TestAccAWSWafRegionalWebAcl_basic (36.22s)
--- PASS: TestAccAWSWafRegionalWebAcl_createRateBased (41.71s)
--- PASS: TestAccAWSWafRegionalWebAcl_changeDefaultAction (49.67s)
--- PASS: TestAccAWSWafRegionalWebAcl_changeNameForceNew (51.45s)
--- PASS: TestAccAWSWafRegionalWebAcl_disappears (57.65s)
--- PASS: TestAccAWSWafRegionalWebAcl_changeRules (59.63s)
--- PASS: TestAccAWSWafRegionalWebAcl_LoggingConfiguration (86.47s)
```
@bflad bflad force-pushed the f-aws_wafregional_web_acl-logging_configuration branch from 565eb72 to 6bf842d Compare February 8, 2019 17:18
"logging_configuration": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Copy link
Contributor

@nywilken nywilken Feb 8, 2019

Choose a reason for hiding this comment

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

General question: MaxItems implies the number of resources that can be defined within this TypeList, but since this resource happens to be a map of *scheme.Schema the resource within the TypeList has no bounds on the number of keys defined within it. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thats correct, the MaxItems on a schema.TypeList defines the number of configuration blocks allowed, not the number of nested attributes inside. TypeList and MaxItems: 1 is a common pattern for resources to generate a single configuration block, e.g.

resource "TYPE" "NAME" {
  logging_configuration {
    # ... nested attributes ...
  }
}

The following configuration will throw a validation error at plan time:

resource "TYPE" "NAME" {
  logging_configuration {
    # ... nested attributes ...
  }

  logging_configuration {
    # ... nested attributes ...
  }
}

Copy link
Contributor

Choose a reason for hiding this comment

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

🙏 thanks for explanation and example case, which I validated as well 😉

return fmt.Errorf("error getting WAF Regional Web ACL (%s) Logging Configuration: %s", d.Id(), err)
}

if getLoggingConfigurationOutput != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

General question: This seems to imply that the output can be nil even if there is no error. Is that the case or is this more of a guard pattern that is followed in the case base?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is one of those panic protections that is likely to never get used, but just in case the API or SDK does something unexpected in the future. Better safe than sorry; we've gotten burned in the past with API response changes.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for that background. I'll keep that in mind for the future.

Copy link
Contributor

@nywilken nywilken left a comment

Choose a reason for hiding this comment

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

Nicely done. I left a couple of questions for my general understanding but this is good to go 🚀

@bflad bflad added this to the v1.59.0 milestone Feb 11, 2019
@bflad bflad merged commit 7bd4b9a into master Feb 11, 2019
@bflad bflad deleted the f-aws_wafregional_web_acl-logging_configuration branch February 11, 2019 13:24
bflad added a commit that referenced this pull request Feb 11, 2019
@bflad
Copy link
Contributor Author

bflad commented Feb 14, 2019

This has been released in version 1.59.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 Mar 31, 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 31, 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. enhancement Requests to existing resources that expand the functionality or scope. service/waf Issues and PRs that pertain to the waf 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