Loading...
Loading...
### Terraform Version ```shell 1.4.6 ``` ### Terraform Configuration Files ```terraform resource "aws_vpc_endpoint" "example" { service_network_arn = aws_vpclattice_service_network.example.arn subnet_ids = [aws_subnet.example.id] vpc_endpoint_type = "ServiceNetwork" vpc_id = aws_vpc.example.id private_dns_enabled = true } resource "aws_route53_record" "sn_endpoint_records" { zone_id = var.route53_internal_zone_id name = var.route53_internal_domain type = "CNAME" ttl = 300 records = aws_vpc_endpoint.example.dns_entry[0]["dns_name"] depends_on = [aws_vpc_endpoint.example] } ``` ### Debug Output ``` ...debug output, or link to a gist... ``` ### Expected Behavior When retrieving the DNS name of a VPC endpoint in Terraform, the DNS entry should be created and the correct DNS name should be returned after the entry is created. Specifically, aws_vpc_endpoint.example.dns_entry["dns_name"] should successfully retrieve the DNS name of the VPC endpoint. The expected behavior is as follows: 1. When a VPC endpoint is created with private_dns_enabled = true, the DNS entry should be generated. 2. Terraform should retrieve the DNS name from aws_vpc_endpoint.example.dns_entry after the DNS entry is created. 3. The retrieved DNS name should be correctly set in the Route53 record. ### Actual Behavior │ Error: Invalid index │ │ on ../_module/lattice-consumer/lattice.tf line 101, in resource "aws_route53_record" "sn_endpoint_records": │ 101: ][0] │ ├──────────────── │ │ aws_vpc_endpoint.example is object with 1 attribute "0" │ │ The given key does not identify an element in this collection value: the collection has no elements. ╵ ╷ │ Error: Invalid index │ │ on ../_module/lattice-consumer/lattice.tf line 101, in resource "aws_route53_record" "sn_endpoint_records": │ 101: ][0] │ ├──────────────── │ │ aws_vpc_endpoint.example is object with 1 attribute "0" │ │ The given key does not identify an element in this collection value: the collection has no elements. ### Steps to Reproduce terraform init terraform plan ### Additional Context The current issue is that the DNS entry is not immediately created, resulting in an empty list being returned or the DNS name not being correctly retrieved. Therefore, Terraform should successfully retrieve the DNS name after the DNS entry is created. ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.