From ce93a762e6747be7b5c535e5a07b42d15edc373a Mon Sep 17 00:00:00 2001 From: yiskaneto <44711170+yiskaneto@users.noreply.github.com> Date: Fri, 6 Dec 2024 16:35:31 -0600 Subject: [PATCH] feat: Add security_groups var for mounted targets --- main.tf | 2 +- variables.tf | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/main.tf b/main.tf index 79061dd..382c491 100644 --- a/main.tf +++ b/main.tf @@ -146,7 +146,7 @@ resource "aws_efs_mount_target" "this" { file_system_id = aws_efs_file_system.this[0].id ip_address = try(each.value.ip_address, null) - security_groups = var.create_security_group ? concat([aws_security_group.this[0].id], try(each.value.security_groups, [])) : try(each.value.security_groups, null) + security_groups = var.create_security_group ? concat([aws_security_group.this[0].id], try(each.value.security_groups, [])) : try(each.value.security_groups, var.security_groups) subnet_id = each.value.subnet_id } diff --git a/variables.tf b/variables.tf index d811dba..d8a51a5 100644 --- a/variables.tf +++ b/variables.tf @@ -124,6 +124,12 @@ variable "mount_targets" { default = {} } +variable "security_groups" { + description = "(Optional) A list of up to 5 VPC security group IDs (that must be for the same VPC as subnet specified) in effect for the mount target." + type = list(string) + default = null +} + ################################################################################ # Security Group ################################################################################