Skip to content

Commit 646916b

Browse files
author
kiranmane007
committed
enahnacement: update timeouts, variables, and outputs for vpc-endpoints module
1 parent 0eefe64 commit 646916b

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

modules/vpc-endpoints/main.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@ resource "aws_vpc_endpoint" "this" {
6363
)
6464

6565
timeouts {
66-
create = try(var.timeouts.create, "10m")
67-
update = try(var.timeouts.update, "10m")
68-
delete = try(var.timeouts.delete, "10m")
66+
create = var.timeouts.create
67+
update = var.timeouts.update
68+
delete = var.timeouts.delete
6969
}
7070
}
7171

@@ -75,6 +75,8 @@ resource "aws_vpc_endpoint" "this" {
7575

7676
resource "aws_security_group" "this" {
7777
count = var.create && var.create_security_group ? 1 : 0
78+
# In future if need to support multiple security groups.
79+
# for_each = var.create && var.create_security_group ? [1] : []
7880

7981
name = var.security_group_name
8082
name_prefix = var.security_group_name_prefix

modules/vpc-endpoints/outputs.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,5 @@ output "security_group_arn" {
1515
output "security_group_id" {
1616
description = "ID of the security group"
1717
value = try(aws_security_group.this[0].id, null)
18+
sensitive = true
1819
}

modules/vpc-endpoints/variables.tf

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ variable "tags" {
3636

3737
variable "timeouts" {
3838
description = "Define maximum timeout for creating, updating, and deleting VPC endpoint resources"
39-
type = map(string)
39+
type = object({
40+
create = optional(string, "10m")
41+
update = optional(string, "10m")
42+
delete = optional(string, "10m")
43+
})
4044
default = {}
4145
}
4246

@@ -54,6 +58,11 @@ variable "security_group_name" {
5458
description = "Name to use on security group created. Conflicts with `security_group_name_prefix`"
5559
type = string
5660
default = null
61+
62+
validation {
63+
condition = var.security_group_name == null || var.security_group_name_prefix == null
64+
error_message = "only one of security_group_name or security_group_name_prefix can be set."
65+
}
5766
}
5867

5968
variable "security_group_name_prefix" {

0 commit comments

Comments
 (0)