Skip to content

Commit be95286

Browse files
authored
aws_route_not_specified_target: Add core_network_arn as target (#484)
1 parent 81d729b commit be95286

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

docs/rules/aws_route_not_specified_target.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ resource "aws_route" "foo" {
1515
$ tflint
1616
1 issue(s) found:
1717
18-
Error: The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id or vpc_endpoint_id. (aws_route_not_specified_target)
18+
Error: The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id, core_network_arn or vpc_endpoint_id. (aws_route_not_specified_target)
1919
2020
on template.tf line 1:
2121
1: resource "aws_route" "foo" {

rules/aws_route_not_specified_target.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ func (r *AwsRouteNotSpecifiedTargetRule) Check(runner tflint.Runner) error {
5555
{Name: "vpc_endpoint_id"},
5656
{Name: "carrier_gateway_id"},
5757
{Name: "local_gateway_id"},
58+
{Name: "core_network_arn"},
5859
},
5960
}, nil)
6061
if err != nil {
@@ -78,7 +79,7 @@ func (r *AwsRouteNotSpecifiedTargetRule) Check(runner tflint.Runner) error {
7879
if len(resource.Body.Attributes)-nullAttributes == 0 {
7980
runner.EmitIssue(
8081
r,
81-
"The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id or vpc_endpoint_id.",
82+
"The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id, core_network_arn or vpc_endpoint_id.",
8283
resource.DefRange,
8384
)
8485
}

rules/aws_route_not_specified_target_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ resource "aws_route" "foo" {
2222
Expected: helper.Issues{
2323
{
2424
Rule: NewAwsRouteNotSpecifiedTargetRule(),
25-
Message: "The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id or vpc_endpoint_id.",
25+
Message: "The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id, core_network_arn or vpc_endpoint_id.",
2626
Range: hcl.Range{
2727
Filename: "resource.tf",
2828
Start: hcl.Pos{Line: 2, Column: 1},
@@ -104,7 +104,7 @@ resource "aws_route" "foo" {
104104
Expected: helper.Issues{
105105
{
106106
Rule: NewAwsRouteNotSpecifiedTargetRule(),
107-
Message: "The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id or vpc_endpoint_id.",
107+
Message: "The routing target is not specified, each aws_route must contain either egress_only_gateway_id, gateway_id, instance_id, nat_gateway_id, network_interface_id, transit_gateway_id, vpc_peering_connection_id, core_network_arn or vpc_endpoint_id.",
108108
Range: hcl.Range{
109109
Filename: "resource.tf",
110110
Start: hcl.Pos{Line: 2, Column: 1},
@@ -119,6 +119,15 @@ resource "aws_route" "foo" {
119119
resource "aws_route" "foo" {
120120
route_table_id = "rtb-1234abcd"
121121
vpc_endpoint_id = "vpce-12345678abcdefgh"
122+
}`,
123+
Expected: helper.Issues{},
124+
},
125+
{
126+
Name: "core_network_arn is specified",
127+
Content: `
128+
resource "aws_route" "foo" {
129+
route_table_id = "rtb-1234abcd"
130+
core_network_arn = "arn:aws:networkmanager::230703758040:core-network/core-network-0ce39423cf52b4c76"
122131
}`,
123132
Expected: helper.Issues{},
124133
},

0 commit comments

Comments
 (0)