mirror of
https://github.com/jlengrand/engine.git
synced 2026-03-10 08:11:21 +00:00
80 lines
2.0 KiB
HCL
80 lines
2.0 KiB
HCL
locals {
|
|
tags_elasticsearch = merge(
|
|
local.tags_eks,
|
|
{
|
|
"Service" = "Elasticsearch"
|
|
}
|
|
)
|
|
}
|
|
|
|
# Network
|
|
|
|
resource "aws_subnet" "elasticsearch_zone_a" {
|
|
count = length(var.elasticsearch_subnets_zone_a)
|
|
|
|
availability_zone = data.aws_availability_zones.available.names[0]
|
|
cidr_block = var.elasticsearch_subnets_zone_a[count.index]
|
|
vpc_id = aws_vpc.eks.id
|
|
|
|
tags = local.tags_elasticsearch
|
|
}
|
|
|
|
resource "aws_subnet" "elasticsearch_zone_b" {
|
|
count = length(var.elasticsearch_subnets_zone_b)
|
|
|
|
availability_zone = data.aws_availability_zones.available.names[1]
|
|
cidr_block = var.elasticsearch_subnets_zone_b[count.index]
|
|
vpc_id = aws_vpc.eks.id
|
|
|
|
tags = local.tags_elasticsearch
|
|
}
|
|
|
|
resource "aws_subnet" "elasticsearch_zone_c" {
|
|
count = length(var.elasticsearch_subnets_zone_c)
|
|
|
|
availability_zone = data.aws_availability_zones.available.names[2]
|
|
cidr_block = var.elasticsearch_subnets_zone_c[count.index]
|
|
vpc_id = aws_vpc.eks.id
|
|
|
|
tags = local.tags_elasticsearch
|
|
}
|
|
|
|
resource "aws_route_table_association" "elasticsearch_cluster_zone_a" {
|
|
count = length(var.elasticsearch_subnets_zone_a)
|
|
|
|
subnet_id = aws_subnet.elasticsearch_zone_a.*.id[count.index]
|
|
route_table_id = aws_route_table.eks_cluster.id
|
|
}
|
|
|
|
resource "aws_route_table_association" "elasticsearch_cluster_zone_b" {
|
|
count = length(var.elasticsearch_subnets_zone_b)
|
|
|
|
subnet_id = aws_subnet.elasticsearch_zone_b.*.id[count.index]
|
|
route_table_id = aws_route_table.eks_cluster.id
|
|
}
|
|
|
|
resource "aws_route_table_association" "elasticsearch_cluster_zone_c" {
|
|
count = length(var.elasticsearch_subnets_zone_c)
|
|
|
|
subnet_id = aws_subnet.elasticsearch_zone_c.*.id[count.index]
|
|
route_table_id = aws_route_table.eks_cluster.id
|
|
}
|
|
|
|
resource "aws_security_group" "elasticsearch" {
|
|
name = "elasticsearch-${var.kubernetes_cluster_id}"
|
|
description = "Elasticsearch security group"
|
|
vpc_id = aws_vpc.eks.id
|
|
|
|
ingress {
|
|
from_port = 443
|
|
to_port = 443
|
|
protocol = "tcp"
|
|
|
|
cidr_blocks = [
|
|
aws_vpc.eks.cidr_block
|
|
]
|
|
}
|
|
|
|
tags = local.tags_elasticsearch
|
|
}
|