Closed klaphi closed 3 years ago
Isn't the value of var.transit_gateway_id
null? If the value is null, even if it is specified, it will be ignored when running terraform apply, so this rule considers that attribute to be unspecified if the value is null.
Example:
variable "transit_gateway_id" {
default = null
}
resource "aws_route" "private_tgw_egress" {
transit_gateway_id = var.transit_gateway_id
}
$ tflint --only aws_route_not_specified_target
1 issue(s) found:
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)
on route.tf line 5:
5: resource "aws_route" "private_tgw_egress" {
Reference: https://github.com/terraform-linters/tflint-ruleset-aws/blob/v0.4.1/docs/rules/aws_route_not_specified_target.md
variable "transit_gateway_id" {}
resource "aws_route" "private_tgw_egress" {
transit_gateway_id = var.transit_gateway_id
}
$ tflint --only aws_route_not_specified_target
// No issues
Hi,
we have the following code:
This result in the following error:
I think this is wrong because the parameter _transit_gatewayid is specified:
I tried running tflint from VScode or shell but this does not change anything.
Version
Example: