I'm creating a bucket using a module, how can I find the ARN for that bucket?
create the module
module "testbucket" {
source = "github.com/tomfa/terraform-sandbox/s3-webfiles-bucket"
aws_region = "${var.aws_region}"
aws_access_key = "${var.aws_access_key}"
aws_secret_key = "${var.aws_secret_key}"
bucket_name = "${var.bucket_name}-test"
}
Then when I call the policy I need access to the ARN
{
"Sid": "accessToS3",
"Effect": "Allow",
"Action": [
"s3:*"
],
"Resource": [
"${aws_s3_bucket.${var.bucket_name}.arn}",
]
}
I am not referencing the ARN so i get the error:
Error: resource 'aws_iam_role_policy.policy_Demo_lambda' config: unknown resource 'aws_s3_bucket.mybukk' referenced in variable aws_s3_bucket.mybukk.arn
How to access my ARN? thanks