Hi, I have a TF script that creates an AWS Simple Email Service (SES) domain verification entry, i.e. aws_ses_domain_identity and aws_ses_domain_dkim. The DKIM tokens are declared as an output, i.e. aws_ses_domain_dkim.northrow_domain_dkim.dkim_tokens. I am then reading the output as a remote state file, i.e. data “terraform_remote_state” “qa-common”.
When attempting to create the Route 53 records to authorise the SES domain, I’ve not been able to establish the exact syntax of the output. I am attempting to use the example given in the Terraform AWS documentation: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ses_domain_dkim#attributes-reference
The following script fails:
resource "aws_route53_record" "northrow_dkim" {
count = 3
zone_id = var.zone_id
name = "${element(data.terraform_remote_state.qa-common.northrow_domain_dkim, count.index)}._domainkey"
type = "CNAME"
ttl = "600"
records = ["${element(data.terraform_remote_state.qa-common.northrow_domain_dkim, count.index)}.dkim.amazonses.com"]
}
The error is:
│ Error: Unsupported attribute
│
│ on Route53.tf line 4, in resource "aws_route53_record" "northrow_dkim":
│ 4: name = "${element(data.terraform_remote_state.qa-common.northrow_domain_dkim, count.index)}._domainkey"
│
│ This object has no argument, nested block, or exported attribute named "northrow_domain_dkim".
╵
╷
│ Error: Unsupported attribute
│
│ on Route53.tf line 7, in resource "aws_route53_record" "northrow_dkim":
│ 7: records = ["${element(data.terraform_remote_state.qa-common.northrow_domain_dkim, count.index)}.dkim.amazonses.com"]
│
│ This object has no argument, nested block, or exported attribute named "northrow_domain_dkim".
If I add dkim_tokens to the path:
resource "aws_route53_record" "northrow_dkim" {
count = 3
zone_id = var.zone_id
name = "${element(data.terraform_remote_state.qa-common.northrow_domain_dkim.dkim_tokens, count.index)}._domainkey"
type = "CNAME"
ttl = "600"
records = ["${element(data.terraform_remote_state.qa-common.northrow_domain_dkim.dkim_tokens, count.index)}.dkim.amazonses.com"]
}
The error is:
│ Error: Unsupported attribute
│
│ on Route53.tf line 4, in resource "aws_route53_record" "northrow_dkim":
│ 4: name = "${element(data.terraform_remote_state.qa-common.northrow_domain_dkim.dkim_tokens, count.index)}._domainkey"
│
│ This object has no argument, nested block, or exported attribute named "northrow_domain_dkim".
╵
╷
│ Error: Unsupported attribute
│
│ on Route53.tf line 7, in resource "aws_route53_record" "northrow_dkim":
│ 7: records = ["${element(data.terraform_remote_state.qa-common.northrow_domain_dkim.dkim_tokens, count.index)}.dkim.amazonses.com"]
│
│ This object has no argument, nested block, or exported attribute named "northrow_domain_dkim".
Any help would be appreciated.