terraformでElements of a set are identified only by their value and don’t have any separate index or key to select with, so it’s only possible to perform operations across all が出たらtolist()

現象

Error: Invalid index
records = [aws_acm_certificate.schoolbusit.domain_validation_options[0].resource_record_value]

解決

records = [tolist(aws_acm_certificate.schoolbusit.domain_validation_options)[0].resource_record_value]

参照元

https://github.com/hashicorp/terraform/issues/26043