我有一个可创建多个存储桶的terraform代码,但是我不知道如何输出将要创建的所有存储桶的地址?
variable "s3_bucket_name" {
type = "list"
default = ["uniquebucket1", "uniquebucket2"]
}
resource "aws_s3_bucket" "newbuckets" {
count = "${length(var.s3_bucket_name)}"
bucket = "${var.s3_bucket_name[count.index]}"
}
output "bucket_name" {
value = "${aws_s3_bucket.newbuckets.*.bucket}"
}
输出不起作用,因为我想要存储桶的干净地址,而我得到的只是一个仅包含主要名称的数组。有人处理过吗?
谢谢,但是我得到的是这个-
Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Outputs:
bucket_name = [
uniquebucket1,
uniquebucket2
]