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/wafv2_rule_group: remove force_new property from arguments to prevent resource recreation #14617

Merged
merged 2 commits into from
Aug 13, 2020

Conversation

anGie44
Copy link
Contributor

@anGie44 anGie44 commented Aug 13, 2020

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" or other comments that do not add relevant new information or questions, they generate extra noise for pull request followers and do not help prioritize the request

Closes #14071

Notes:

Release note for CHANGELOG:

resource/wafv2_rule_group: remove ForceNew property from rule.name and rule.visibility_config.metric_name

Output from acceptance testing:

--- FAIL: TestAccAwsWafv2RuleGroup_RegexPatternSetReferenceStatement (35.07s) -- related to SDK v2 change
--- PASS: TestAccAwsWafv2RuleGroup_Disappears (38.05s)
--- FAIL: TestAccAwsWafv2RuleGroup_IpSetReferenceStatement (41.27s) -- related to SDK v2 change
--- PASS: TestAccAwsWafv2RuleGroup_basic (62.70s)
--- PASS: TestAccAwsWafv2RuleGroup_Minimal (90.06s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeMetricNameForceNew (97.95s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeNameForceNew (107.32s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeCapacityForceNew (119.84s)
--- PASS: TestAccAwsWafv2RuleGroup_updateRule (120.98s)
--- PASS: TestAccAwsWafv2RuleGroup_XssMatchStatement (126.45s)
--- PASS: TestAccAwsWafv2RuleGroup_GeoMatchStatement (131.37s)
--- PASS: TestAccAwsWafv2RuleGroup_SqliMatchStatement (136.56s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement (139.25s)
--- PASS: TestAccAwsWafv2RuleGroup_SizeConstraintStatement (142.13s)
--- PASS: TestAccAwsWafv2RuleGroup_Tags (155.74s)
--- PASS: TestAccAwsWafv2RuleGroup_RuleAction (160.51s)
--- PASS: TestAccAwsWafv2RuleGroup_LogicalRuleStatements (166.36s)
--- PASS: TestAccAwsWafv2RuleGroup_updateRuleProperties (172.81s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement_FieldToMatch (252.81s)

Output from terraform plan with code change (priority updated from 10->1 in-place):

Terraform will perform the following actions:

  # aws_wafv2_rule_group.example will be updated in-place
  ~ resource "aws_wafv2_rule_group" "example" {
        arn         = "arn:aws:wafv2:us-west-2:xxxxxxx:regional/rulegroup/tf-acc-test-123/7f5e6b39-014f-408e-8b02-cbf9c6500346"
        capacity    = 50
        description = "tf-acc-test-123"
        id          = "7f5e6b39-014f-408e-8b02-cbf9c6500346"
        lock_token  = "bc6d16b9-de95-4f74-bb8f-0c3a6bad3f53"
        name        = "tf-acc-test-123"
        scope       = "REGIONAL"
        tags        = {}

      - rule {
          - name     = "rule-2" -> null
          - priority = 10 -> null

          - action {

              - block {}
            }

          - statement {

              - size_constraint_statement {
                  - comparison_operator = "LT" -> null
                  - size                = 50 -> null

                  - field_to_match {

                      - query_string {}
                    }

                  - text_transformation {
                      - priority = 2 -> null
                      - type     = "CMD_LINE" -> null
                    }
                  - text_transformation {
                      - priority = 5 -> null
                      - type     = "NONE" -> null
                    }
                }
            }

          - visibility_config {
              - cloudwatch_metrics_enabled = false -> null
              - metric_name                = "friendly-rule-metric-name" -> null
              - sampled_requests_enabled   = false -> null
            }
        }
      + rule {
          + name     = "rule-2"
          + priority = 1

          + action {

              + block {}
            }

          + statement {

              + size_constraint_statement {
                  + comparison_operator = "LT"
                  + size                = 50

                  + field_to_match {

                      + query_string {}
                    }

                  + text_transformation {
                      + priority = 2
                      + type     = "CMD_LINE"
                    }
                  + text_transformation {
                      + priority = 5
                      + type     = "NONE"
                    }
                }
            }

          + visibility_config {
              + cloudwatch_metrics_enabled = false
              + metric_name                = "friendly-rule-metric-name"
              + sampled_requests_enabled   = false
            }
        }

        visibility_config {
            cloudwatch_metrics_enabled = false
            metric_name                = "friendly-metric-name"
            sampled_requests_enabled   = false
        }
    }

Plan: 0 to add, 1 to change, 0 to destroy.

@anGie44 anGie44 requested a review from a team August 13, 2020 07:01
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. service/wafv2 Issues and PRs that pertain to the wafv2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Aug 13, 2020
@anGie44 anGie44 added the bug Addresses a defect in current functionality. label Aug 13, 2020
@bflad bflad self-assigned this Aug 13, 2020
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.

LGTM 🚀

Output from acceptance testing (failures unrelated):

--- FAIL: TestAccAwsWafv2RuleGroup_IpSetReferenceStatement (157.68s)
--- FAIL: TestAccAwsWafv2RuleGroup_RegexPatternSetReferenceStatement (167.82s)
--- PASS: TestAccAwsWafv2RuleGroup_Disappears (190.58s)
--- PASS: TestAccAwsWafv2RuleGroup_Minimal (232.49s)
--- PASS: TestAccAwsWafv2RuleGroup_basic (243.10s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeCapacityForceNew (398.14s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeNameForceNew (403.31s)
--- PASS: TestAccAwsWafv2RuleGroup_ChangeMetricNameForceNew (403.53s)
--- PASS: TestAccAwsWafv2RuleGroup_updateRule (464.50s)
--- PASS: TestAccAwsWafv2RuleGroup_XssMatchStatement (480.30s)
--- PASS: TestAccAwsWafv2RuleGroup_SqliMatchStatement (483.74s)
--- PASS: TestAccAwsWafv2RuleGroup_GeoMatchStatement (486.50s)
--- PASS: TestAccAwsWafv2RuleGroup_SizeConstraintStatement (490.01s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement (490.34s)
--- PASS: TestAccAwsWafv2RuleGroup_Tags (510.00s)
--- PASS: TestAccAwsWafv2RuleGroup_RuleAction (551.82s)
--- PASS: TestAccAwsWafv2RuleGroup_LogicalRuleStatements (556.97s)
--- PASS: TestAccAwsWafv2RuleGroup_updateRuleProperties (570.41s)
--- PASS: TestAccAwsWafv2RuleGroup_ByteMatchStatement_FieldToMatch (690.37s)

@ghost ghost added size/L Managed by automation to categorize the size of a PR. and removed size/XL Managed by automation to categorize the size of a PR. labels Aug 13, 2020
@anGie44 anGie44 added this to the v3.2.0 milestone Aug 13, 2020
@anGie44 anGie44 merged commit 160ec74 into master Aug 13, 2020
@anGie44 anGie44 deleted the b-wafv2-rule-group-rule branch August 13, 2020 21:41
anGie44 added a commit that referenced this pull request Aug 13, 2020
@ghost
Copy link

ghost commented Aug 14, 2020

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template for triage. Thanks!

@ghost
Copy link

ghost commented Sep 13, 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 Sep 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/wafv2 Issues and PRs that pertain to the wafv2 service. size/L 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.

[WAFv2] resource/wafv2_rule_group: recreated on any changes to the rules
2 participants