Skip to content

feat: DNS provisioning updates#218

Open
aliziel wants to merge 2 commits into
mainfrom
feat/dns-updates
Open

feat: DNS provisioning updates#218
aliziel wants to merge 2 commits into
mainfrom
feat/dns-updates

Conversation

@aliziel

@aliziel aliziel commented May 9, 2026

Copy link
Copy Markdown
Collaborator

Context

Pre-transfer, the atlas-assistant.ds.io hosted zone was owned by the project account (subdomain delegated authority). The DNS records to be used post-transfer are managed in a separate AWS account, which changes the build requirements.

AWS needs a certificate in the account where its being used, i.e. a domain used in multiple accounts can't 'share' a certificate through remote lookups.

One option is to import a certificate, which comes with some maintenance overhead (plus additional charges for AWS-issued certificates). Another option is to request a new certificate for the domain in each region or account needed, which is what we're doing here.

Description

Shorthand to help outline changes:
Account A = transferred project account ending in -9759
Account B = AWS account that owns the relevant Route 53 records (i.e. DNS authority for adaptationatlas.cgiar.org)

  1. Adds additional provider configuration to access Account B's Route 53 records1
    1. All provisioning will default to Account A unless specifically configured
  2. Looks up hosted zone in Account B to provision certificate
  3. Adds DNS validation to Account B hosted zone
  4. Adds atlas-assistant-api alias/A record to Account B hosted zone, routing to Account A load balancer

Let me know if modifications are needed based on the inferred DNS setup.

Note

Create role in authoritative DNS account and add to environment before merging, see below1

Footnotes

  1. A role will need to be created in Account B and plugged into the DNS_ACCOUNT_ROLE_ARN GitHub Actions variable
    - The role should have Route 53 write access
    - The trust policy should allow Account A to assume the role 2

Comment thread terraform/aws/alb.tf
Comment on lines -70 to +83
route53_records = {
A = {
name = "api"
type = "A"
zone_id = data.aws_route53_zone.ecs_domain.id
}
}

tags = var.tags
}

resource "aws_route53_record" "atlas_assistant_api" {
provider = aws.dns
zone_id = data.aws_route53_zone.ecs_domain.zone_id
name = var.api_subdomain
type = "A"
alias {
name = module.alb.dns_name
zone_id = module.alb.zone_id
evaluate_target_health = true
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, the api portion of api.atlas-assistant.ds.io was automatically created by the load balancer module, which assumes DNS lives in the same account.

Provisioning separately allows explicit reference to another provider (account).

Comment thread terraform/aws/acm.tf
Comment on lines +18 to +39
validation_method = "DNS"
create_route53_records = false
validation_record_fqdns = module.route53_validation.validation_route53_record_fqdns
}

module "route53_validation" {
source = "terraform-aws-modules/acm/aws"
version = "~> 6.2.0"

providers = {
aws = aws.dns
}

create_certificate = false
create_route53_records_only = true
validation_method = "DNS"

zone_id = data.aws_route53_zone.ecs_domain.zone_id
distinct_domain_names = module.acm.distinct_domain_names

acm_certificate_domain_validation_options = module.acm.acm_certificate_domain_validation_options
}

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar to #218 (comment), the certificate manager module automatically handles DNS validation, but assumes the certificate is being issued in the DNS authority account.

Using same module and pointing to separate accounts to propagate DNS validation to correct place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant