Quantcast
Channel: Terraform - HashiCorp Discuss
Viewing all articles
Browse latest Browse all 11363

Error validate cname records with aws

$
0
0

Hello everyone,

we have a problem with some of our terraform modules.
This module was written to create in aws some acm and it’s route53 records.

It was working now more than a year but suddenly it crashes now all the time at the validation of the cname records.

Here the code:

resource “aws_route53_record” “route53_record” {
count = length(local.sub_domains) + 1
name = lookup(aws_acm_certificate.certificate.domain_validation_options[count.index], “resource_record_name”)
type = lookup(aws_acm_certificate.certificate.domain_validation_options[count.index], “resource_record_type”)
zone_id = var.hosted_zone_id
records = [lookup(aws_acm_certificate.certificate.domain_validation_options[count.index], “resource_record_value”)]
ttl = var.ttl
}

The local.sub_domains is an array of exactly 9 record names.

We will get following error messages:

Error: Invalid index

on .terraform/modules/acm/acm_stage/main.tf line 86, in resource “aws_route53_record” “route53_record”:
86: records = [lookup(aws_acm_certificate.certificate.domain_validation_options[count.index], “resource_record_value”)]
|----------------
| aws_acm_certificate.certificate.domain_validation_options is set of object with 10 elements
| count.index is 6

This value does not have any indices.

This message is popping up 10 times for each lookup and with different “count.index is x”.
Why this is not working anymore? What can cause this error?

Thanks in advance for your help!

Greetings
Daniel

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 11363

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>