Skip to content

route53_record_name doesn't support empty string #415

Open
@birjj

Description

@birjj

Description

The input route53_record_name is described as follows (emphasis mine):

Name of Route53 record to create ACM certificate in and main A-record. If null is specified, var.name is used instead. Provide empty string to point root domain name to ALB.

However the code that actually uses it is as follows:

locals {
  route53_records = {
    A = {
      name    = try(coalesce(var.route53_record_name, var.name), "")
      type    = "A"
      zone_id = var.route53_zone_id
    }
    AAAA = {
      name    = try(coalesce(var.route53_record_name, var.name), "")
      type    = "AAAA"
      zone_id = var.route53_zone_id
    }
  }

Since the coalesce function in Terraform returns the first argument that isn't null or an empty string, setting route53_record_name to empty string will just use name instead...

Reproduction

module "atlantis" {
  source    = "git@github.com:terraform-aws-modules/terraform-aws-atlantis.git?ref=bd43a770af160e627fd2188598e3df60ce4faae3" # v4.4.0
  
  name = "my-atlantis"

  # ...

  route53_record_name = "" # this should cause the record to be created with empty name, but is actually ignored
}
  • ✋ I have searched the open/closed issues and my issue is not listed.

Expected behavior

The root domain of the Route54 zone is used.

Actual behavior

The name input is used as subdomain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions