테라폼 환경 수정
This commit is contained in:
		
							
								
								
									
										10
									
								
								pord_dev_config/.terraform.lock.hcl
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								pord_dev_config/.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     = "4.48.0"
 | 
			
		||||
  constraints = "~> 4.0"
 | 
			
		||||
  hashes = [
 | 
			
		||||
    "h1:8xLCA04IhQUzGI8/t3ySKNFMyjgGCWiXRUWhWEsYvew=",
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										101
									
								
								pord_dev_config/main.tf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										101
									
								
								pord_dev_config/main.tf
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,101 @@
 | 
			
		||||
// prod - dev
 | 
			
		||||
provider "aws" {
 | 
			
		||||
  region = "ap-northeast-2"
 | 
			
		||||
 | 
			
		||||
  #4.x버전의 AWS공급자 허용
 | 
			
		||||
  version = "~> 4.0"
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
locals {
 | 
			
		||||
  common_tags = {
 | 
			
		||||
    project = "22shop_dev"
 | 
			
		||||
    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"]
 | 
			
		||||
 | 
			
		||||
  iam_name = {
 | 
			
		||||
    cloud9 = "cloud9"
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GET 계정정보
 | 
			
		||||
data "aws_caller_identity" "this" {}
 | 
			
		||||
 | 
			
		||||
// cloud9를 위한 iam역할 생성 데이터 조회
 | 
			
		||||
data "aws_iam_policy_document" "cloud9_role" {
 | 
			
		||||
  statement {
 | 
			
		||||
    actions = ["sts:AssumeRole"]
 | 
			
		||||
 | 
			
		||||
    principals {
 | 
			
		||||
      type        = "Service"
 | 
			
		||||
      identifiers = ["ec2.amazonaws.com"]
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# EKS테스트 할때 활성
 | 
			
		||||
module "ecr" {
 | 
			
		||||
    source = "../modules/ecr"
 | 
			
		||||
 | 
			
		||||
    names_list = ["web"]
 | 
			
		||||
    //names_list = ["web", "nginx", "mariadb"]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
// colud9 생성 및 추가
 | 
			
		||||
module "cloud9_iam" {
 | 
			
		||||
  source   = "../modules/iam"
 | 
			
		||||
  iam_name = local.iam_name.cloud9
 | 
			
		||||
  policy   = data.aws_iam_policy_document.cloud9_role.json
 | 
			
		||||
  tag_name = local.common_tags.project
 | 
			
		||||
}
 | 
			
		||||
module "cloud9_iam_att_admin_access" {
 | 
			
		||||
  source    = "../modules/iam-policy-attach"
 | 
			
		||||
  iam_name  = local.iam_name.cloud9
 | 
			
		||||
  role_name = module.cloud9_iam.iam_name
 | 
			
		||||
  arn       = "arn:aws:iam::aws:policy/AdministratorAccess"
 | 
			
		||||
 | 
			
		||||
  depends_on = [
 | 
			
		||||
    module.cloud9_iam
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// cloud9
 | 
			
		||||
module "cloud9_ec2" {
 | 
			
		||||
  source        = "../modules/cloud9-ec2"
 | 
			
		||||
  name          = local.common_tags.project
 | 
			
		||||
  instance_type = "t2.micro"
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
module "cloud9_ec2_env" {
 | 
			
		||||
  source    = "../modules/cloud9-ec2-env"
 | 
			
		||||
  cloud9_id = module.cloud9_ec2.cloud9_id
 | 
			
		||||
  permissions = "read-only"
 | 
			
		||||
  user_arn = module.cloud9_iam.iam_arn
 | 
			
		||||
 | 
			
		||||
  depends_on = [
 | 
			
		||||
    module.cloud9_iam,
 | 
			
		||||
    module.cloud9_ec2
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
*/
 | 
			
		||||
							
								
								
									
										0
									
								
								pord_dev_config/outputs.tf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										0
									
								
								pord_dev_config/outputs.tf
									
									
									
									
									
										Normal file
									
								
							
							
								
								
									
										10
									
								
								pord_dev_config/terraform.tf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								pord_dev_config/terraform.tf
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,10 @@
 | 
			
		||||
terraform {
 | 
			
		||||
  backend "remote"{
 | 
			
		||||
    hostname = "app.terraform.io"
 | 
			
		||||
    organization = "22shop"
 | 
			
		||||
 | 
			
		||||
    workspaces {
 | 
			
		||||
      name = "tf-cloud-dev"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										45
									
								
								pord_dev_config/variables.tf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										45
									
								
								pord_dev_config/variables.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.10.1.0/24"
 | 
			
		||||
    }
 | 
			
		||||
    "zone-c" = {
 | 
			
		||||
      name = "ap-northeast-2c"
 | 
			
		||||
      cidr = "10.10.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.10.2.0/24"
 | 
			
		||||
    }
 | 
			
		||||
    "zone-d" = {
 | 
			
		||||
      name = "ap-northeast-2d"
 | 
			
		||||
      cidr = "10.10.4.0/24"
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user