-
Notifications
You must be signed in to change notification settings - Fork 10
/
ecs-service-discovery.tf
38 lines (31 loc) · 1.11 KB
/
ecs-service-discovery.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/**
* Copyright (C) 2018-2019 Expedia Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
*/
resource "aws_service_discovery_private_dns_namespace" "waggledance" {
count = var.wd_instance_type == "ecs" && var.enable_autoscaling == false ? 1 : 0
name = "${local.instance_alias}-${var.aws_region}.${var.domain_extension}"
vpc = var.vpc_id
}
resource "aws_service_discovery_service" "metastore_proxy" {
count = var.wd_instance_type == "ecs" && var.enable_autoscaling == false ? 1 : 0
name = "metastore-proxy"
dns_config {
namespace_id = aws_service_discovery_private_dns_namespace.waggledance[0].id
dns_records {
ttl = 10
type = "A"
}
routing_policy = "MULTIVALUE"
}
health_check_custom_config {
failure_threshold = 1
}
}
resource "aws_route53_zone_association" "secondary" {
count = var.wd_instance_type == "ecs" && var.enable_autoscaling == false ? length(var.secondary_vpcs) : 0
zone_id = aws_service_discovery_private_dns_namespace.waggledance[0].hosted_zone
vpc_id = var.secondary_vpcs[count.index]
vpc_region = var.aws_region
}