diff --git a/main.tf b/main.tf index afa0127..06a0c0f 100644 --- a/main.tf +++ b/main.tf @@ -3,11 +3,11 @@ locals { create_policy = var.create_policy != null ? var.create_policy : var.role_arn == null dead_letter_config = var.dead_letter_target_arn != null ? { create : true } : {} environment = var.environment != null ? { create : true } : {} + ephemeral_storage = var.ephemeral_storage_size != null ? { create : true } : {} execution_type = var.subnet_ids == null ? "Basic" : "VPCAccess" filename = var.filename != null ? var.filename : data.archive_file.dummy.output_path source_code_hash = var.source_code_hash != null ? var.source_code_hash : var.filename != null ? filebase64sha256(var.filename) : null tracing_config = var.tracing_config_mode != null ? { create : true } : {} - ephemeral_storage = var.ephemeral_storage_size != null ? { create : true } : {} vpc_config = var.subnet_ids != null ? { create : true } : {} } @@ -74,7 +74,8 @@ resource "aws_security_group" "default" { #checkov:skip=CKV2_AWS_5: False positive finding, the security group is attached. count = var.subnet_ids != null ? 1 : 0 - name = var.name + name = var.sg_name_prefix == null ? var.name : null + name_prefix = var.sg_name_prefix != null ? var.sg_name_prefix : null description = "Security group for lambda ${var.name}" vpc_id = data.aws_subnet.selected[0].vpc_id tags = var.tags diff --git a/variables.tf b/variables.tf index 79d9bb2..f803632 100644 --- a/variables.tf +++ b/variables.tf @@ -196,6 +196,12 @@ variable "security_group_egress_rules" { } } +variable "sg_name_prefix" { + type = string + default = null + description = "An optional prefix that will be used to create an unique name of the security group. If not provided `var.name` will be used" +} + variable "source_code_hash" { type = string default = null