테라폼 설정파일테스트

This commit is contained in:
2022-12-28 14:24:56 +09:00
parent 72fb5351b6
commit 51d2505a1f
7 changed files with 26 additions and 5 deletions

1
prod-hq/.terraformrc Normal file
View File

@ -0,0 +1 @@
test

82
prod-hq/main.tf Normal file
View File

@ -0,0 +1,82 @@
// prod - main
terraform {
backend "remote"{
hostname = "app.terraform.io"
organization = "22shop"
workspaces {
name = "tf-cloud-backend"
}
}
}
provider "aws" {
region = "ap-northeast-2"
#2.x버전의 AWS공급자 허용
version = "~> 2.0"
}
locals {
common_tags = {
project = "22shop"
owner = "icurfer"
}
}
# 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 = "10.3.0.0/16"
}
module "vpc_igw" {
source = "../modules/igw"
vpc_id = module.vpc_hq.vpc_hq_id
tag_name = "${local.common_tags.project}-vpc_igw"
}
module "subnet_public" {
source = "../modules/vpc-subnet"
vpc_id = module.vpc_hq.vpc_hq_id
subnet-az-list = var.subnet-az-list
public_ip_on = true
vpc_name = "${local.common_tags.project}-public"
}
// 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]
}
# EKS테스트 할때 활성
# module "ecr" {
# source = "../modules/ecr"
# names_list = ["web", "nginx", "mariadb"]
# }

5
prod-hq/outputs.tf Normal file
View File

@ -0,0 +1,5 @@
//modules-subnet-outputs
output "subnet" {
description = "The name of vpc hq id"
value = module.subnet_public.subnet
}

40
prod-hq/valiables.tf Normal file
View File

@ -0,0 +1,40 @@
# 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-list" {
description = "Subnet available zone & cidr"
type = map(map(string))
default = {
"zone-a" = {
name = "ap-northeast-2a"
cidr = "10.3.1.0/24"
}
"zone-b" = {
name = "ap-northeast-2b"
cidr = "10.3.2.0/24"
}
"zone-c" = {
name = "ap-northeast-2c"
cidr = "10.3.3.0/24"
}
"zone-d" = {
name = "ap-northeast-2d"
cidr = "10.3.4.0/24"
}
}
}