test
This commit is contained in:
10
prod-hq-idc-network/.terraform.lock.hcl
generated
Normal file
10
prod-hq-idc-network/.terraform.lock.hcl
generated
Normal file
@ -0,0 +1,10 @@
|
||||
# This file is maintained automatically by "terraform init".
|
||||
# Manual edits may be lost in future updates.
|
||||
|
||||
provider "registry.terraform.io/hashicorp/aws" {
|
||||
version = "3.76.0"
|
||||
constraints = "~> 3.0"
|
||||
hashes = [
|
||||
"h1:OzcRXMb2MU7LOheOcCX4rMVffltsLIX3ENs84UzB2Kw=",
|
||||
]
|
||||
}
|
117
prod-hq-idc-network/main.tf
Normal file
117
prod-hq-idc-network/main.tf
Normal file
@ -0,0 +1,117 @@
|
||||
// prod - main
|
||||
provider "aws" {
|
||||
region = "ap-northeast-2"
|
||||
|
||||
#2.x버전의 AWS공급자 허용
|
||||
version = "~> 3.0"
|
||||
|
||||
}
|
||||
|
||||
locals {
|
||||
region = "ap-northeast-2"
|
||||
common_tags = {
|
||||
project = "22shop-hq-idc"
|
||||
owner = "icurfer"
|
||||
}
|
||||
cidr = {
|
||||
vpc = "10.4.0.0/16"
|
||||
zone_a = "10.4.1.0/24"
|
||||
zone_c = "10.4.3.0/24"
|
||||
}
|
||||
tcp_port = {
|
||||
any_port = 0
|
||||
http_port = 80
|
||||
https_port = 443
|
||||
ssh_port = 22
|
||||
dns_port = 53
|
||||
django_port = 8000
|
||||
mysql_port = 3306
|
||||
nfs_port = 2049
|
||||
}
|
||||
udp_port = {
|
||||
dns_port = 53
|
||||
}
|
||||
any_protocol = "-1"
|
||||
tcp_protocol = "tcp"
|
||||
icmp_protocol = "icmp"
|
||||
all_ips = ["0.0.0.0/0"]
|
||||
}
|
||||
|
||||
// GET 계정정보
|
||||
data "aws_caller_identity" "this" {}
|
||||
|
||||
// eks를 위한 iam역할 생성 데이터 조회
|
||||
# data "aws_iam_policy_document" "eks-assume-role-policy" {
|
||||
# statement {
|
||||
# actions = ["sts:AssumeRole"]
|
||||
|
||||
# principals {
|
||||
# type = "Service"
|
||||
# identifiers = ["eks.amazonaws.com"]
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
|
||||
# module "vpc_hq" {
|
||||
module "vpc_hq" {
|
||||
source = "../modules/vpc"
|
||||
# source = "github.com/Seong-dong/team_prj/tree/main/modules/vpc"
|
||||
tag_name = "${local.common_tags.project}-vpc"
|
||||
cidr_block = local.cidr.vpc
|
||||
|
||||
}
|
||||
|
||||
module "vpc_igw" {
|
||||
source = "../modules/igw"
|
||||
|
||||
vpc_id = module.vpc_hq.vpc_hq_id
|
||||
|
||||
tag_name = "${local.common_tags.project}-vpc_igw"
|
||||
|
||||
depends_on = [
|
||||
module.vpc_hq
|
||||
]
|
||||
}
|
||||
|
||||
module "subnet_public" {
|
||||
source = "../modules/vpc-subnet"
|
||||
|
||||
vpc_id = module.vpc_hq.vpc_hq_id
|
||||
# subnet-az-list = var.subnet-az-public
|
||||
subnet-az-list = {
|
||||
"zone-a" = {
|
||||
name = "${local.region}a"
|
||||
cidr = local.cidr.zone_a
|
||||
}
|
||||
"zone-c" = {
|
||||
name = "${local.region}c"
|
||||
cidr = local.cidr.zone_c
|
||||
}
|
||||
}
|
||||
public_ip_on = true
|
||||
# vpc_name = "${local.common_tags.project}-public"
|
||||
#alb-ingress 생성을 위해 지정
|
||||
vpc_name = "${local.common_tags.project}-vpc"
|
||||
}
|
||||
|
||||
// public route
|
||||
module "route_public" {
|
||||
source = "../modules/route-table"
|
||||
tag_name = "${local.common_tags.project}-route_table"
|
||||
vpc_id = module.vpc_hq.vpc_hq_id
|
||||
|
||||
}
|
||||
|
||||
module "route_add" {
|
||||
source = "../modules/route-add"
|
||||
route_public_id = module.route_public.route_public_id
|
||||
igw_id = module.vpc_igw.igw_id
|
||||
}
|
||||
|
||||
module "route_association" {
|
||||
source = "../modules/route-association"
|
||||
route_table_id = module.route_public.route_public_id
|
||||
|
||||
association_count = 2
|
||||
subnet_ids = [module.subnet_public.subnet.zone-a.id, module.subnet_public.subnet.zone-c.id]
|
||||
}
|
16
prod-hq-idc-network/outputs.tf
Normal file
16
prod-hq-idc-network/outputs.tf
Normal file
@ -0,0 +1,16 @@
|
||||
//main-outputs
|
||||
output "aws_id" {
|
||||
description = "The AWS Account ID."
|
||||
value = data.aws_caller_identity.this.account_id
|
||||
}
|
||||
|
||||
output "subnet" {
|
||||
description = "The name of vpc hq id"
|
||||
value = module.subnet_public.subnet
|
||||
}
|
||||
|
||||
output "vpc_id" {
|
||||
description = "vpc_id"
|
||||
value = module.vpc_hq.vpc_hq_id
|
||||
|
||||
}
|
10
prod-hq-idc-network/terraform.tf
Normal file
10
prod-hq-idc-network/terraform.tf
Normal file
@ -0,0 +1,10 @@
|
||||
terraform {
|
||||
backend "remote"{
|
||||
hostname = "app.terraform.io"
|
||||
organization = "22shop"
|
||||
|
||||
workspaces {
|
||||
name = "tf-22shop-idc-network"
|
||||
}
|
||||
}
|
||||
}
|
45
prod-hq-idc-network/valiables.tf
Normal file
45
prod-hq-idc-network/valiables.tf
Normal file
@ -0,0 +1,45 @@
|
||||
# variable "cidr_block" {
|
||||
# type = string
|
||||
# default = "10.3.0.0/16"
|
||||
|
||||
# }
|
||||
|
||||
variable "prod_name" {
|
||||
description = "value"
|
||||
type = string
|
||||
default = "22shop"
|
||||
}
|
||||
|
||||
# variable "igw_id" {
|
||||
# description = "value"
|
||||
# type = string
|
||||
# }
|
||||
|
||||
# variable "subnet-az-public" {
|
||||
# description = "Subnet available zone & cidr"
|
||||
# type = map(map(string))
|
||||
# default = {
|
||||
# "zone-a" = {
|
||||
# name = "ap-northeast-2a"
|
||||
# cidr = "10.3.1.0/24"
|
||||
# }
|
||||
# "zone-c" = {
|
||||
# name = "ap-northeast-2c"
|
||||
# cidr = "10.3.3.0/24"
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
variable "subnet-az-private" {
|
||||
description = "Subnet available zone & cidr"
|
||||
type = map(map(string))
|
||||
default = {
|
||||
"zone-b" = {
|
||||
name = "ap-northeast-2b"
|
||||
cidr = "10.3.2.0/24"
|
||||
}
|
||||
"zone-d" = {
|
||||
name = "ap-northeast-2d"
|
||||
cidr = "10.3.4.0/24"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user