我有一个全球Aurora集群,每天自动快照。我的DB实例如下所示:
new-test ( Global Database )
new-test-db ( Primary Cluster )
new-test-db-0 ( Writer Instance )我已经为数据库启用了自动快照。我想要实现的是使用ARN获取快照的data resource。我的ARN是这样的:
arn:aws:rds:us-west-2:123456789101:cluster-snapshot:rds:new-test-db-2022-08-23-08-06这就是我的data资源的样子:-
data "aws_db_cluster_snapshot" "db" {
for_each = toset(var.rds_sources)
db_cluster_identifier = each.key
most_recent = true
}其中var.rds_sources是一个字符串列表。但当我试图访问arn时,使用:-
data.aws_db_cluster_snapshot.db[*].db_cluster_snapshot_arn我总是碰上
Error: Unsupported attribute
│
│ on ../main.tf line 73, in resource "aws_iam_policy" "source_application":
│ 73: cluster_data_sources = jsonencode(data.aws_db_cluster_snapshot.db[*].db_cluster_snapshot_arn)
│
│ This object does not have an attribute named "db_cluster_snapshot_arn".这很奇怪,因为属性是在正式的文档中布局的。谢谢你的帮助。
这是我的提供者文件:-
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.75"
}
archive = "~> 2.2.0"
}
required_version = "~> 1.2.6"
}https://stackoverflow.com/questions/73694337
复制相似问题