Terraform v0.11.0
# external DNS zone. not managed by TF
data "aws_route53_zone" "external_dns" {
count = "${var.global["use_route53"] ? 1 : 0 }"
name = "myfoobar.net"
}
output "external_dns_zone_id" {
value = "${element(concat(aws_route53_zone.external_dns.*.zone_id, list("")), 0)}"
}
This should work as documented in the 0.11 upgrade guide. https://www.terraform.io/upgrade-guides/0-11.html
Error: module root:
module ayla_tf.root: 1 error(s) occurred:
terraform initterraform applyThis domain is not controlled by TF. So I use it as a Data, not a Resource.
AWS China doesn't have Route 53, so I have to exclude it (if you are curious about the use case.)
For Resource, this idiom does work. But for Data Source, it doesn't work. I have not been able to find a workaround yet. Staying with 0.10.8 is probably the only way out.
Hi @hoffmannliu-ayla,
The example in the upgrade guide is for a resource block. Data resources (declared withdata blocks) are a separate namespace that needs a data. prefix to be included when referencing it, like this:
output "external_dns_zone_id" {
value = "${element(concat(data.aws_route53_zone.external_dns.*.zone_id, list("")), 0)}"
}
Yes. You are right. My bad. Didn't notice that.
Thanks for your help and clarification. It works with 0.11.0. I can close this "issue" now.
I'm going to lock this issue because it has been closed for _30 days_ โณ. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
Most helpful comment
Hi @hoffmannliu-ayla,
The example in the upgrade guide is for a
resourceblock. Data resources (declared withdatablocks) are a separate namespace that needs adata.prefix to be included when referencing it, like this: