-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
Conversation
…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) ```
565eb72
to
6bf842d
Compare
"logging_configuration": { | ||
Type: schema.TypeList, | ||
Optional: true, | ||
MaxItems: 1, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 ...
}
}
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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 🚀
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. |
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! |
This also enhances the documentation organization and adds an example of group rule usage.
Reference: #5760
Output from acceptance testing: