Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
aaomoware committed Aug 17, 2018
1 parent 53ee8fa commit a5cf2fa
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
7 changes: 2 additions & 5 deletions aws/vpc/route/inputs.tf
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
variable default { default = false }
variable gateway_id { default = [] type = "list" }
variable nat_count { default = "0" }
variable gateway_id { default = "" }
variable instance_id { default = "" }
variable route_table_id { type = "list" }
variable nat_gateway_id { default = [] type = "list" }
variable network_interface_id { default = "" }
variable egress_only_gateway_id { default = "" }
variable destination_cidr_block { default = "" }
variable vpc_peering_connection_id { default = "" }


variable ngw { default = false }
variable igw { default = false }
38 changes: 19 additions & 19 deletions aws/vpc/route/route.tf
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#<---generic one-to-one
resource "aws_route" "rt" {
count = "${var.default ? 1 : 0}"
count = "${var.nat_count}"

gateway_id = "${length(var.gateway_id) > 0 ? element(var.gateway_id, length(var.gateway_id)) : ""}"
gateway_id = "${var.gateway_id}"
instance_id = "${var.instance_id}"
route_table_id = "${element(var.route_table_id, length(var.route_table_id))}"
nat_gateway_id = "${ength(var.nat_gateway_id) > 0 ? element(var.nat_gateway_id, length(var.nat_gateway_id)) : ""}"
route_table_id = "${element(var.route_table_id, count.index)}"
nat_gateway_id = "${element(var.nat_gateway_id, count.index)}"
network_interface_id = "${var.network_interface_id}"
destination_cidr_block = "${var.destination_cidr_block}"
egress_only_gateway_id = "${var.egress_only_gateway_id}"
Expand All @@ -21,22 +21,22 @@ resource "aws_route" "rt" {
# * https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Route_Tables.html
# * https://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/vpc-nat-gateway.html
#------------
#resource "aws_route" "ngw" {
# count = "${!var.default && var.nat_count > 1 ? var.nat_count : 0}"
#
# gateway_id = "${length(var.gateway_id) > 1 ? element(var.gateway_id, count.index) : ""}"
# route_table_id = "${element(var.route_table_id, count.index)}"
# nat_gateway_id = "${length(var.nat_gateway_id) > 1 ? element(var.nat_gateway_id, count.index) : ""}"
# }
# resource "aws_route" "ngw" {
# count = "${!var.default && length(var.route_table_id) > 1 ? length(var.route_table_id) : 0}"
# count = "${var.ngw && length(var.nat_gateway_id) > 0 ? length(var.nat_gateway_id) : 0}"
#
# gateway_id = "${length(var.gateway_id) > 1 ? element(var.gateway_id, count.index) : ""}"
# route_table_id = "${element(var.route_table_id, count.index)}"
# nat_gateway_id = "${length(var.nat_gateway_id) > 1 ? element(var.nat_gateway_id, count.index) : ""}"
# nat_gateway_id = "${element(var.nat_gateway_id, count.index)}"
# route_table_id = "${element(var.route_table_id, count.index)}"
# }
resource "aws_route" "ngw" {
count = "${var.ngw && length(var.nat_gateway_id) > 0 ? length(var.nat_gateway_id) : 0}"

nat_gateway_id = "${element(var.nat_gateway_id, count.index)}"
route_table_id = "${element(var.route_table_id, count.index)}"
}
resource "aws_route" "igw" {
count = "${var.igw && length(var.gateway_id) > 0 ? length(var.gateway_id) : 0}"

gateway_id = "${element(var.gateway_id, count.index)}"
route_table_id = "${element(var.route_table_id, count.index)}"
# resource "aws_route" "igw" {
# count = "${var.igw && length(var.gateway_id) > 0 ? length(var.gateway_id) : 0}"
#
# gateway_id = "${element(var.gateway_id, count.index)}"
# route_table_id = "${element(var.route_table_id, count.index)}"
}

0 comments on commit a5cf2fa

Please sign in to comment.