【发布时间】:2021-02-17 05:59:58
【问题描述】:
我正在使用 AWS Route53 解析器将发送到内部域列表(本地)的 DNS 请求转发。通过terraform,我想将我创建的规则分享给公司的其他账户,所以我有以下内容:
# I create as much share endpoint as domain I have, so If I have 30 domains, I'll make 30 endpoint RAM:
resource "aws_ram_resource_share" "endpoint_share" {
count = length(var.forward_domain)
name = "route53-${var.forward_domain[count.index]}-share"
allow_external_principals = false
}
# Here I share every single endpoint with all the AWS ACcount we have
resource "aws_ram_principal_association" "endpoint_ram_principal" {
count = length(var.resource_share_accounts)
principal = var.resource_share_accounts[count.index]
resource_share_arn = {
for item in aws_ram_resource_share.endpoint_share[*]:
item.arn
}
}
最后一个块,调用第一个块的 arn 输出,它是一个列表。 现在,最后一个块不起作用,我不知道如何使用多个计数,当我运行它时,我收到以下错误:
Error: Invalid 'for' expression
line 37: Key expression is required when building an object.
知道如何进行这项工作吗?
Terraform version: 0.12.23
【问题讨论】:
标签: amazon-web-services amazon-route53 terraform-provider-aws