Skip to content

Commit

Permalink
Fix : Update the condtional attribute for username -> user_name
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolnagpal committed Sep 4, 2023
1 parent 63c633f commit e2ac6e3
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ locals {
s3_arn_prefix = "arn:${one(data.aws_partition.default[*].partition)}:s3:::"
is_vpc = var.vpc_id != null

user_names = length(var.sftp_users) > 0 ? [for user in var.sftp_users : user.username] : []
user_names = length(var.sftp_users) > 0 ? [for user in var.sftp_users : user.user_name] : []

user_names_map = length(var.sftp_users) > 0 ? {
for user in var.sftp_users :
user.username => merge(user, {
user.user_name => merge(user, {
s3_bucket_arn = lookup(user, "s3_bucket_name", null) != null ? "${local.s3_arn_prefix}${lookup(user, "s3_bucket_name")}" : one(data.aws_s3_bucket.landing[*].arn)
})
} : {}
Expand Down Expand Up @@ -232,7 +232,7 @@ resource "aws_transfer_server" "transfer_server" {
##----------------------------------------------------------------------------------

resource "aws_transfer_user" "transfer_server_user" {
for_each = var.enabled ? { for user in var.sftp_users : user.username => user } : {}
for_each = var.enabled ? { for user in var.sftp_users : user.user_name => user } : {}

server_id = join("", aws_transfer_server.transfer_server[*].id)
role = aws_iam_role.s3_access_for_sftp_users[each.value.user_name].arn
Expand Down

0 comments on commit e2ac6e3

Please sign in to comment.