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

d/aws_wafregional_web_acl: Add WAFRegional Web ACL lookup datasource #9321

Merged
merged 3 commits into from
Jul 18, 2019

Conversation

robh007
Copy link
Contributor

@robh007 robh007 commented Jul 12, 2019

AWS WAFRegional Web ACL lookup datasource

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

Related #2654

Release note for CHANGELOG:

** New datasource ** `aws_wafregional_web_acl`

Output from acceptance testing:

$ make testacc ./aws TESTARGS='-run=TestAccDataSourceAwsWafRegionalWebAcl'
--- PASS: TestAccDataSourceAwsWafRegionalWebAcl_Basic (26.85s)

...

@robh007 robh007 requested a review from a team July 12, 2019 11:21
@ghost ghost added 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/waf Issues and PRs that pertain to the waf service. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jul 12, 2019
@bflad bflad added the new-data-source Introduces a new data source. label Jul 12, 2019
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.

Hi @robh007 👋 Thank you so much for this contribution! Overall this is looking pretty good, just left a few items below to fix up so we can merge this. 👍 Please reach out if you have any questions or do not have time to implement these items.

)

func TestAccDataSourceAwsWafRegionalWebAcl_Basic(t *testing.T) {
name := "tf-acc-test"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please randomize the naming to prevent issues where the test may have left existing resources? Please see also the Uses Randomized Infrastructure Naming item of the Contributing Guide Thanks!

Suggested change
name := "tf-acc-test"
name := acctest.RandomWithPrefix("tf-acc-test")

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

Choose a reason for hiding this comment

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

Can you please remove the id attribute from the schema? It is implicit with all Terraform resources. Thanks!

@@ -0,0 +1,64 @@
package aws
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please name this file aws/data_source_aws_wafregional_web_acl.go to match the data source naming? Thanks!

@@ -0,0 +1,78 @@
package aws
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please name this file aws/data_source_aws_wafregional_web_acl_test.go to match the data source naming? Thanks!

})
}

func testAccDataSourceAwsWafRegionalWebAclConfig_Name(name string) string {
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we do not need to verify the rules within the Web ACL and they are optional in the resource, can you please remove the extra infrastructure from the test configuration? Thanks!

func testAccDataSourceAwsWafRegionalWebAclConfig_Name(name string) string {
	return fmt.Sprintf(`
resource "aws_wafregional_web_acl" "web_acl" {
  name        = %[1]q
  metric_name = "tfWebACL"

  default_action {
    type = "ALLOW"
  }
}

data "aws_wafregional_web_acl" "web_acl" {
  name = "${aws_wafregional_web_acl.web_acl.name}"
}
`, name)
}

@@ -0,0 +1,30 @@
---
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please add .markdown to the end of the file name here? Otherwise the website page does not load properly. You can verify this with make website.

Screen Shot 2019-07-17 at 11 36 19 AM

page_title: "AWS: aws_wafregional_web_acl"
sidebar_current: "docs-aws-datasource-wafregional-web-acl"
description: |-
Retrieves a WAF Regional Web ACL id.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please fix the YAML here? Otherwise the website page does not load properly. You can verify this with make website.

Suggested change
Retrieves a WAF Regional Web ACL id.
Retrieves a WAF Regional Web ACL id.

Screen Shot 2019-07-17 at 11 36 59 AM


```hcl
data "aws_wafregional_web_acl" "example" {
name = "tfWAFRule"
Copy link
Contributor

Choose a reason for hiding this comment

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

Terraform formatting:

Suggested change
name = "tfWAFRule"
name = "tfWAFRule"

@robh007
Copy link
Contributor Author

robh007 commented Jul 17, 2019

Thanks for the review @bflad, I'll get these sorted.

@ghost ghost added size/M Managed by automation to categorize the size of a PR. and removed size/L Managed by automation to categorize the size of a PR. labels Jul 17, 2019
@robh007
Copy link
Contributor Author

robh007 commented Jul 17, 2019

Changes as requested. @bflad I pushed 3 new data resources for WAF with this work. So I'll go back and check all of those inline with these comments.

Retested.
$ make testacc ./aws TESTARGS='-run=TestAccDataSourceAwsWafRegionalWebAcl'
PASS: TestAccDataSourceAwsWafRegionalWebAcl_Basic (16.50s)

Copy link
Contributor

@ryndaniels ryndaniels left a comment

Choose a reason for hiding this comment

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

Thanks for making these changes, @robh007! 🚀

FYI, I changed the wording in the initial comment from "fixes" to "related" - since #2654 spans multiple data sources, we don't want this one PR to close that whole issue (which the fixes keyword does).

Output from acceptance testing:

[TestAccDataSourceAwsWafRegionalWebAcl_Basic] [Test Output]
=== RUN   TestAccDataSourceAwsWafRegionalWebAcl_Basic
=== PAUSE TestAccDataSourceAwsWafRegionalWebAcl_Basic
=== CONT  TestAccDataSourceAwsWafRegionalWebAcl_Basic
--- PASS: TestAccDataSourceAwsWafRegionalWebAcl_Basic (10.47s)
PASS

👍

@ryndaniels ryndaniels added this to the v2.20.0 milestone Jul 18, 2019
@ryndaniels ryndaniels merged commit 54136ee into hashicorp:master Jul 18, 2019
bflad added a commit that referenced this pull request Jul 18, 2019
@ghost
Copy link

ghost commented Nov 2, 2019

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 Nov 2, 2019
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-data-source Introduces a new data source. provider Pertains to the provider itself, rather than any interaction with AWS. service/waf Issues and PRs that pertain to the waf service. size/M 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.

3 participants