Skip to content

Commit

Permalink
fixed s3 bucket accound id
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Bakhmetev committed Sep 16, 2024
1 parent 042e4eb commit 9f729ee
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tf-aws-s3-bucket/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ terraform {
}

data "aws_partition" "current" {}
data "aws_caller_identity" "current" {}

locals {
partition = join("", data.aws_partition.current[*].partition)

full_name = var.bucket_name != "" && !var.include_prefix ? var.bucket_name : "${module.name.id}-${var.bucket_name}"
bucket_name = var.include_account_id ? "${local.partition}-${local.full_name}" : local.full_name
bucket_name = var.include_account_id ? "${data.aws_caller_identity.current.account_id}-${local.full_name}" : local.full_name
bucket_id = join("", aws_s3_bucket.this[*].id)
bucket_arn = "arn:${local.partition}:s3:::${local.bucket_id}"
}
Expand Down

0 comments on commit 9f729ee

Please sign in to comment.