我已在AWS ECS服务中为WSO2网关设置配置了服务发现。我能够手动成功完成所有操作,但是现在我需要为其创建云堆栈。当我查看AWS云形成文档时,分别有AWS :: ECS :: Service和AWS :: ServiceDiscovery :: Service,但是我不知道如何将AWS :: ECS :: Service与通过AWS创建的路由53 DNS链接: :ServiceDiscovery :: Service。有人可以帮我,因为我不知道如何从云堆栈中的ECS服务引用服务发现。
答案 0 :(得分:2)
答案 1 :(得分:1)
我不确定云的形成。但是在terraform中,您必须单独提及如下资源。
resource "aws_vpc" "example" {
cidr_block = "10.0.0.0/16"
}
resource "aws_service_discovery_private_dns_namespace" "example" {
name = "example.terraform.local"
description = "example"
vpc = "${aws_vpc.example.id}"
}
resource "aws_service_discovery_service" "example" {
name = "example"
dns_config {
namespace_id = "${aws_service_discovery_private_dns_namespace.example.id}"
dns_records {
ttl = 10
type = "A"
}
routing_policy = "MULTIVALUE"
}
health_check_custom_config {
failure_threshold = 1
}
}
参考:https://www.terraform.io/docs/providers/aws/r/service_discovery_service.html