Skip to content

Trouble adding multiple SANs with same zone as main domain #2

@jeffmacdonald

Description

@jeffmacdonald

This is a tricky one to explain because it's all over the place. I'm using version 1.0.4 of the module. It might be a collection of separate issues.

  1. Create a certificate with no SANs. (ie set subject_alternative_names to []) , then try adding an SAN. You'll get a lot of errors like this:
Error: Invalid index

  on .terraform/modules/certificate/main.tf line 45, in resource "aws_route53_record" "validation":
  45:   zone_id = lookup(local.zone_name_to_id_map, lookup(local.domain_to_zone_map, local.cert_validation_domains[count.index]["domain_name"]))
    |----------------
    | count.index is 1
    | local.cert_validation_domains is tuple with 1 element

The given key does not identify an element in this collection value.
  1. Create a cert with an SAN apply that. Then change the domain and zone in the SAN to something else. It seems it's a bit fragile and sort of blows up. In this example below "OLDDOMAIN.COM" is the domain I originally created in the first apply.
Error: Invalid function argument

  on .terraform/modules/certificate/main.tf line 45, in resource "aws_route53_record" "validation":
  45:   zone_id = lookup(local.zone_name_to_id_map, lookup(local.domain_to_zone_map, local.cert_validation_domains[count.index]["domain_name"]))
    |----------------
    | local.domain_to_zone_map is object with 2 attributes

Invalid value for "inputMap" parameter: the given object has no attribute
"jeff2.OLDDOMAIN.COM".

Sort of feels like that if you are using this module , it's safer to use it with a "set it and forget it" kind of mentality than being able to change things out. Is that something you've experienced and is sort of a known issue?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions