From bd737d37a55500fc592cf31695458f4d3b3bb156 Mon Sep 17 00:00:00 2001 From: Michael Kania Date: Thu, 10 Dec 2020 14:51:00 -0800 Subject: [PATCH] update test to check for verification token --- README.md | 1 + examples/simple/main.tf | 2 +- examples/simple/outputs.tf | 3 +++ outputs.tf | 5 +++++ test/terraform_aws_ses_domain_test.go | 3 ++- 5 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 examples/simple/outputs.tf diff --git a/README.md b/README.md index 110b38e..77d3586 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,7 @@ data "aws_route53_zone" "SES_domain" { | Name | Description | |------|-------------| | ses\_identity\_arn | SES identity ARN. | +| ses\_verification\_token | A code which when added to the domain as a TXT record will signal to SES that the owner of the domain has authorised SES to act on their behalf. | diff --git a/examples/simple/main.tf b/examples/simple/main.tf index b61aa24..b454c67 100644 --- a/examples/simple/main.tf +++ b/examples/simple/main.tf @@ -129,7 +129,7 @@ resource "aws_route53_record" "temp_verification" { name = "_amazonses.${local.temp_domain}" type = "TXT" ttl = "600" - records = [var.test_name] + records = [module.ses_domain.ses_verification_token] } diff --git a/examples/simple/outputs.tf b/examples/simple/outputs.tf new file mode 100644 index 0000000..93aac97 --- /dev/null +++ b/examples/simple/outputs.tf @@ -0,0 +1,3 @@ +output "ses_verification_token" { + value = module.ses_domain.ses_verification_token +} diff --git a/outputs.tf b/outputs.tf index ebf8a63..30d6748 100644 --- a/outputs.tf +++ b/outputs.tf @@ -2,3 +2,8 @@ output "ses_identity_arn" { description = "SES identity ARN." value = aws_ses_domain_identity.main.arn } + +output "ses_verification_token" { + description = "A code which when added to the domain as a TXT record will signal to SES that the owner of the domain has authorised SES to act on their behalf." + value = aws_ses_domain_identity.main.verification_token +} diff --git a/test/terraform_aws_ses_domain_test.go b/test/terraform_aws_ses_domain_test.go index 3f7a77d..4388891 100644 --- a/test/terraform_aws_ses_domain_test.go +++ b/test/terraform_aws_ses_domain_test.go @@ -135,6 +135,7 @@ func TestTerraformSESDomainWithNoVerificationRecords(t *testing.T) { terraform.InitAndApply(t, terraformOptions) + verificationToken := terraform.Output(t, terraformOptions, "ses_verification_token") txtRecords, _ := net.LookupTXT(testDomain) - assert.Contains(t, txtRecords, testName) + assert.Contains(t, txtRecords, verificationToken) }