data "aws_billing_service_account" "main" {} data "template_file" "billing-s3-bucket-name" { template = "${file("${path.module}/templates/billing-s3-bucket-name.json.tpl")}" vars { bucket_name = "${lookup(local.workspace-dps-s3-cloudtrail-bucket,terraform.workspace,"")}" aws_billing_service_account_arn = "${data.aws_billing_service_account.main.arn}" } } resource "aws_s3_bucket" "billing_logs" { bucket = "${lookup(local.workspace-dps-s3-cloudtrail-bucket,terraform.workspace,"")}" acl = "private" policy = "${var.billing_s3_bucket_policy}" }