Skip to content

Commit

Permalink
Merge pull request #8586 from ministryofjustice/TM-610-add-env-prefix…
Browse files Browse the repository at this point in the history
…-efs-multi-env-setup

TM-610 add multienv naming to ldap efs
  • Loading branch information
pbasumatary authored Nov 7, 2024
2 parents 9f0801f + f733a2b commit af4e2b2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ module "efs" {
tags = var.tags
enable_platform_backups = var.enable_platform_backups

vpc_id = var.account_config.shared_vpc_id
subnet_ids = var.account_config.private_subnet_ids
vpc_cidr = var.account_config.shared_vpc_cidr
vpc_id = var.account_config.shared_vpc_id
subnet_ids = var.account_config.private_subnet_ids
vpc_cidr = var.account_config.shared_vpc_cidr
account_info = var.account_info
}
11 changes: 8 additions & 3 deletions terraform/environments/delius-core/modules/helpers/efs/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "aws_efs_file_system" "this" {

tags = merge(
var.tags,
{ Name = var.name },
{ Name = "${var.account_info.application_name}-${var.env_name}-${var.name}" },
var.enable_platform_backups != null ? { "backup" = var.enable_platform_backups ? "true" : "false" } : {}
)
}
Expand All @@ -23,19 +23,24 @@ resource "aws_efs_mount_target" "this" {
}

# module for efs access point
resource "aws_efs_access_point" "ldap" {
resource "aws_efs_access_point" "this" {
file_system_id = aws_efs_file_system.this.id
root_directory {
path = "/"
}
tags = merge(
var.tags,
{
Name = "${var.env_name}-${var.name}-efs-access-point"
Name = "${var.account_info.application_name}-${var.env_name}-efs-access-point"
}
)
}

moved {
from = aws_efs_access_point.ldap
to = aws_efs_access_point.this
}

# Security Group
resource "aws_security_group" "default" {
name = "${var.env_name}-${var.name}-efs"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ output "sg_arn" {
}

output "access_point_id" {
value = aws_efs_access_point.ldap.id
value = aws_efs_access_point.this.id
}

output "name" {
value = var.name
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,8 @@ variable "enable_platform_backups" {
type = bool
default = null
}

variable "account_info" {
description = "Account info to pass to the instance"
type = any
}

0 comments on commit af4e2b2

Please sign in to comment.