hashicorp / terraform-cdk

Define infrastructure resources using programming constructs and provision them using HashiCorp Terraform
https://www.terraform.io/cdktf
Mozilla Public License 2.0
4.79k stars 441 forks source link

CDKTF: AWS WAFv2 rule statement changed to snake case, yet documentation remained in camel case #3637

Open tianweiliu opened 1 month ago

tianweiliu commented 1 month ago

Description

According to issue #3458, everything under statement block of aws_wafv2_rule_group or aws_wafv2_web_acl has been changed to snake case instead of camel case when using cdktf via typescript.

Although this changed was done on Jan 11, it was not reflected in any documentation. Even the newest version of the documentation still use camel case in both argument reference and examples. It seems to also breaks the hashtag based quick navigation within the page.

Argument Reference in current documentation (5.51.1):

The statement` block supports the following arguments:

andStatement - (Optional) Logical rule statement used to combine other rule statements with AND logic. See andStatement below for details. ...

Expected:

The statement block supports the following arguments:

and_statement - (Optional) Logical rule statement used to combine other rule statements with AND logic. See and_statement below for details.

Example in current documentation (5.51.1):

statement: {
  managedRuleGroupStatement: {
    name: "AWSManagedRulesCommonRuleSet",
    ruleActionOverride: [
      {
        actionToUse: {
          count: {},
        },
        name: "SizeRestrictions_QUERYSTRING",
      },
      {
        actionToUse: {
          count: {},
        },
        name: "NoUserAgent_HEADER",
      },
    ],
    scopeDownStatement: {
      geoMatchStatement: {
        countryCodes: ["US", "NL"],
      },
    },
    vendorName: "AWS",
  },
},

Expected:

statement: {
  managed_rule_group_statement: {
    name: "AWSManagedRulesCommonRuleSet",
    rule_action_override: [
      {
        action_to_use: {
          count: {},
        },
        name: "SizeRestrictions_QUERYSTRING",
      },
      {
        action_to_use: {
          count: {},
        },
        name: "NoUserAgent_HEADER",
      },
    ],
    scope_down_statement: {
      geo_match_statement: {
        country_codes: ["US", "NL"],
      },
    },
    vendor_name: "AWS",
  },
},

Links

Help Wanted

Community Note

sabinayakc commented 1 week ago

Yeah, figured out the hard way. It's a bit of a mess since one part of your code is camelCased and the other portion which are your statements are snake_cased. For now I am using the snake_cased, with the possibility that this will break in the future if anything changes.