Skip to content

Commit

Permalink
Ensure that S3 bucket names are globally unique for aws.persistence.l…
Browse files Browse the repository at this point in the history
…ambda-layer-extension (#465)
  • Loading branch information
christophetd authored Jan 23, 2024
1 parent 31ea1aa commit 96088a5
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,18 @@ resource "aws_iam_role_policy_attachment" "lambda_logs_attach" {
policy_arn = aws_iam_policy.lambda_logs.arn
}


resource "random_string" "suffix" {
length = 6
min_lower = 6
special = false
}

resource "aws_s3_bucket" "bucket" {
bucket = "${local.resource_prefix}-bucket"
bucket = "${local.resource_prefix}-${random_string.suffix.result}"
force_destroy = true
}

resource "aws_s3_bucket_object" "code" {
bucket = aws_s3_bucket.bucket.id
key = "simpleLambda.zip"
Expand Down

0 comments on commit 96088a5

Please sign in to comment.