Skip to content

Choosing the right zone for each SAN when attaching validation records #62

@apanzerj

Description

@apanzerj

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

When you have two SANs that belong to different zones, the module tries to add validation records to the incorrect zone.

Expected Behavior

It should add validation records to zones:

foo.baz.bar.com and bar.com

Steps to Reproduce

Steps to reproduce the behavior:
Say you have these two zones:

zone 1: bar.com
zone 2: foo.baz.bar.com

You want a cert that allows you to use both zones so you do this:

module "acm_request_certificate_east_coast" {
  source = "cloudposse/acm-request-certificate/aws"

  domain_name                       = "foo.baz.bar.com"
  process_domain_validation_options = true
  ttl                               = "300"
  subject_alternative_names         = ["*.foo.baz.bar.com", "*.bar.com"]

  providers = {
    aws = aws.use1
  }
}

When I terraform apply, the module does a data lookup for the zone:

  • baz.bar.com

The expectation is that the zones it should look up:

  • foo.baz.bar.com
  • bar.com

Screenshots

N/A

Environment (please complete the following information):

Mac OS

Additional Notes

In chatting on Slack I suggested this:

Instead of trying to guess what zone to put each SAN in, just have the user specify it manually:

module "cert_request" {
  subject_alternative_names = [
    {
      zone_to_lookup = "foo.baz.com",
      names          = ["a.foo.baz.com", "b.foo.baz.com"]
    },
   {
      zone_to_lookup = "*.baz.com",
      names          = ["bob.baz.com", "alice.baz.com"]
    }
  ]
  # etc etc

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug🐛 An issue with the system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions