Skip to content

Commit 56a023e

Browse files
committed
Merge remote-tracking branch 'origin/master' into kayma/secgrp-ingress-egress
2 parents 3384269 + 50701f0 commit 56a023e

31 files changed

+519
-358
lines changed

.github/workflows/maintenance.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
- uses: actions/setup-go@v5
1414
with:
1515
go-version-file: 'go.mod'
16-
- run: |
17-
go get github.com/aws/aws-sdk-go
18-
go mod tidy
16+
- uses: hashicorp/setup-terraform@v3
17+
- name: go generate ./...
18+
run: |
1919
cd tools/provider-schema
2020
terraform init -upgrade
2121
terraform providers schema -json > schema.json

CHANGELOG.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,28 @@
1+
## 0.37.0 (2024-12-31)
2+
3+
### Breaking Changes
4+
5+
- [#789](https://github.com/terraform-linters/tflint-ruleset-aws/pull/789) [#798](https://github.com/terraform-linters/tflint-ruleset-aws/pull/798): Update AWS provider/module and generated content
6+
- Removed the following rules
7+
- `aws_service_discovery_http_namespace_invalid_name`
8+
- `aws_service_discovery_private_dns_namespace_invalid_name`
9+
- `aws_service_discovery_public_dns_namespace_invalid_name`
10+
11+
### Enhancements
12+
13+
- [#787](https://github.com/terraform-linters/tflint-ruleset-aws/pull/787) [#800](https://github.com/terraform-linters/tflint-ruleset-aws/pull/800): Add new db.m8g, r8g, r7i, r6i-preconfigured, m7i, c6gd instances ([@gnetsman](https://github.com/gnetsman), [@wata727](https://github.com/wata727))
14+
- [#786](https://github.com/terraform-linters/tflint-ruleset-aws/pull/786): feat: add `aws_iam_policy_attachment_exclusive_attachment` rule ([@kayman-mk](https://github.com/kayman-mk))
15+
- [#790](https://github.com/terraform-linters/tflint-ruleset-aws/pull/790): feat: add `aws_security_group_rule_deprecated` rule ([@kayman-mk](https://github.com/kayman-mk))
16+
- [#801](https://github.com/terraform-linters/tflint-ruleset-aws/pull/801): rules: Add missing DB engines ([@wata727](https://github.com/wata727))
17+
- [#802](https://github.com/terraform-linters/tflint-ruleset-aws/pull/802): rules: Add cache.c7gn high-bandwidth node type ([@wata727](https://github.com/wata727))
18+
- [#803](https://github.com/terraform-linters/tflint-ruleset-aws/pull/803): rules: Update Lambda runtime deprecations ([@wata727](https://github.com/wata727))
19+
20+
### Chores
21+
22+
- [#791](https://github.com/terraform-linters/tflint-ruleset-aws/pull/791) [#795](https://github.com/terraform-linters/tflint-ruleset-aws/pull/795) [#797](https://github.com/terraform-linters/tflint-ruleset-aws/pull/797): Bump aws-sdk-go-v2
23+
- [#792](https://github.com/terraform-linters/tflint-ruleset-aws/pull/792): Bump github.com/hashicorp/terraform-json from 0.23.0 to 0.24.0
24+
- [#796](https://github.com/terraform-linters/tflint-ruleset-aws/pull/796): Bump golang.org/x/net from 0.32.0 to 0.33.0
25+
126
## 0.36.0 (2024-12-08)
227

328
### Breaking Changes

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ You can install the plugin by adding a config to `.tflint.hcl` and running `tfli
1919
```hcl
2020
plugin "aws" {
2121
enabled = true
22-
version = "0.36.0"
22+
version = "0.37.0"
2323
source = "github.com/terraform-linters/tflint-ruleset-aws"
2424
}
2525
```

docs/rules/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ These rules enforce best practices and naming conventions:
6868
|[aws_elasticache_replication_group_previous_type](aws_elasticache_replication_group_previous_type.md)|Disallow using previous node types||
6969
|[aws_elasticache_replication_group_default_parameter_group](aws_elasticache_replication_group_default_parameter_group.md)|Disallow using default parameter group||
7070
|[aws_instance_previous_type](aws_instance_previous_type.md)|Disallow using previous generation instance types||
71+
|[aws_iam_policy_attachment_exclusive_attachment](aws_iam_policy_attachment_exclusive_attachment.md)|Consider alternative resources to `aws_iam_policy_attachment`||
7172
|[aws_iam_policy_document_gov_friendly_arns](aws_iam_policy_document_gov_friendly_arns.md)|Ensure `iam_policy_document` data sources do not contain `arn:aws:` ARN's||
7273
|[aws_iam_policy_gov_friendly_arns](aws_iam_policy_gov_friendly_arns.md)|Ensure `iam_policy` resources do not contain `arn:aws:` ARN's||
7374
|[aws_iam_role_policy_gov_friendly_arns](aws_iam_role_policy_gov_friendly_arns.md)|Ensure `iam_role_policy` resources do not contain `arn:aws:` ARN's||
7475
|[aws_lambda_function_deprecated_runtime](aws_lambda_function_deprecated_runtime.md)|Disallow deprecated runtimes for Lambda Function||
7576
|[aws_resource_missing_tags](aws_resource_missing_tags.md)|Require specific tags for all AWS resource types that support them||
7677
|[aws_s3_bucket_name](aws_s3_bucket_name.md)|Ensures all S3 bucket names match the naming rules||
7778
|[aws_security_group_inline_rules](aws_security_group_inline_rules.md)|Disallow `ingress` and `egress` arguments of the `aws_security_group` resource||
79+
|[aws_security_group_rule_deprecated](aws_security_group_rule_deprecated.md)|Disallow using `aws_security_group_rule` resource||
7880
|[aws_provider_missing_default_tags](aws_provider_missing_default_tags.md)|Require specific tags for all AWS providers default tags||
7981

8082
### SDK-based Validations
@@ -1176,14 +1178,11 @@ These rules enforce best practices and naming conventions:
11761178
|aws_securityhub_standards_control_invalid_standards_control_arn||
11771179
|aws_securityhub_standards_subscription_invalid_standards_arn||
11781180
|aws_service_discovery_http_namespace_invalid_description||
1179-
|aws_service_discovery_http_namespace_invalid_name||
11801181
|aws_service_discovery_instance_invalid_instance_id||
11811182
|aws_service_discovery_instance_invalid_service_id||
11821183
|aws_service_discovery_private_dns_namespace_invalid_description||
1183-
|aws_service_discovery_private_dns_namespace_invalid_name||
11841184
|aws_service_discovery_private_dns_namespace_invalid_vpc||
11851185
|aws_service_discovery_public_dns_namespace_invalid_description||
1186-
|aws_service_discovery_public_dns_namespace_invalid_name||
11871186
|aws_service_discovery_service_invalid_description||
11881187
|aws_servicecatalog_budget_resource_association_invalid_budget_name||
11891188
|aws_servicecatalog_budget_resource_association_invalid_resource_id||

docs/rules/README.md.tmpl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,15 @@ These rules enforce best practices and naming conventions:
6868
|[aws_elasticache_replication_group_previous_type](aws_elasticache_replication_group_previous_type.md)|Disallow using previous node types|✔|
6969
|[aws_elasticache_replication_group_default_parameter_group](aws_elasticache_replication_group_default_parameter_group.md)|Disallow using default parameter group|✔|
7070
|[aws_instance_previous_type](aws_instance_previous_type.md)|Disallow using previous generation instance types|✔|
71+
|[aws_iam_policy_attachment_exclusive_attachment](aws_iam_policy_attachment_exclusive_attachment.md)|Consider alternative resources to `aws_iam_policy_attachment`||
7172
|[aws_iam_policy_document_gov_friendly_arns](aws_iam_policy_document_gov_friendly_arns.md)|Ensure `iam_policy_document` data sources do not contain `arn:aws:` ARN's||
7273
|[aws_iam_policy_gov_friendly_arns](aws_iam_policy_gov_friendly_arns.md)|Ensure `iam_policy` resources do not contain `arn:aws:` ARN's||
7374
|[aws_iam_role_policy_gov_friendly_arns](aws_iam_role_policy_gov_friendly_arns.md)|Ensure `iam_role_policy` resources do not contain `arn:aws:` ARN's||
7475
|[aws_lambda_function_deprecated_runtime](aws_lambda_function_deprecated_runtime.md)|Disallow deprecated runtimes for Lambda Function|✔|
7576
|[aws_resource_missing_tags](aws_resource_missing_tags.md)|Require specific tags for all AWS resource types that support them||
7677
|[aws_s3_bucket_name](aws_s3_bucket_name.md)|Ensures all S3 bucket names match the naming rules|✔|
7778
|[aws_security_group_inline_rules](aws_security_group_inline_rules.md)|Disallow `ingress` and `egress` arguments of the `aws_security_group` resource||
79+
|[aws_security_group_rule_deprecated](aws_security_group_rule_deprecated.md)|Disallow using `aws_security_group_rule` resource||
7880
|[aws_provider_missing_default_tags](aws_provider_missing_default_tags.md)|Require specific tags for all AWS providers default tags||
7981

8082
### SDK-based Validations
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# aws_iam_policy_attachment_exclusive_attachment
2+
3+
This rule checks whether the `aws_iam_policy_attachment` resource is used.
4+
5+
The `aws_iam_policy_attachment` resource creates exclusive attachments for IAM policies. Within the entire AWS account, all users, roles, and groups that a single policy is attached to must be specified by a single aws_iam_policy_attachment resource.
6+
7+
## Configuration
8+
9+
```hcl
10+
rule "aws_iam_policy_attachment_exclusive_attachment" {
11+
enabled = true
12+
}
13+
```
14+
15+
## Example
16+
17+
```hcl
18+
resource "aws_iam_policy_attachment" "attachment" {
19+
name = "test_attachment"
20+
}
21+
```
22+
23+
```shell
24+
$ tflint
25+
1 issue(s) found:
26+
Warning: Within the entire AWS account, all users, roles, and groups that a single policy is attached to must be specified by a single aws_iam_policy_attachment resource. Consider aws_iam_role_policy_attachment, aws_iam_user_policy_attachment, or aws_iam_group_policy_attachment instead. (aws_iam_policy_attachment_has_alternatives)
27+
on template.tf line 2:
28+
2: resource "aws_iam_policy_attachment" "attachment" {
29+
```
30+
31+
## Why
32+
33+
The [`aws_iam_policy_attachment`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/iam_policy_attachment) resource creates exclusive attachments of IAM policies. Across the entire AWS account, all the users/roles/groups to which a single policy is attached must be declared by a single `aws_iam_policy_attachment` resource. This means that even any users/roles/groups that have the attached policy via any other mechanism (including other Terraform resources) will have that attached policy revoked by this resource.
34+
35+
## How To Fix
36+
37+
Consider using `aws_iam_role_policy_attachment`, `aws_iam_user_policy_attachment`, or `aws_iam_group_policy_attachment` instead. These resources do not enforce exclusive attachment of an IAM policy.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# aws_security_group_rule_deprecated
2+
3+
The `aws_security_group_rule` resource should be replaced with `aws_vpc_security_group_egress_rule` or `aws_vpc_security_group_ingress_rule`. It lacks support of unique IDs, tags, and descriptions, and has difficulties managing multiple CIDR blocks.
4+
5+
## Example
6+
7+
```hcl
8+
resource "aws_security_group_rule" "foo" {
9+
security_group_id = "sg-12345678"
10+
type = "ingress"
11+
}
12+
```
13+
14+
```sh
15+
❯ tflint
16+
1 issue(s) found:
17+
18+
Warning: Consider using aws_vpc_security_group_egress_rule or aws_vpc_security_group_ingress_rule instead. (aws_security_group_rule_deprecated)
19+
20+
on bastion.tf line 4:
21+
4: resource "aws_security_group_rule" "foo" {
22+
```
23+
24+
## Why
25+
26+
Avoid using the [`aws_security_group_rule`](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/security_group_rule) resource because it has difficulties managing multiple CIDR blocks and historically lacks unique IDs, tags, and descriptions. To prevent these issues, follow the current best practice of using the `aws_vpc_security_group_egress_rule` and `aws_vpc_security_group_ingress_rule` resources.
27+
28+
## How To Fix
29+
30+
Depending on `type`, you can fix the issue by using either `aws_vpc_security_group_egress_rule` or `aws_vpc_security_group_ingress_rule`.

go.mod

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,43 +15,43 @@ require (
1515
github.com/mitchellh/go-testing-interface v1.14.1 // indirect
1616
github.com/mitchellh/go-wordwrap v1.0.0 // indirect
1717
github.com/terraform-linters/tflint-plugin-sdk v0.21.0
18-
github.com/zclconf/go-cty v1.15.1
18+
github.com/zclconf/go-cty v1.16.0
1919
google.golang.org/grpc v1.65.0 // indirect
2020
google.golang.org/protobuf v1.34.2 // indirect
2121
)
2222

2323
require (
24-
github.com/aws/aws-sdk-go-v2/service/ec2 v1.195.0
25-
github.com/aws/aws-sdk-go-v2/service/ecs v1.52.1
26-
github.com/aws/aws-sdk-go-v2/service/elasticache v1.44.1
27-
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.6
28-
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.1
29-
github.com/aws/aws-sdk-go-v2/service/iam v1.38.2
30-
github.com/aws/aws-sdk-go-v2/service/rds v1.92.0
24+
github.com/aws/aws-sdk-go-v2/service/ec2 v1.198.1
25+
github.com/aws/aws-sdk-go-v2/service/ecs v1.53.2
26+
github.com/aws/aws-sdk-go-v2/service/elasticache v1.44.2
27+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancing v1.28.7
28+
github.com/aws/aws-sdk-go-v2/service/elasticloadbalancingv2 v1.43.2
29+
github.com/aws/aws-sdk-go-v2/service/iam v1.38.3
30+
github.com/aws/aws-sdk-go-v2/service/rds v1.93.2
3131
github.com/aws/smithy-go v1.22.1
3232
github.com/hashicorp/aws-sdk-go-base/v2 v2.0.0-beta.59
33-
github.com/hashicorp/terraform-json v0.23.0
33+
github.com/hashicorp/terraform-json v0.24.0
3434
github.com/stretchr/testify v1.10.0
3535
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53
36-
golang.org/x/net v0.32.0
36+
golang.org/x/net v0.33.0
3737
)
3838

3939
require (
4040
github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
41-
github.com/aws/aws-sdk-go-v2 v1.32.6 // indirect
41+
github.com/aws/aws-sdk-go-v2 v1.32.7 // indirect
4242
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.6 // indirect
4343
github.com/aws/aws-sdk-go-v2/config v1.28.0 // indirect
4444
github.com/aws/aws-sdk-go-v2/credentials v1.17.41 // indirect
4545
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.17 // indirect
46-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.25 // indirect
47-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.25 // indirect
46+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.26 // indirect
47+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.26 // indirect
4848
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
4949
github.com/aws/aws-sdk-go-v2/internal/v4a v1.3.21 // indirect
5050
github.com/aws/aws-sdk-go-v2/service/dynamodb v1.36.2 // indirect
5151
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
5252
github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.4.2 // indirect
5353
github.com/aws/aws-sdk-go-v2/service/internal/endpoint-discovery v1.10.2 // indirect
54-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.6 // indirect
54+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.7 // indirect
5555
github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.18.2 // indirect
5656
github.com/aws/aws-sdk-go-v2/service/s3 v1.66.1 // indirect
5757
github.com/aws/aws-sdk-go-v2/service/sqs v1.36.2 // indirect

0 commit comments

Comments
 (0)