Skip to content

Commit ace20c4

Browse files
Allow create/delete timeouts for aws_route resource to be specified (#95)
* Allow create/delete timeouts for `aws_route` resource to be specified * Updated README.md Co-authored-by: actions-bot <[email protected]>
1 parent 8e1e74f commit ace20c4

File tree

7 files changed

+43
-10
lines changed

7 files changed

+43
-10
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ Available targets:
196196
| additional\_tag\_map | Additional tags for appending to each tag map | `map(string)` | `{}` | no |
197197
| attributes | Any extra attributes for naming these resources | `list(string)` | `[]` | no |
198198
| availability\_zones | List of Availability Zones where subnets will be created | `list(string)` | n/a | yes |
199+
| aws\_route\_create\_timeout | Time to wait for AWS route creation specifed as a Go Duration, e.g. `2m` | `string` | `"2m"` | no |
200+
| aws\_route\_delete\_timeout | Time to wait for AWS route deletion specifed as a Go Duration, e.g. `5m` | `string` | `"5m"` | no |
199201
| cidr\_block | Base CIDR block which will be divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | `string` | n/a | yes |
200202
| context | Default context to use for passing state between label invocations | <pre>object({<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> enabled = bool<br> delimiter = string<br> attributes = list(string)<br> label_order = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": "",<br> "enabled": true,<br> "environment": "",<br> "label_order": [],<br> "name": "",<br> "namespace": "",<br> "regex_replace_chars": "",<br> "stage": "",<br> "tags": {}<br>}</pre> | no |
201203
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | `string` | `"-"` | no |

docs/terraform.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
| additional\_tag\_map | Additional tags for appending to each tag map | `map(string)` | `{}` | no |
2222
| attributes | Any extra attributes for naming these resources | `list(string)` | `[]` | no |
2323
| availability\_zones | List of Availability Zones where subnets will be created | `list(string)` | n/a | yes |
24+
| aws\_route\_create\_timeout | Time to wait for AWS route creation specifed as a Go Duration, e.g. `2m` | `string` | `"2m"` | no |
25+
| aws\_route\_delete\_timeout | Time to wait for AWS route deletion specifed as a Go Duration, e.g. `5m` | `string` | `"5m"` | no |
2426
| cidr\_block | Base CIDR block which will be divided into subnet CIDR blocks (e.g. `10.0.0.0/16`) | `string` | n/a | yes |
2527
| context | Default context to use for passing state between label invocations | <pre>object({<br> namespace = string<br> environment = string<br> stage = string<br> name = string<br> enabled = bool<br> delimiter = string<br> attributes = list(string)<br> label_order = list(string)<br> tags = map(string)<br> additional_tag_map = map(string)<br> regex_replace_chars = string<br> })</pre> | <pre>{<br> "additional_tag_map": {},<br> "attributes": [],<br> "delimiter": "",<br> "enabled": true,<br> "environment": "",<br> "label_order": [],<br> "name": "",<br> "namespace": "",<br> "regex_replace_chars": "",<br> "stage": "",<br> "tags": {}<br>}</pre> | no |
2628
| delimiter | Delimiter to be used between `namespace`, `stage`, `name` and `attributes` | `string` | `"-"` | no |

examples/complete/main.tf

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,16 @@ module "vpc" {
1111
}
1212

1313
module "subnets" {
14-
source = "../../"
15-
availability_zones = var.availability_zones
16-
namespace = var.namespace
17-
stage = var.stage
18-
name = var.name
19-
vpc_id = module.vpc.vpc_id
20-
igw_id = module.vpc.igw_id
21-
cidr_block = module.vpc.vpc_cidr_block
22-
nat_gateway_enabled = false
23-
nat_instance_enabled = false
14+
source = "../../"
15+
availability_zones = var.availability_zones
16+
namespace = var.namespace
17+
stage = var.stage
18+
name = var.name
19+
vpc_id = module.vpc.vpc_id
20+
igw_id = module.vpc.igw_id
21+
cidr_block = module.vpc.vpc_cidr_block
22+
nat_gateway_enabled = false
23+
nat_instance_enabled = false
24+
aws_route_create_timeout = "5m"
25+
aws_route_delete_timeout = "10m"
2426
}

nat-gateway.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,4 +69,9 @@ resource "aws_route" "default" {
6969
nat_gateway_id = element(aws_nat_gateway.default.*.id, count.index)
7070
destination_cidr_block = "0.0.0.0/0"
7171
depends_on = [aws_route_table.private]
72+
73+
timeouts {
74+
create = var.aws_route_create_timeout
75+
delete = var.aws_route_delete_timeout
76+
}
7277
}

nat-instance.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,9 @@ resource "aws_route" "nat_instance" {
134134
instance_id = element(aws_instance.nat_instance.*.id, count.index)
135135
destination_cidr_block = "0.0.0.0/0"
136136
depends_on = [aws_route_table.private]
137+
138+
timeouts {
139+
create = var.aws_route_create_timeout
140+
delete = var.aws_route_delete_timeout
141+
}
137142
}

public.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ resource "aws_route" "public" {
6464
route_table_id = join("", aws_route_table.public.*.id)
6565
destination_cidr_block = "0.0.0.0/0"
6666
gateway_id = var.igw_id
67+
68+
timeouts {
69+
create = var.aws_route_create_timeout
70+
delete = var.aws_route_delete_timeout
71+
}
6772
}
6873

6974
resource "aws_route_table_association" "public" {

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ variable "map_public_ip_on_launch" {
8989
description = "Instances launched into a public subnet should be assigned a public IP address"
9090
}
9191

92+
variable "aws_route_create_timeout" {
93+
type = string
94+
default = "2m"
95+
description = "Time to wait for AWS route creation specifed as a Go Duration, e.g. `2m`"
96+
}
97+
98+
variable "aws_route_delete_timeout" {
99+
type = string
100+
default = "5m"
101+
description = "Time to wait for AWS route deletion specifed as a Go Duration, e.g. `5m`"
102+
}
103+
92104
variable "private_subnets_additional_tags" {
93105
type = map(string)
94106
default = {}

0 commit comments

Comments
 (0)