This template configures a two-way trust relationship between two AWS Managed Microsoft AD domains, including conditional forwarders.

Terraform Template

resource "aws_directory_service_directory" "one" {
  name = "one.example.com"
  type = "MicrosoftAD"
}

resource "aws_directory_service_directory" "two" {
  name = "two.example.com"
  type = "MicrosoftAD"
}

resource "aws_directory_service_trust" "one" {
  conditional_forwarder_ip_addrs = aws_directory_service_directory.two.dns_ip_addresses
  directory_id = aws_directory_service_directory.one.id
  remote_domain_name = aws_directory_service_directory.two.name
  trust_direction = "Two-Way"
  trust_password = "Some0therPassword"
}

resource "aws_directory_service_trust" "two" {
  conditional_forwarder_ip_addrs = aws_directory_service_directory.one.dns_ip_addresses
  directory_id = aws_directory_service_directory.two.id
  remote_domain_name = aws_directory_service_directory.one.name
  trust_direction = "Two-Way"
  trust_password = "Some0therPassword"
}