1

我正在使用 terraform 创建 AWS 资源。Terraform v0.11.3 provider.aws v1.11.0 provider.template v1.0.0

我想创建 Active Directory,并且能够成功地做到这一点。

现在我正在尝试使用 Route53 而不是 ActiveDirectory DNS。问题是在创建 Route53 区域时,所以我必须在 Route53 中创建 SRV 记录,它应该指向 Active Directory 域控制器。

我的问题是 terraform 只提供了域控制器的 IP 地址,但它没有告诉我域控制器的主机名。而我的 A 记录需要域控制器的主机名。

    resource "aws_directory_service_directory" "MyActiveDirectory" {
       name       = "${var.DOMAINNAME}"
       password   = "${var.DOMAINADMINPASSWORD}"
       size       = "${var.DOMAINSIZE}"
       vpc_settings {
       vpc_id     = "${aws_vpc.MyVpc.id}"
       subnet_ids = ["${aws_subnet.PvtSubnetA.id}","${aws_subnet.PvtSubnetB.id}"]
    } 
}
4

1 回答 1

1

You can pretty much set the hostnames to anything you like. For example:

resource "aws_route53_record" "foo" {
  zone_id = "${aws_route53_zone.id}"
  name    = "foo"
  type    = "A"
  ttl     = "300"
  records = ["${aws_directory_service_directory.MyActiveDirectory.dns_ip_addresses}"]
}

Things that auto-discover the domain will use the SRV records, but for then in anything that needs to know the address of the AD server(s) you can just use the foo name.

于 2018-08-02T15:28:03.943 回答