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

issue #4772 add arn to aws_waf_ipset #4784

Merged
merged 1 commit into from
Jun 12, 2018

Conversation

saravanan30erd
Copy link
Contributor

Fixes #4772

Changes proposed in this pull request:

  • Change 1
    added attribute arn to aws_waf_ipset

@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Jun 7, 2018
@saravanan30erd
Copy link
Contributor Author

$ make testacc TEST=./aws/ TESTARGS='-run=TestAccAWSWafIPSet_basic'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./aws/ -v -run=TestAccAWSWafIPSet_basic -timeout 120m
=== RUN TestAccAWSWafIPSet_basic
--- PASS: TestAccAWSWafIPSet_basic (46.48s)
PASS
ok github.com/terraform-providers/terraform-provider-aws/aws 46.514s

@ghost ghost added the size/S Managed by automation to categorize the size of a PR. label Jun 9, 2018
@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 Jun 12, 2018
@bflad bflad added this to the v1.23.0 milestone Jun 12, 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.

Aside from the ARN regex being slightly off in the testing, this LGTM 🚀

5 tests passed (all tests)
=== RUN   TestAccAWSWafIPSet_changeDescriptors
--- PASS: TestAccAWSWafIPSet_changeDescriptors (26.30s)
=== RUN   TestAccAWSWafIPSet_noDescriptors
--- PASS: TestAccAWSWafIPSet_noDescriptors (30.09s)
=== RUN   TestAccAWSWafIPSet_disappears
--- PASS: TestAccAWSWafIPSet_disappears (40.15s)
=== RUN   TestAccAWSWafIPSet_changeNameForceNew
--- PASS: TestAccAWSWafIPSet_changeNameForceNew (41.18s)
=== RUN   TestAccAWSWafIPSet_basic
--- PASS: TestAccAWSWafIPSet_basic (48.34s)

@@ -33,6 +34,8 @@ func TestAccAWSWafIPSet_basic(t *testing.T) {
"aws_waf_ipset.ipset", "ip_set_descriptors.4037960608.type", "IPV4"),
resource.TestCheckResourceAttr(
"aws_waf_ipset.ipset", "ip_set_descriptors.4037960608.value", "192.0.7.0/24"),
resource.TestMatchResourceAttr("aws_waf_ipset.ipset", "arn",
regexp.MustCompile(`^arn:[\w-]+:([a-zA-Z0-9\-])+:([a-z]{2}-(gov-)?[a-z]+-\d{1})?:(\d{12})?:(.*)$`)),
Copy link
Contributor

Choose a reason for hiding this comment

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

This regex is pretty hard to read and has some issues:

  • The service name should always be waf
  • The region name should always exist
  • The account ID should always exist
  • The resource should check for ipset/.+

At some point we'll probably create a helper function for ARN testing like this, but as for this case, I will fix these items post-merge with the simpler: ^arn:[\w-]+:waf:[^:]+:\d{12}:ipset/.+$.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually double checking the AWS documentation here: https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-waf

arn:aws:waf::123456789012:ipset/3f74bd8c-f046-4970-a1a7-41aa52e05480

Looks like region name should never be set. I'll adjust the ARN logic and regex here accordingly.

In the regional case, it will include the region, but that is a separate resource and test 👍

arn:aws:waf-regional:us-east-1:123456789012:ipset/3f74bd8c-f046-4970-a1a7-41aa52e05480

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, correct. Will I add arn attribute to aws_wafregional_ipset, is it useful?

Copy link
Contributor

Choose a reason for hiding this comment

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

@saravanan30erd I'm sure someone will eventually be looking for it! 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bflad Its done #4816 👍

@bflad bflad merged commit f130055 into hashicorp:master Jun 12, 2018
bflad added a commit that referenced this pull request Jun 12, 2018
@bflad
Copy link
Contributor

bflad commented Jun 14, 2018

This has been released in version 1.23.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 5, 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 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. service/waf Issues and PRs that pertain to the waf service. size/S Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature Request: Add ARN to aws_waf_ipset
2 participants