From 69d7b4403b3f0b19f934f44dfb56efc384f29e09 Mon Sep 17 00:00:00 2001 From: Joe Niland Date: Fri, 21 Aug 2020 09:51:07 +1000 Subject: [PATCH 1/2] Allow create/delete timeouts for `aws_route` resource to be specified --- examples/complete/main.tf | 22 ++++++++++++---------- nat-gateway.tf | 5 +++++ nat-instance.tf | 5 +++++ public.tf | 5 +++++ variables.tf | 12 ++++++++++++ 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 1bc996ea..591b1d5c 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -11,14 +11,16 @@ module "vpc" { } module "subnets" { - source = "../../" - availability_zones = var.availability_zones - namespace = var.namespace - stage = var.stage - name = var.name - vpc_id = module.vpc.vpc_id - igw_id = module.vpc.igw_id - cidr_block = module.vpc.vpc_cidr_block - nat_gateway_enabled = false - nat_instance_enabled = false + source = "../../" + availability_zones = var.availability_zones + namespace = var.namespace + stage = var.stage + name = var.name + vpc_id = module.vpc.vpc_id + igw_id = module.vpc.igw_id + cidr_block = module.vpc.vpc_cidr_block + nat_gateway_enabled = false + nat_instance_enabled = false + aws_route_create_timeout = "5m" + aws_route_delete_timeout = "10m" } diff --git a/nat-gateway.tf b/nat-gateway.tf index e02fe20c..81988d5c 100644 --- a/nat-gateway.tf +++ b/nat-gateway.tf @@ -69,4 +69,9 @@ resource "aws_route" "default" { nat_gateway_id = element(aws_nat_gateway.default.*.id, count.index) destination_cidr_block = "0.0.0.0/0" depends_on = [aws_route_table.private] + + timeouts { + create = var.aws_route_create_timeout + delete = var.aws_route_delete_timeout + } } diff --git a/nat-instance.tf b/nat-instance.tf index 937b4c5e..8c76eb57 100644 --- a/nat-instance.tf +++ b/nat-instance.tf @@ -134,4 +134,9 @@ resource "aws_route" "nat_instance" { instance_id = element(aws_instance.nat_instance.*.id, count.index) destination_cidr_block = "0.0.0.0/0" depends_on = [aws_route_table.private] + + timeouts { + create = var.aws_route_create_timeout + delete = var.aws_route_delete_timeout + } } diff --git a/public.tf b/public.tf index 0cc1964f..d36d9c32 100644 --- a/public.tf +++ b/public.tf @@ -64,6 +64,11 @@ resource "aws_route" "public" { route_table_id = join("", aws_route_table.public.*.id) destination_cidr_block = "0.0.0.0/0" gateway_id = var.igw_id + + timeouts { + create = var.aws_route_create_timeout + delete = var.aws_route_delete_timeout + } } resource "aws_route_table_association" "public" { diff --git a/variables.tf b/variables.tf index d5678d2b..a8a46e71 100644 --- a/variables.tf +++ b/variables.tf @@ -89,6 +89,18 @@ variable "map_public_ip_on_launch" { description = "Instances launched into a public subnet should be assigned a public IP address" } +variable "aws_route_create_timeout" { + type = string + default = "2m" + description = "Time to wait for AWS route creation specifed as a Go Duration, e.g. `2m`" +} + +variable "aws_route_delete_timeout" { + type = string + default = "5m" + description = "Time to wait for AWS route deletion specifed as a Go Duration, e.g. `5m`" +} + variable "private_subnets_additional_tags" { type = map(string) default = {} From 38047d403313b2df207c192718be9ba43fc49ba7 Mon Sep 17 00:00:00 2001 From: actions-bot <58130806+actions-bot@users.noreply.github.com> Date: Fri, 21 Aug 2020 00:21:58 +0000 Subject: [PATCH 2/2] Updated README.md --- README.md | 2 ++ docs/terraform.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README.md b/README.md index 8906a01a..5d4850bb 100644 --- a/README.md +++ b/README.md @@ -196,6 +196,8 @@ Available targets: | additional\_tag\_map | Additional tags for appending to each tag map | `map(string)` | `{}` | no | | attributes | Any extra attributes for naming these resources | `list(string)` | `[]` | no | | availability\_zones | List of Availability Zones where subnets will be created | `list(string)` | n/a | yes | +| aws\_route\_create\_timeout | Time to wait for AWS route creation specifed as a Go Duration, e.g. `2m` | `string` | `"2m"` | no | +| aws\_route\_delete\_timeout | Time to wait for AWS route deletion specifed as a Go Duration, e.g. `5m` | `string` | `"5m"` | no | | cidr\_block | Base CIDR block which will be divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | `string` | n/a | yes | | context | Default context to use for passing state between label invocations |
object({
namespace = string
environment = string
stage = string
name = string
enabled = bool
delimiter = string
attributes = list(string)
label_order = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
})
|
{
"additional_tag_map": {},
"attributes": [],
"delimiter": "",
"enabled": true,
"environment": "",
"label_order": [],
"name": "",
"namespace": "",
"regex_replace_chars": "",
"stage": "",
"tags": {}
}
| no | | delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | `string` | `"-"` | no | diff --git a/docs/terraform.md b/docs/terraform.md index a303b91e..0deb2183 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -21,6 +21,8 @@ | additional\_tag\_map | Additional tags for appending to each tag map | `map(string)` | `{}` | no | | attributes | Any extra attributes for naming these resources | `list(string)` | `[]` | no | | availability\_zones | List of Availability Zones where subnets will be created | `list(string)` | n/a | yes | +| aws\_route\_create\_timeout | Time to wait for AWS route creation specifed as a Go Duration, e.g. `2m` | `string` | `"2m"` | no | +| aws\_route\_delete\_timeout | Time to wait for AWS route deletion specifed as a Go Duration, e.g. `5m` | `string` | `"5m"` | no | | cidr\_block | Base CIDR block which will be divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | `string` | n/a | yes | | context | Default context to use for passing state between label invocations |
object({
namespace = string
environment = string
stage = string
name = string
enabled = bool
delimiter = string
attributes = list(string)
label_order = list(string)
tags = map(string)
additional_tag_map = map(string)
regex_replace_chars = string
})
|
{
"additional_tag_map": {},
"attributes": [],
"delimiter": "",
"enabled": true,
"environment": "",
"label_order": [],
"name": "",
"namespace": "",
"regex_replace_chars": "",
"stage": "",
"tags": {}
}
| no | | delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | `string` | `"-"` | no |