sg rule add

This commit is contained in:
2022-12-28 22:50:49 +09:00
parent 0b1946ecb3
commit 6fab570c69
6 changed files with 80 additions and 16 deletions

View File

@ -13,6 +13,22 @@ locals {
owner = "icurfer"
}
tcp_port = {
any_port = 0
http_port = 80
https_port = 443
ssh_port = 22
dns_port = 53
django_port = 8000
mysql_port = 3306
}
udp_port = {
dns_port = 53
}
any_protocol = "-1"
tcp_protocol = "tcp"
icmp_protocol = "icmp"
all_ips = ["0.0.0.0/0"]
}
// GET 계정정보
@ -164,9 +180,39 @@ module "eks_nodegroup_iam_att_3" {
module "eks_sg" {
source = "../modules/sg"
sg_name = "${local.common_tags.project}-sg"
vpc_id = module.vpc_hq.vpc_hq_id
depends_on = [
module.vpc_hq
]
}
module "eks_sg_ingress"
module "eks_sg_ingress_http" {
for_each = local.tcp_port
source = "../modules/sg-rule-add"
type = "ingress"
from_port = each.value
to_port = each.value
protocol = local.tcp_protocol
cidr_blocks = local.all_ips
security_group_id = module.eks_sg.sg_id
tag_name = each.key
}
module "eks_sg_egress_all" {
source = "../modules/sg-rule-add"
type = "egress"
from_port = local.any_protocol
to_port = local.any_protocol
protocol = local.any_protocol
cidr_blocks = local.all_ips
security_group_id = module.eks_sg.sg_id
tag_name = "egress-all"
}
# EKS테스트 할때 활성
# module "ecr" {
# source = "../modules/ecr"