This template sets up a one-way trust relationship between two AWS Managed Microsoft AD domains, specifying incoming and outgoing trust directions.

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 = "One-Way: Incoming"
  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 = "One-Way: Outgoing"
  trust_password = "Some0therPassword"
}