diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eaf0357..0136a64 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -65,3 +65,4 @@ jobs: run: make -C $FOLDER lint - name: Tests run: make -C $FOLDER test + diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..51aff52 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,44 @@ +{ + "yaml.schemas": { + "file:///Users/sliedig/Library/Application%20Support/Code/User/globalStorage/amazonwebservices.aws-toolkit-vscode/sam.schema.json": [ + "resources/templates/lambda.yaml", + "resources/templates/sns.yaml", + "resources/templates/cognito-user-pool.yaml", + "example/template.yaml", + "examples/SimpleLambda/template.yaml", + "benchmark/template.yaml", + "blog/account-a-web-store/template.yaml", + "blog/account-c-invoice-processing/template.yaml", + "patterns/multi-bus-multi-account-pattern/blue-service-account/blue-service-app/template.yaml", + "patterns/multi-bus-multi-account-pattern/orange-service-account/orange-service-app/template.yaml", + "patterns/single-bus-multi-account-pattern/orange-service-account/orange-service-app/template.yaml", + "patterns/multi-bus-multi-account-pattern/purple-service-account/purple-service-app/template.yaml", + "patterns/single-bus-multi-account-pattern/purple-service-account/purple-service-app/template.yaml", + "patterns/single-bus-multi-account-pattern/blue-service-account/blue-service-app/template.yaml", + "src/backend/template.yaml", + "sam-app/template.yaml", + "sam-app-github/template.yaml", + "sam-pipelines-demo-rakuten/template.yaml", + "sam/app-control-concurrency-with-dynamodb/template.yaml", + "sam/app-decompose-for-parallelism/template.yaml", + "sam/app-s3-athena-dataprocessing/template.yaml", + "sam/app-order-management/template.yaml", + "backend/template.yaml", + "packaged.yaml", + "template.yaml", + "src/property-contract/template.yaml", + "src/unicorn-property/template.yaml", + "src/unicorn-properties-sam/unicorn-properties/template.yaml", + "src/unicorn-properties-sam/unicorn-contracts/template.yaml", + "src/unicorn-properties-sam/unicorn-properties-web/template.yaml" + ], + "file:/Users/sliedig/Library/Application Support/Code/User/globalStorage/amazonwebservices.aws-toolkit-vscode/sam.schema.json": [ + "example/template.yaml", + "benchmark/template.yaml", + "resources/templates/lambda.yaml", + "resources/templates/sns.yaml", + "resources/templates/cognito-user-pool.yaml" + ], + "https://www.artillery.io/schema.json": [] + } +} \ No newline at end of file diff --git a/cfn-lint-serverless/README.md b/cfn-lint-serverless/README.md index 63104fe..cab9fae 100644 --- a/cfn-lint-serverless/README.md +++ b/cfn-lint-serverless/README.md @@ -15,4 +15,4 @@ Usage ```bash cfn-lint template.yaml -a cfn_lint_serverless.rules -``` \ No newline at end of file +``` diff --git a/cfn-lint-serverless/cfn_lint_serverless/rules/lambda_.py b/cfn-lint-serverless/cfn_lint_serverless/rules/lambda_.py index bc1f64e..cbeb16c 100644 --- a/cfn-lint-serverless/cfn_lint_serverless/rules/lambda_.py +++ b/cfn-lint-serverless/cfn_lint_serverless/rules/lambda_.py @@ -21,7 +21,7 @@ class LambdaTracingRule(CloudFormationLintRule): source_url = "https://awslabs.github.io/serverless-rules/rules/lambda/tracing/" tags = ["lambda"] - _message = "Lambda function {} should have TracingConfig.Mode set to 'Active'." + _message = "Lambda function {} should have Tracing property set to 'Active'." def match(self, cfn): """ diff --git a/cfn-lint-serverless/cfn_lint_serverless/utils.py b/cfn-lint-serverless/cfn_lint_serverless/utils.py index 015eeb4..8e88ea7 100644 --- a/cfn-lint-serverless/cfn_lint_serverless/utils.py +++ b/cfn-lint-serverless/cfn_lint_serverless/utils.py @@ -18,14 +18,10 @@ class Value: def __new__(cls, value: Union[None, dict, str]) -> Union[None, TValue]: """ Create a new Value object - If the 'value' passed is None, this will return None instead of a class object """ - if value is None: - return None - - return super(Value, cls).__new__(cls) + return None if value is None else super(Value, cls).__new__(cls) def __init__(self, value: Union[dict, str]): """ @@ -44,7 +40,7 @@ def __init__(self, value: Union[dict, str]): # Not a dict - return an error here elif not isinstance(value, dict): - raise ValueError("'value' should be of type str or dict, got '%s'" % type(value)) + raise ValueError(f"'value' should be of type str or dict, got '{type(value)}'") # 'Ref' intrinsic function elif "Ref" in value: @@ -54,11 +50,11 @@ def __init__(self, value: Union[dict, str]): elif "Fn::GetAtt" in value: self.id, self.references = self._get_from_getatt(value["Fn::GetAtt"]) - # 'Fn::Join' intrisic function + # 'Fn::Join' intrinsic function elif "Fn::Join" in value: self.id, self.references = self._get_from_join(value["Fn::Join"]) - # 'Fn::Sub' intrisic function + # 'Fn::Sub' intrinsic function elif "Fn::Sub" in value: self.id, self.references = self._get_from_sub(value["Fn::Sub"]) @@ -100,27 +96,20 @@ def _get_from_sub(self, value: Union[str, list]) -> Tuple[str, List[str]]: Return the name and references from a 'Fn::Sub' intrinsic function """ - pattern = value - variables = {} - if isinstance(value, list): - pattern = value[0] - # Using Value() here to get nested references - variables = {k: Value(v) for k, v in value[1].items()} + pattern, variables = value[0], {k: Value(v) for k, v in value[1].items()} + else: + pattern, variables = value, {} references = [] for match in SUB_PATTERN.findall(pattern): if match in variables: - # Variable with reference(s) - if len(variables[match].references) > 0: + if variables[match].references: references.extend(variables[match].references) - # Hard-coded variable else: - # Replace with hard-coded value in value ID pattern = pattern.replace(f"${{{match}}}", variables[match].id) - # No matching variable else: references.append(match) - return (pattern, references) + return pattern, references diff --git a/cfn-lint-serverless/tests/test_templates.py b/cfn-lint-serverless/tests/test_templates.py index 49af26f..f844e0c 100644 --- a/cfn-lint-serverless/tests/test_templates.py +++ b/cfn-lint-serverless/tests/test_templates.py @@ -42,10 +42,10 @@ def test_rule_with_templates(rules): """ # Retrieve all serverless rule IDs - rule_ids = set([r.id for r in rules if r.id[1] == "S"]) + rule_ids = {r.id for r in rules if r.id[1] == "S"} # Retrieve all rule IDs for tests - test_rule_ids = set([t[1] for t in templates]) + test_rule_ids = {t[1] for t in templates} assert rule_ids == test_rule_ids @@ -70,7 +70,7 @@ def test_template(filename, rule, mode, rules): match_ids = [match.rule.id for match in matches] # No non-serverless errors - assert len([m for m in match_ids if m[1] != "S"]) == 0 + assert not [m for m in match_ids if m[1] != "S"] if mode == "fail": assert rule in match_ids diff --git a/docs/cfn-lint.md b/docs/cfn-lint.md index e500fa8..1f07fdf 100644 --- a/docs/cfn-lint.md +++ b/docs/cfn-lint.md @@ -41,7 +41,7 @@ If the template fulfills the requirements for all rules, `cfn-lint` will return ES4000 EventBridge rule ConsumerFunctionTrigger should have a DeadLetterConfig.Arn property for all its Targets. template.yaml:5:1 - WS1000 Lambda function ConsumerFunction should have TracingConfig.Mode set to 'Active'. + WS1000 Lambda function ConsumerFunction should have Tracing property set to 'Active'. template.yaml:7:3 WS1004 Lambda function ConsumerFunction does not have a corresponding log group with a Retention property diff --git a/examples/cdk/README.md b/examples/cdk/README.md index 90f2eab..d34b4e8 100644 --- a/examples/cdk/README.md +++ b/examples/cdk/README.md @@ -2,7 +2,7 @@ CDK Example =========== -xample on how to use cfn-lint-serverless with [AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/home.html). +Example on how to use cfn-lint-serverless with [AWS CDK](https://docs.aws.amazon.com/cdk/latest/guide/home.html). Usage ----- diff --git a/examples/cdk/setup.py b/examples/cdk/setup.py index 1b29d11..83cead2 100644 --- a/examples/cdk/setup.py +++ b/examples/cdk/setup.py @@ -19,10 +19,10 @@ packages=setuptools.find_packages(where="cdk"), install_requires=[ - "aws-cdk.core==1.106.1", + "aws-cdk.core==1.204.0", ], - python_requires=">=3.6", + python_requires=">=3.8", classifiers=[ "Development Status :: 4 - Beta", @@ -31,9 +31,10 @@ "Programming Language :: JavaScript", "Programming Language :: Python :: 3 :: Only", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Code Generators", "Topic :: Utilities", diff --git a/tflint-ruleset-aws-serverless/go.mod b/tflint-ruleset-aws-serverless/go.mod index 66a063e..4709690 100644 --- a/tflint-ruleset-aws-serverless/go.mod +++ b/tflint-ruleset-aws-serverless/go.mod @@ -1,8 +1,37 @@ module github.com/awslabs/serverless-rules/tflint-ruleset-aws-serverless -go 1.15 +go 1.23 require ( - github.com/hashicorp/hcl/v2 v2.12.0 - github.com/terraform-linters/tflint-plugin-sdk v0.9.1 + github.com/hashicorp/hcl/v2 v2.23.0 + github.com/terraform-linters/tflint-plugin-sdk v0.21.0 +) + +require ( + github.com/agext/levenshtein v1.2.1 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/fatih/color v1.13.0 // indirect + github.com/golang/protobuf v1.5.4 // indirect + github.com/google/go-cmp v0.6.0 // indirect + github.com/hashicorp/go-hclog v1.6.3 // indirect + github.com/hashicorp/go-plugin v1.6.1 // indirect + github.com/hashicorp/go-version v1.7.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect + github.com/mattn/go-colorable v0.1.12 // indirect + github.com/mattn/go-isatty v0.0.14 // indirect + github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 // indirect + github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect + github.com/oklog/run v1.0.0 // indirect + github.com/vmihailenco/msgpack/v5 v5.3.5 // indirect + github.com/vmihailenco/tagparser/v2 v2.0.0 // indirect + github.com/zclconf/go-cty v1.15.0 // indirect + golang.org/x/mod v0.19.0 // indirect + golang.org/x/net v0.27.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/text v0.16.0 // indirect + golang.org/x/tools v0.23.0 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 // indirect + google.golang.org/grpc v1.65.0 // indirect + google.golang.org/protobuf v1.34.2 // indirect ) diff --git a/tflint-ruleset-aws-serverless/go.sum b/tflint-ruleset-aws-serverless/go.sum index 941f190..6ad270d 100644 --- a/tflint-ruleset-aws-serverless/go.sum +++ b/tflint-ruleset-aws-serverless/go.sum @@ -1,67 +1,38 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= -github.com/apparentlymart/go-dump v0.0.0-20180507223929-23540a00eaa3/go.mod h1:oL81AME2rN47vu18xqj1S1jPIPuN7afo62yKTNn3XMM= -github.com/apparentlymart/go-textseg v1.0.0 h1:rRmlIsPEEhUTIKQb7T++Nz/A5Q6C9IuX2wFoYVvnCs0= -github.com/apparentlymart/go-textseg v1.0.0/go.mod h1:z96Txxhf3xSFMPmb5X/1W05FF/Nj9VFpLOpjS5yuumk= -github.com/apparentlymart/go-textseg/v13 v13.0.0 h1:Y+KvPE1NYz0xl601PVImeQfFyEy6iT90AvPUL1NNfNw= -github.com/apparentlymart/go-textseg/v13 v13.0.0/go.mod h1:ZK2fH7c4NqDTLtiYLvIkEghdlcqw7yxLeM89kiTRPUo= -github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= -github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= -github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys= -github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= -github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= -github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b h1:VKtxabqXZkF25pY9ekfRL6a582T4P37/31XEstQ5p58= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.1.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= -github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= -github.com/google/go-cmp v0.5.6 h1:BKbKCqvP6I+rmFHt06ZmyQtvB8xAkWdhFyr0ZUNZcxQ= -github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= -github.com/hashicorp/go-hclog v0.14.1/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs= -github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ= -github.com/hashicorp/go-plugin v1.4.2 h1:yFvG3ufXXpqiMiZx9HLcaK3XbIqQ1WJFR/F1a2CuVw0= -github.com/hashicorp/go-plugin v1.4.2/go.mod h1:5fGEH17QVwTTcR0zV7yhDPLLmFX9YSZ38b18Udy6vYQ= -github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/go-version v1.3.0 h1:McDWVJIU/y+u1BRV06dPaLfLCaT7fUTJLp5r04x7iNw= -github.com/hashicorp/go-version v1.3.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/hcl/v2 v2.10.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= -github.com/hashicorp/hcl/v2 v2.12.0 h1:PsYxySWpMD4KPaoJLnsHwtK5Qptvj/4Q6s0t4sUxZf4= -github.com/hashicorp/hcl/v2 v2.12.0/go.mod h1:FwWsfWEjyV/CMj8s/gqAuiviY72rJ1/oayI9WftqcKg= -github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734 h1:HKLsbzeOsfXmKNpr3GiT18XAblV0BjCbzL8KQAMZGa0= -github.com/hashicorp/terraform-svchost v0.0.0-20200729002733-f050f53b9734/go.mod h1:kNDNcF7sN4DocDLBkQYz73HGKwN1ANB1blq4lIYLYvg= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb h1:b5rjCoWHc7eqmAS4/qyk21ZsHyb6Mxv/jykxvNTkU4M= -github.com/hashicorp/yamux v0.0.0-20180604194846-3520598351bb/go.mod h1:+NfK9FKeTrX5uv1uIXGdwYDTeHna2qgaIlx54MXqjAM= -github.com/jhump/protoreflect v1.6.0 h1:h5jfMVslIg6l29nsMs0D8Wj17RDVdNYti0vDN/PZZoE= -github.com/jhump/protoreflect v1.6.0/go.mod h1:eaTn3RZAmMBcV0fifFvlm6VHNz3wSkYyXYWUh7ymB74= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= -github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348 h1:MtvEpTB6LX3vkb4ax0b5D2DHbNAUsen0Gx5wZoq3lV4= -github.com/kylelemons/godebug v0.0.0-20170820004349-d65d576e9348/go.mod h1:B69LEHPfb2qLo0BaaOLcbitczOKLWTsrBG9LczfCD4k= -github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA= -github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.10 h1:qxFzApOv4WsAL965uUPIsXzAKCZxN2p9UqdhFS4ZW10= -github.com/mattn/go-isatty v0.0.10/go.mod h1:qgIWMr58cqv1PHHyhnkY9lrL7etaEgOFcMEpPG5Rm84= +github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= +github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= +github.com/go-test/deep v1.1.1 h1:0r/53hagsehfO4bzD2Pgr/+RgHqhmf+k1Bpse2cTu1U= +github.com/go-test/deep v1.1.1/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-plugin v1.6.1 h1:P7MR2UP6gNKGPp+y7EZw2kOiq4IR9WiqLvp0XOsVdwI= +github.com/hashicorp/go-plugin v1.6.1/go.mod h1:XPHFku2tFo3o3QKFgSYo+cghcUhw1NA1hZyMK0PWAw0= +github.com/hashicorp/go-version v1.7.0 h1:5tqGy27NaOTB8yJKUZELlFAS/LTKJkrmONwQKeRZfjY= +github.com/hashicorp/go-version v1.7.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hcl/v2 v2.23.0 h1:Fphj1/gCylPxHutVSEOf2fBOh1VE4AuLV7+kbJf3qos= +github.com/hashicorp/hcl/v2 v2.23.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= +github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77 h1:7GoSOOW2jpsfkntVKaS2rAr1TJqfcxotyaUcuxoZSzg= github.com/mitchellh/go-testing-interface v0.0.0-20171004221916-a61a99592b77/go.mod h1:kRemZodwjscx+RGhAo8eIhFbs2+BFgRtFPeD/KE+zxI= github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 h1:DpOJ2HYzCv8LZP15IdmG+YdwD2luVPHITV96TkirNBM= @@ -70,84 +41,44 @@ github.com/oklog/run v1.0.0 h1:Ru7dDtJNOyC66gQ5dQmaCa0qIsAUFY3sFpK1Xk8igrw= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/spf13/pflag v1.0.2/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= -github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/terraform-linters/tflint-plugin-sdk v0.9.1 h1:Q7+QmvkxrINjsxQ9iOR9GDIppS7kT2hXQBHNaZ+01ug= -github.com/terraform-linters/tflint-plugin-sdk v0.9.1/go.mod h1:2pu+KHPrxfV/Y0inO9c5w4ptL6dNIHu8Em7ZxXBNP4E= -github.com/vmihailenco/msgpack v3.3.3+incompatible h1:wapg9xDUZDzGCNFlwc5SqI1rvcciqcxEHac4CYj89xI= -github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk= -github.com/vmihailenco/msgpack/v4 v4.3.12 h1:07s4sz9IReOgdikxLTKNbBdqDMLsjPKXwvCazn8G65U= -github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4= -github.com/vmihailenco/tagparser v0.1.1 h1:quXMXlA39OCbd2wAdTsGDlK9RkOk6Wuw+x37wVyIuWY= -github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI= -github.com/zclconf/go-cty v1.1.0/go.mod h1:xnAOWiHeOqg2nWS62VtQ7pbOu17FtxJNW8RLEih+O3s= -github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= -github.com/zclconf/go-cty v1.8.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty v1.9.0 h1:IgJxw5b4LPXCPeqFjjhLaNEA8NKXMyaEUdAd399acts= -github.com/zclconf/go-cty v1.9.0/go.mod h1:vVKLxnk3puL4qRAv72AO+W99LUD4da90g3uUAzyuvAk= -github.com/zclconf/go-cty-debug v0.0.0-20191215020915-b22d67c1ba0b/go.mod h1:ZRKQfBXbGkpdV6QMzT3rU1kSTAnfu1dO8dPKjYprgj8= -golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20191009170851-d66e71096ffb/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a h1:GuSPYbZzB5/dcLNCwLQLsg3obCJtX9IJhpXkvY7kzk0= -golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191008105621-543471e840be h1:QAcqgptGM8IQBC9K/RC4o+O9YmqEm0diQn9QmZw/0mU= -golang.org/x/sys v0.0.0-20191008105621-543471e840be/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= -google.golang.org/appengine v1.6.5 h1:tycE03LOZYQNhDpS27tcQdAzLCVMaj7QT2SXxebnpCM= -google.golang.org/appengine v1.6.5/go.mod h1:8WjMMxjGQR8xUklV/ARdw2HLXBOI7O7uCIDZVag1xfc= -google.golang.org/genproto v0.0.0-20170818010345-ee236bd376b0/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 h1:gSJIx1SDwno+2ElGhA4+qG2zF97qiUzTM+rQ0klBOcE= -google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= -google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= -google.golang.org/grpc v1.27.1 h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk= -google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2 h1:4jaiDzPyXQvSd7D0EjG45355tLlV3VOECpq10pLC+8s= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= +github.com/terraform-linters/tflint-plugin-sdk v0.21.0 h1:RoorxuuWh1RuL09PWAmaCKw/hmb9QP5dukGXZiB0fs8= +github.com/terraform-linters/tflint-plugin-sdk v0.21.0/go.mod h1:f7ruoYh44RQvnZRxpWhn8JFkpEVlQFT8wC9MhIF0Rp4= +github.com/vmihailenco/msgpack/v5 v5.3.5 h1:5gO0H1iULLWGhs2H5tbAHIZTV8/cYafcFOr9znI5mJU= +github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= +github.com/zclconf/go-cty v1.15.0 h1:tTCRWxsexYUmtt/wVxgDClUe+uQusuI443uL6e+5sXQ= +github.com/zclconf/go-cty v1.15.0/go.mod h1:VvMs5i0vgZdhYawQNq5kePSpLAoz8u1xvZgrPIxfnZE= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940 h1:4r45xpDWB6ZMSMNJFMOjqrGHynW3DIBuR2H9j0ug+Mo= +github.com/zclconf/go-cty-debug v0.0.0-20240509010212-0d6042c53940/go.mod h1:CmBdvvj3nqzfzJ6nTCIwDTPZ56aVGvDrmztiO5g3qrM= +golang.org/x/mod v0.19.0 h1:fEdghXQSo20giMthA7cd28ZC+jts4amQ3YMXiP5oMQ8= +golang.org/x/mod v0.19.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/tools v0.23.0 h1:SGsXPZ+2l4JsgaCKkx+FQ9YZ5XEtA1GZYuoDjenLjvg= +golang.org/x/tools v0.23.0/go.mod h1:pnu6ufv6vQkll6szChhK3C3L/ruaIv5eBeztNG8wtsI= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157 h1:Zy9XzmMEflZ/MAaA7vNcoebnRAld7FsPW1EeBB7V0m8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240528184218-531527333157/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/grpc v1.65.0 h1:bs/cUb4lp1G5iImFFd3u5ixQzweKizoZJAwBNLR42lc= +google.golang.org/grpc v1.65.0/go.mod h1:WgYC2ypjlB0EiQi6wdKixMqukr6lBc0Vo+oOgjrM5ZQ= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tflint-ruleset-aws-serverless/main.go b/tflint-ruleset-aws-serverless/main.go index 2209904..996e185 100644 --- a/tflint-ruleset-aws-serverless/main.go +++ b/tflint-ruleset-aws-serverless/main.go @@ -10,7 +10,7 @@ func main() { plugin.Serve(&plugin.ServeOpts{ RuleSet: &tflint.BuiltinRuleSet{ Name: "aws-serverless", - Version: "0.3.2", + Version: "0.3.3", Rules: rules.Rules, }, }) diff --git a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_method_settings_throttling.go b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_method_settings_throttling.go index e7dc8ea..36f4c8b 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_method_settings_throttling.go +++ b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_method_settings_throttling.go @@ -1,8 +1,10 @@ package rules import ( - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "fmt" + "github.com/hashicorp/hcl/v2" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -24,7 +26,7 @@ func (r *AwsAPIGatewayMethodSettingsThrottlingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsAPIGatewayMethodSettingsThrottlingRule) Severity() string { +func (r *AwsAPIGatewayMethodSettingsThrottlingRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_logging.go b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_logging.go index e783c70..181f487 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_logging.go +++ b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_logging.go @@ -2,9 +2,9 @@ package rules import ( "fmt" - - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/hashicorp/hcl/v2" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -33,7 +33,7 @@ func (r *AwsAPIGatewayStageLoggingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsAPIGatewayStageLoggingRule) Severity() string { +func (r *AwsAPIGatewayStageLoggingRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_structured_logging.go b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_structured_logging.go index 19a5ce3..be6d42f 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_structured_logging.go +++ b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_structured_logging.go @@ -36,7 +36,7 @@ func (r *AwsApigatewayStageStructuredLoggingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsApigatewayStageStructuredLoggingRule) Severity() string { +func (r *AwsApigatewayStageStructuredLoggingRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_tracing.go b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_tracing.go index cf9ef53..d349d6e 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_tracing.go +++ b/tflint-ruleset-aws-serverless/rules/aws_api_gateway_stage_tracing.go @@ -2,9 +2,9 @@ package rules import ( "fmt" - - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/hashicorp/hcl/v2" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -33,7 +33,7 @@ func (r *AwsAPIGatewayStageTracingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsAPIGatewayStageTracingRule) Severity() string { +func (r *AwsAPIGatewayStageTracingRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_logging.go b/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_logging.go index 2c89b0e..e6957ec 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_logging.go +++ b/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_logging.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -33,7 +34,7 @@ func (r *AwsAPIGatewayStageV2LoggingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsAPIGatewayStageV2LoggingRule) Severity() string { +func (r *AwsAPIGatewayStageV2LoggingRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_structured_logging.go b/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_structured_logging.go index da5be92..470763a 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_structured_logging.go +++ b/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_structured_logging.go @@ -36,7 +36,7 @@ func (r *AwsApigatewayV2StageStructuredLoggingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsApigatewayV2StageStructuredLoggingRule) Severity() string { +func (r *AwsApigatewayV2StageStructuredLoggingRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_throttling.go b/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_throttling.go index 13b7563..7fe4460 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_throttling.go +++ b/tflint-ruleset-aws-serverless/rules/aws_apigatewayv2_stage_throttling.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -37,7 +38,7 @@ func (r *AwsApigatewayV2StageThrottlingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsApigatewayV2StageThrottlingRule) Severity() string { +func (r *AwsApigatewayV2StageThrottlingRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_appsync_graphql_api_tracing.go b/tflint-ruleset-aws-serverless/rules/aws_appsync_graphql_api_tracing.go index ed17d97..622d684 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_appsync_graphql_api_tracing.go +++ b/tflint-ruleset-aws-serverless/rules/aws_appsync_graphql_api_tracing.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -31,7 +32,7 @@ func (r *AwsAppsyncGraphqlAPITracingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsAppsyncGraphqlAPITracingRule) Severity() string { +func (r *AwsAppsyncGraphqlAPITracingRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_event_target_no_dlq.go b/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_event_target_no_dlq.go index 7e2ca57..62c0630 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_event_target_no_dlq.go +++ b/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_event_target_no_dlq.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -35,7 +36,7 @@ func (r *AwsCloudwatchEventTargetNoDlqRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsCloudwatchEventTargetNoDlqRule) Severity() string { +func (r *AwsCloudwatchEventTargetNoDlqRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_log_group_lambda_retention.go b/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_log_group_lambda_retention.go index 263f45d..300a423 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_log_group_lambda_retention.go +++ b/tflint-ruleset-aws-serverless/rules/aws_cloudwatch_log_group_lambda_retention.go @@ -2,18 +2,19 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" "regexp" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) type awsLambdaLogGroup struct { - functionName string - resourceName string - found bool - resourceRange hcl.Range + functionName string + resourceName string + found bool + //resourceRange tflint.AttributeRange } // AwsCloudwatchLogGroupLambdaRetention checks if Lambda functions have a corresponding log group with retention configured @@ -47,7 +48,7 @@ func (r *AwsCloudwatchLogGroupLambdaRetentionRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsCloudwatchLogGroupLambdaRetentionRule) Severity() string { +func (r *AwsCloudwatchLogGroupLambdaRetentionRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_iam_role_lambda_no_star.go b/tflint-ruleset-aws-serverless/rules/aws_iam_role_lambda_no_star.go index 1776bf6..b7f45cd 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_iam_role_lambda_no_star.go +++ b/tflint-ruleset-aws-serverless/rules/aws_iam_role_lambda_no_star.go @@ -3,11 +3,12 @@ package rules import ( "encoding/json" "fmt" + "github.com/hashicorp/hcl/v2" "reflect" "strings" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -57,7 +58,7 @@ func (r *AwsIamRoleLambdaNoStarRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsIamRoleLambdaNoStarRule) Severity() string { +func (r *AwsIamRoleLambdaNoStarRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_lambda_event_invoke_config_async_on_failure.go b/tflint-ruleset-aws-serverless/rules/aws_lambda_event_invoke_config_async_on_failure.go index 8c7c10b..05d16d6 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_lambda_event_invoke_config_async_on_failure.go +++ b/tflint-ruleset-aws-serverless/rules/aws_lambda_event_invoke_config_async_on_failure.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -61,9 +62,8 @@ func (r *AwsLambdaEventInvokeConfigAsyncOnFailureRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsLambdaEventInvokeConfigAsyncOnFailureRule) Severity() string { - // TODO: Determine the rule's severiry - return tflint.ERROR +func (r *AwsLambdaEventInvokeConfigAsyncOnFailureRule) Severity() tflint.Severity { + return tflint.ERROR // TODO: Determine the rule's severity } // Link returns the rule reference link diff --git a/tflint-ruleset-aws-serverless/rules/aws_lambda_event_source_mapping_failure_destination.go b/tflint-ruleset-aws-serverless/rules/aws_lambda_event_source_mapping_failure_destination.go index d887b72..dd55a5d 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_lambda_event_source_mapping_failure_destination.go +++ b/tflint-ruleset-aws-serverless/rules/aws_lambda_event_source_mapping_failure_destination.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -39,9 +40,8 @@ func (r *AwsLambdaEventSourceMappingFailureDestinationRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsLambdaEventSourceMappingFailureDestinationRule) Severity() string { - // TODO: Determine the rule's severiry - return tflint.ERROR +func (r *AwsLambdaEventSourceMappingFailureDestinationRule) Severity() tflint.Severity { + return tflint.ERROR // TODO: Determine the rule's severity } // Link returns the rule reference link diff --git a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_memory.go b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_memory.go index b08ae99..8101bc4 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_memory.go +++ b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_memory.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -33,7 +34,7 @@ func (r *AwsLambdaFunctionDefaultMemoryRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsLambdaFunctionDefaultMemoryRule) Severity() string { +func (r *AwsLambdaFunctionDefaultMemoryRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_timeout.go b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_timeout.go index 6c3d3cd..a2c7a11 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_timeout.go +++ b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_default_timeout.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -33,7 +34,7 @@ func (r *AwsLambdaFunctionDefaultTimeoutRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsLambdaFunctionDefaultTimeoutRule) Severity() string { +func (r *AwsLambdaFunctionDefaultTimeoutRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_eol_runtime.go b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_eol_runtime.go index 2b37bc3..cf91620 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_eol_runtime.go +++ b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_eol_runtime.go @@ -2,8 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -48,7 +50,7 @@ func (r *AwsLambdaFunctionEolRuntimeRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsLambdaFunctionEolRuntimeRule) Severity() string { +func (r *AwsLambdaFunctionEolRuntimeRule) Severity() tflint.Severity { return tflint.ERROR } diff --git a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_tracing.go b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_tracing.go index ddb9c59..a44fe97 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_lambda_function_tracing.go +++ b/tflint-ruleset-aws-serverless/rules/aws_lambda_function_tracing.go @@ -2,9 +2,10 @@ package rules import ( "fmt" - "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -35,7 +36,7 @@ func (r *AwsLambdaFunctionTracingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsLambdaFunctionTracingRule) Severity() string { +func (r *AwsLambdaFunctionTracingRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_lambda_permission_multiple_principals.go b/tflint-ruleset-aws-serverless/rules/aws_lambda_permission_multiple_principals.go index f19b797..2e23328 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_lambda_permission_multiple_principals.go +++ b/tflint-ruleset-aws-serverless/rules/aws_lambda_permission_multiple_principals.go @@ -2,9 +2,10 @@ package rules import ( "fmt" + "github.com/hashicorp/hcl/v2" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -35,7 +36,7 @@ func (r *AwsLambdaPermissionMultiplePrincipalsRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsLambdaPermissionMultiplePrincipalsRule) Severity() string { +func (r *AwsLambdaPermissionMultiplePrincipalsRule) Severity() tflint.Severity { return tflint.WARNING } diff --git a/tflint-ruleset-aws-serverless/rules/aws_sfn_state_machine_tracing.go b/tflint-ruleset-aws-serverless/rules/aws_sfn_state_machine_tracing.go index bf18a01..bc8760c 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_sfn_state_machine_tracing.go +++ b/tflint-ruleset-aws-serverless/rules/aws_sfn_state_machine_tracing.go @@ -3,8 +3,7 @@ package rules import ( "fmt" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -13,6 +12,7 @@ type AwsSfnStateMachineTracingRule struct { resourceType string blockName string attributeName string + tflint.DefaultRule } // NewAwsSfnStateMachineTracingRule returns new rule with default attributes @@ -35,7 +35,7 @@ func (r *AwsSfnStateMachineTracingRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsSfnStateMachineTracingRule) Severity() string { +func (r *AwsSfnStateMachineTracingRule) Severity() tflint.Severity { return tflint.WARNING } @@ -47,68 +47,57 @@ func (r *AwsSfnStateMachineTracingRule) Link() string { // TODO: Write the details of the inspection // Check checks if tracing is enabled for Step functions func (r *AwsSfnStateMachineTracingRule) Check(runner tflint.Runner) error { - return runner.WalkResources(r.resourceType, func(resource *configs.Resource) error { - // Block - - body, _, diags := resource.Config.PartialContent(&hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: r.blockName, + resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ + Blocks: []hclext.BlockSchema{ + { + Type: r.blockName, + Body: &hclext.BodySchema{ + Attributes: []hclext.AttributeSchema{ + {Name: r.attributeName}, + }, }, }, - }) - - if diags.HasErrors() { - return diags - } + }, + }, nil) + if err != nil { + return err + } - blocks := body.Blocks.OfType(r.blockName) - if len(blocks) != 1 { + for _, resource := range resources.Blocks { + blocks := resource.Body.Blocks + if len(blocks) == 0 { runner.EmitIssue( r, fmt.Sprintf("\"%s\" is not present.", r.blockName), - body.MissingItemRange, + resource.DefRange, ) - - return nil + continue } - // Attribute - body, _, diags = blocks[0].Body.PartialContent(&hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: r.attributeName, - }, - }, - }) - - if diags.HasErrors() { - return diags - } + for _, block := range blocks { + var attrValue string + attr, exists := block.Body.Attributes[r.attributeName] + if !exists { + runner.EmitIssue( + r, + fmt.Sprintf("\"%s\" is not present.", r.attributeName), + block.DefRange, + ) + continue + } - var attrValue string - attribute, ok := body.Attributes[r.attributeName] - if !ok { - runner.EmitIssue( - r, - fmt.Sprintf("\"%s\" is not present.", r.attributeName), - body.MissingItemRange, - ) - } else { - err := runner.EvaluateExpr(attribute.Expr, &attrValue, nil) - if err != nil { + if err := runner.EvaluateExpr(attr.Expr, &attrValue, nil); err != nil { return err } if attrValue != "true" { - runner.EmitIssueOnExpr( + runner.EmitIssue( r, fmt.Sprintf("\"%s\" should be set to true.", r.attributeName), - attribute.Expr, + attr.Expr.Range(), ) } } - - return nil - }) + } + return nil } diff --git a/tflint-ruleset-aws-serverless/rules/aws_sns_topic_subscription_redrive_policy.go b/tflint-ruleset-aws-serverless/rules/aws_sns_topic_subscription_redrive_policy.go index 8c6e219..3aaaa52 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_sns_topic_subscription_redrive_policy.go +++ b/tflint-ruleset-aws-serverless/rules/aws_sns_topic_subscription_redrive_policy.go @@ -3,22 +3,20 @@ package rules import ( "fmt" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) -// TODO: Write the rule's description here -// AwsSnsTopicSubscriptionRedrivePolicy checks that an SNS subscription has a redrive policy configured +// AwsSnsTopicSubscriptionRedrivePolicyRule checks that an SNS subscription has a redrive policy configured type AwsSnsTopicSubscriptionRedrivePolicyRule struct { resourceType string attributeName string + tflint.DefaultRule } // NewAwsSnsTopicSubscriptionRedrivePolicyRule returns new rule with default attributes func NewAwsSnsTopicSubscriptionRedrivePolicyRule() *AwsSnsTopicSubscriptionRedrivePolicyRule { return &AwsSnsTopicSubscriptionRedrivePolicyRule{ - // TODO: Write resource type and attribute name here resourceType: "aws_sns_topic_subscription", attributeName: "redrive_policy", } @@ -35,7 +33,7 @@ func (r *AwsSnsTopicSubscriptionRedrivePolicyRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsSnsTopicSubscriptionRedrivePolicyRule) Severity() string { +func (r *AwsSnsTopicSubscriptionRedrivePolicyRule) Severity() tflint.Severity { return tflint.ERROR } @@ -46,35 +44,30 @@ func (r *AwsSnsTopicSubscriptionRedrivePolicyRule) Link() string { // Check checks that an SNS subscription has a redrive policy configured func (r *AwsSnsTopicSubscriptionRedrivePolicyRule) Check(runner tflint.Runner) error { - return runner.WalkResources(r.resourceType, func(resource *configs.Resource) error { - // Attribute - body, _, diags := resource.Config.PartialContent(&hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: r.attributeName, - }, - }, - }) - - if diags.HasErrors() { - return diags - } + resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ + Attributes: []hclext.AttributeSchema{ + {Name: r.attributeName}, + }, + }, nil) + if err != nil { + return err + } - var attrValue string - attribute, ok := body.Attributes[r.attributeName] - if !ok { + for _, resource := range resources.Blocks { + attr, exists := resource.Body.Attributes[r.attributeName] + if !exists { runner.EmitIssue( r, fmt.Sprintf("\"%s\" is not present.", r.attributeName), - body.MissingItemRange, + resource.DefRange, ) - } else { - err := runner.EvaluateExpr(attribute.Expr, &attrValue, nil) - if err != nil { - return err - } + continue } - return nil - }) + var attrValue string + if err := runner.EvaluateExpr(attr.Expr, &attrValue, nil); err != nil { + return err + } + } + return nil } diff --git a/tflint-ruleset-aws-serverless/rules/aws_sqs_queue_redrive_policy.go b/tflint-ruleset-aws-serverless/rules/aws_sqs_queue_redrive_policy.go index 4f55d6a..ad3af41 100644 --- a/tflint-ruleset-aws-serverless/rules/aws_sqs_queue_redrive_policy.go +++ b/tflint-ruleset-aws-serverless/rules/aws_sqs_queue_redrive_policy.go @@ -3,15 +3,16 @@ package rules import ( "fmt" - hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/hclext" + "github.com/terraform-linters/tflint-plugin-sdk/logger" "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) -// AwsSqsQueueRedrivePolicy checks if an SQS Queue has a redrive policy configured +// AwsSqsQueueRedrivePolicyRule checks if an SQS Queue has a redrive policy configured type AwsSqsQueueRedrivePolicyRule struct { resourceType string attributeName string + tflint.DefaultRule } // NewAwsSqsQueueRedrivePolicyRule returns new rule with default attributes @@ -33,7 +34,7 @@ func (r *AwsSqsQueueRedrivePolicyRule) Enabled() bool { } // Severity returns the rule severity -func (r *AwsSqsQueueRedrivePolicyRule) Severity() string { +func (r *AwsSqsQueueRedrivePolicyRule) Severity() tflint.Severity { return tflint.ERROR } @@ -44,35 +45,67 @@ func (r *AwsSqsQueueRedrivePolicyRule) Link() string { // Check checks if an SQS Queue has a redrive policy configured func (r *AwsSqsQueueRedrivePolicyRule) Check(runner tflint.Runner) error { - return runner.WalkResources(r.resourceType, func(resource *configs.Resource) error { - // Attribute - body, _, diags := resource.Config.PartialContent(&hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: r.attributeName, - }, - }, - }) + resources, err := runner.GetResourceContent(r.resourceType, &hclext.BodySchema{ + Attributes: []hclext.AttributeSchema{ + {Name: r.attributeName}, + }, + }, nil) + if err != nil { + return fmt.Errorf("error getting resource content: %w", err) + } - if diags.HasErrors() { - return diags - } + logger.Debug(fmt.Sprintf("Found %d aws_sqs_queue resources", len(resources.Blocks))) + for _, resource := range resources.Blocks { var attrValue string - attribute, ok := body.Attributes[r.attributeName] - if !ok { + attr, exists := resource.Body.Attributes[r.attributeName] + if !exists { runner.EmitIssue( r, fmt.Sprintf("\"%s\" is not present.", r.attributeName), - body.MissingItemRange, + resource.DefRange, // resource.DefRange is the range of the resource block in the HCL file ) } else { - err := runner.EvaluateExpr(attribute.Expr, &attrValue, nil) + err := runner.EvaluateExpr(attr.Expr, &attrValue, nil) // TODO: need to fix this implementation if err != nil { return err } - } - return nil - }) + } + } + return nil } + +//func (r *AwsSqsQueueRedrivePolicyRule) Check(runner tflint.Runner) error { +// return runner.WalkResources(r.resourceType, func(resource *configs.Resource) error { +// // Attribute +// body, _, diags := resource.Config.PartialContent(&hcl.BodySchema{ +// Attributes: []hcl.AttributeSchema{ +// { +// Name: r.attributeName, +// }, +// }, +// }) +// +// if diags.HasErrors() { +// return diags +// } +// +// var attrValue string +// attribute, ok := body.Attributes[r.attributeName] +// if !ok { +// runner.EmitIssue( +// r, +// fmt.Sprintf("\"%s\" is not present.", r.attributeName), +// body.MissingItemRange, +// ) +// } else { +// err := runner.EvaluateExpr(attribute.Expr, &attrValue, nil) +// if err != nil { +// return err +// } +// } +// +// return nil +// }) +//} diff --git a/tflint-ruleset-aws-serverless/scratch_file.tf b/tflint-ruleset-aws-serverless/scratch_file.tf new file mode 100644 index 0000000..3fe4c35 --- /dev/null +++ b/tflint-ruleset-aws-serverless/scratch_file.tf @@ -0,0 +1,25 @@ +provider "aws" { + region = "us-west-2" +} + +resource "aws_sqs_queue" "test_queue" { + name = "test-queue" + + # Intentionally omitting redrive_policy to test the rule + visibility_timeout_seconds = 30 + message_retention_seconds = 345600 # 4 days +} + +# Example with redrive_policy (for testing both cases) +resource "aws_sqs_queue" "dlq" { + name = "test-dlq" +} + +resource "aws_sqs_queue" "queue_with_dlq" { + name = "test-queue-with-dlq" + + redrive_policy = jsonencode({ + deadLetterTargetArn = aws_sqs_queue.dlq.arn + maxReceiveCount = 4 + }) +} diff --git a/tflint-ruleset-aws-serverless/templates/rule.go.tmpl b/tflint-ruleset-aws-serverless/templates/rule.go.tmpl index ce5a36e..324b5dd 100644 --- a/tflint-ruleset-aws-serverless/templates/rule.go.tmpl +++ b/tflint-ruleset-aws-serverless/templates/rule.go.tmpl @@ -2,7 +2,7 @@ package rules import ( hcl "github.com/hashicorp/hcl/v2" - "github.com/terraform-linters/tflint-plugin-sdk/terraform/configs" + "github.com/terraform-linters/tflint-plugin-sdk/tflint" ) @@ -36,9 +36,8 @@ func (r *{{ .Env.RULE_NAME_CC }}Rule) Enabled() bool { } // Severity returns the rule severity -func (r *{{ .Env.RULE_NAME_CC }}Rule) Severity() string { - // TODO: Determine the rule's severiry - return tflint.ERROR +func (r *{{ .Env.RULE_NAME_CC }}Rule) tflint.Severity { + return tflint.ERROR } // Link returns the rule reference link