main.tf
provider "aws" {
region = "eu-west-2"
}
data "aws_caller_identity" "current" {}
resource "aws_s3_bucket" "bucket1" {
bucket = "${data.aws_caller_identity.current.account_id}-${var.bucket_name}" # interpolation
}
variable "bucket_name" {
default = "new-bucket-name"
}
output "created_bucket_name" {
value = aws_s3_bucket.bucket1.bucket
}