This commit is contained in:
2023-01-06 13:29:00 +09:00
parent f537a31294
commit 9a60aa0f34
27 changed files with 389 additions and 225 deletions

View File

@ -6,20 +6,5 @@ provider "registry.terraform.io/hashicorp/aws" {
constraints = "~> 3.0"
hashes = [
"h1:OzcRXMb2MU7LOheOcCX4rMVffltsLIX3ENs84UzB2Kw=",
"zh:144ac5d606a9236564a9e2cfe4fde5f25c56c42d97108b5ef9f4ba68c367c17a",
"zh:1e8f594d094bd83e759aeed1f6b9d83d67bace36bcd0d5ddc48316e9c219d9f8",
"zh:1eb473010b250c083a7370e0ae43f9961f3c83678a4f5782981387d04f5f7491",
"zh:258ff4c1d204876dea485fac0856721cccf15b94361e7d56ea433fc6fbfc7dc6",
"zh:3cf323d1ebc797486c8b995b0e8d1093ec75e832308fe9dd52dccb8507af2b00",
"zh:5108ba908617ed6e89ac15defafbf9bc57b3ff098d0efdd10294bae1a5532daf",
"zh:54bd6fe57680b845bbf3f4f0cc9a20057973defcd7786390f1967bdbf7b58e1f",
"zh:5f1d06843997229616dc56cecae450e4165ecadb2b2f8206eb074babc09e8dbc",
"zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425",
"zh:a6a222eb9ac72ad4efd0f039cac3ffda35d0152e47e573da1aa6da272edb9413",
"zh:ad96cddae3ab78fa85095b7d82e09ed6b25ef099c58d18c1c14c75d5f5f1219c",
"zh:bf18dd6bd6a8eba83f9d55adeeeb14abeb2b63b4a05ac26fc15d1820d34ff9d2",
"zh:cace02539792163c90362998fae484f3b32869d0d148484c809d7c9e8086ac50",
"zh:d527fe5b1fa912a06134fa6be35a044d05ae69973b5ce5c1804466a167b4d3bc",
"zh:fad111579454ec38c3d51ad2422bf43b108f51f17d4db64e81f178b5fbfb2675",
]
}

View File

@ -8,7 +8,7 @@ provider "aws" {
}
locals {
vpc_id = data.terraform_remote_state.hq_vpc_id.outputs.vpc_id
vpc_id = data.terraform_remote_state.hq_vpc_id.outputs.vpc_id
public_subnet = data.terraform_remote_state.hq_vpc_id.outputs.subnet
common_tags = {
project = "22shop"
@ -16,7 +16,7 @@ locals {
}
tcp_port = {
any_port = 0
# any_port = 0
http_port = 80
https_port = 443
ssh_port = 22
@ -185,15 +185,15 @@ module "eks_cluster" {
iam_role_arn = module.eks_cluster_iam.iam_arn
sg_list = [module.eks_sg.sg_id]
# subnet_list = [module.subnet_public.subnet.zone-a.id, module.subnet_public.subnet.zone-c.id] #변경해야될수있음.
subnet_list = [local.public_subnet.zone-a.id, local.public_subnet.zone-c.id]
subnet_list = [local.public_subnet.zone-a.id, local.public_subnet.zone-c.id]
depends_on = [
module.eks_cluster_iam,
module.eks_sg,
]
client_id = data.aws_caller_identity.this.id
client_id = data.aws_caller_identity.this.id
}
module "eks_node_group" {
@ -203,7 +203,7 @@ module "eks_node_group" {
# iam_role_arn = module.eks_nodegroup_iam.iam_arn
iam_role_arn = "arn:aws:iam::448559955338:role/eks-nodegroup-test"
# subnet_list = [module.subnet_public.subnet.zone-a.id, module.subnet_public.subnet.zone-c.id] #변경해야될수있음.
subnet_list = [local.public_subnet.zone-a.id, local.public_subnet.zone-c.id]
subnet_list = [local.public_subnet.zone-a.id, local.public_subnet.zone-c.id]
desired_size = local.node_group_scaling_config.desired_size
max_size = local.node_group_scaling_config.max_size
@ -214,26 +214,21 @@ module "eks_node_group" {
module.eks_cluster,
]
}
# EKS테스트 할때 활성
# module "ecr" {
# source = "../modules/ecr"
# names_list = ["web", "nginx", "mariadb"]
# module "ng_sg_ingress_http" {
# # for_each = local.tcp_port
# source = "../modules/sg-rule-add"
# type = "ingress"
# from_port = "8080"
# to_port = "8080"
# protocol = local.tcp_protocol
# cidr_blocks = local.all_ips
# security_group_id = module.eks_node_group.ng_sg
# tag_name = "test"
# depends_on = [
# module.eks_node_group
# ]
# }
/*
terraform_remote_state reference method
terraform cloud
*/
# data "terraform_remote_state" "foo" {
# backend = "remote"
# config = {
# organization = "company"
# workspaces = {
# name = "workspace"
# }
# }
# }

View File

@ -3,6 +3,11 @@ output "aws_id" {
description = "The AWS Account ID."
value = data.aws_caller_identity.this.account_id
}
output "ng_sg" {
description = "Identifier of the remote access EC2 Security Group."
value = module.eks_node_group.ng_sg
}
# output "cluster_oidc" {
# description = "eks_cluster_identity"
# value = module.eks_cluster.cluster_oidc

View File

@ -4,7 +4,7 @@ terraform {
organization = "22shop"
workspaces {
name = "tf-cloud-backend"
name = "tf-cloud-eks"
}
}
}