diff --git a/.gitignore b/.gitignore index 4af00a5..9b69782 100644 --- a/.gitignore +++ b/.gitignore @@ -39,8 +39,3 @@ out/ /config.yml /src/main/resources/logback.xml docker-compose.yml - -### terraform ### -.terraform/ -*.tfstate -*.tfstate.* \ No newline at end of file diff --git a/terraform-bootstrap/.terraform.lock.hcl b/terraform-bootstrap/.terraform.lock.hcl deleted file mode 100644 index 2c4a697..0000000 --- a/terraform-bootstrap/.terraform.lock.hcl +++ /dev/null @@ -1,26 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.54.1" - constraints = "5.54.1" - hashes = [ - "h1:+aq386lQCaPX7wR6EPf3PPZvCiI6dRwnjb1wR6lNa8E=", - "h1:h6AA+TgBpDNQXFcLi4xKYiDbn94Dfhz7lt8Q8x8CEI8=", - "zh:37c09b9a0a0a2f7854fe52c6adb15f71593810b458a8283ed71d68036af7ba3a", - "zh:42fe11d87723d4e43b9c6224ae6bacdcb53faee8abc58f0fc625a161d1f71cb1", - "zh:57c6dfc46f28c9c2737559bd84acbc05aeae90431e731bb72a0024028a2d2412", - "zh:5ba9665a4ca0e182effd75575b19a4d47383ec02662024b9fe26f78286c36619", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:b55980be0237644123a02a30b56d4cc03863ef29036c47d6e8ab5429ab45adf5", - "zh:b81e7664f10855a3a6fc234a18b4c4f1456273126a40c41516f2061696fb9870", - "zh:bd09736ffafd92af104c3c34b5add138ae8db4402eb687863ce472ca7e5ff2e2", - "zh:cc2eb1c62fba2a11d1f239e650cc2ae94bcab01c907384dcf2e213a6ee1bd5b2", - "zh:e5dc40205d9cf6f353c0ca532ae29afc6c83928bc9bcca47d74b640d3bb5a38c", - "zh:ebf1acdcd13f10db1b9c85050ddaadc70ab269c47c5a240753362446442d8371", - "zh:f2fc28a4ad94af5e6144a7309286505e3eb7a94d9dc106722b506c372ff7f591", - "zh:f49445e8435944df122aa89853260a2716ba8b73d6a6a70cae1661554926d5a2", - "zh:fc3b5046e60ae7cab20715be23de8436eb12736136fd6d0f0cc1549ebda6cc73", - "zh:fdb98a53500e245a3b5bec077b994da6959dba8fc4eb7534528658d820e06bd5", - ] -} diff --git a/terraform-bootstrap/main.tf b/terraform-bootstrap/main.tf deleted file mode 100644 index 2630dda..0000000 --- a/terraform-bootstrap/main.tf +++ /dev/null @@ -1,80 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "5.54.1" - } - } -} - -provider "aws" { - region = "ap-northeast-2" -} - -resource "aws_s3_bucket" "issuefy_bucket" { - bucket = "issuefy-prod-terraform-state-ap-northeast-2" - force_destroy = false - - tags = { - Name = "issuefy-prod-terraform-state-ap-northeast-2" - Environment = "prod" - Owner = "2024-iris" - Project = "issuefy" - Service = "infrastructure" - } -} - -resource "aws_s3_bucket_versioning" "issuefy_bucket_versioning" { - bucket = aws_s3_bucket.issuefy_bucket.id - - versioning_configuration { - status = "Enabled" - } -} - -resource "aws_s3_bucket_lifecycle_configuration" "issuefy_bucket_lifecycle" { - bucket = aws_s3_bucket.issuefy_bucket.id - - rule { - id = "state-file-lifecycle" - status = "Enabled" - - abort_incomplete_multipart_upload { - days_after_initiation = 7 - } - - noncurrent_version_expiration { - noncurrent_days = 90 - } - } -} - -resource "aws_dynamodb_table" "terraform_lock" { - name = "issuefy-terraform-lock" - billing_mode = "PAY_PER_REQUEST" - hash_key = "LockID" - - attribute { - name = "LockID" - type = "S" - } - - tags = { - Name = "issuefy-terraform-lock" - Environment = "prod" - Owner = "2024-iris" - Project = "issuefy" - Service = "infrastructure" - } -} - -module "ecr" { - source = "../terraform/modules/ecr" - - for_each = var.ecr_repositories - - repository_name = each.key - scan_on_push = each.value.scan_on_push - image_tag_mutability = each.value.image_tag_mutability - tags = each.value.tags -} \ No newline at end of file diff --git a/terraform-bootstrap/terraform.tfvars b/terraform-bootstrap/terraform.tfvars deleted file mode 100644 index 7fe53d3..0000000 --- a/terraform-bootstrap/terraform.tfvars +++ /dev/null @@ -1,25 +0,0 @@ -ecr_repositories = { - issuefy-was = { - scan_on_push = false - image_tag_mutability = "MUTABLE" - tags = { - Service = "was" - } - } - - issuefy-prometheus = { - scan_on_push = false - image_tag_mutability = "MUTABLE" - tags = { - Service = "prometheus" - } - } - - issuefy-web = { - scan_on_push = false - image_tag_mutability = "MUTABLE" - tags = { - Service = "web" - } - } -} diff --git a/terraform-bootstrap/variavles.tf b/terraform-bootstrap/variavles.tf deleted file mode 100644 index 5fe00a2..0000000 --- a/terraform-bootstrap/variavles.tf +++ /dev/null @@ -1,7 +0,0 @@ -variable "ecr_repositories" { - type = map(object({ - scan_on_push = bool - image_tag_mutability = string - tags = map(string) - })) -} diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl deleted file mode 100644 index 2c4a697..0000000 --- a/terraform/.terraform.lock.hcl +++ /dev/null @@ -1,26 +0,0 @@ -# This file is maintained automatically by "terraform init". -# Manual edits may be lost in future updates. - -provider "registry.terraform.io/hashicorp/aws" { - version = "5.54.1" - constraints = "5.54.1" - hashes = [ - "h1:+aq386lQCaPX7wR6EPf3PPZvCiI6dRwnjb1wR6lNa8E=", - "h1:h6AA+TgBpDNQXFcLi4xKYiDbn94Dfhz7lt8Q8x8CEI8=", - "zh:37c09b9a0a0a2f7854fe52c6adb15f71593810b458a8283ed71d68036af7ba3a", - "zh:42fe11d87723d4e43b9c6224ae6bacdcb53faee8abc58f0fc625a161d1f71cb1", - "zh:57c6dfc46f28c9c2737559bd84acbc05aeae90431e731bb72a0024028a2d2412", - "zh:5ba9665a4ca0e182effd75575b19a4d47383ec02662024b9fe26f78286c36619", - "zh:9b12af85486a96aedd8d7984b0ff811a4b42e3d88dad1a3fb4c0b580d04fa425", - "zh:b55980be0237644123a02a30b56d4cc03863ef29036c47d6e8ab5429ab45adf5", - "zh:b81e7664f10855a3a6fc234a18b4c4f1456273126a40c41516f2061696fb9870", - "zh:bd09736ffafd92af104c3c34b5add138ae8db4402eb687863ce472ca7e5ff2e2", - "zh:cc2eb1c62fba2a11d1f239e650cc2ae94bcab01c907384dcf2e213a6ee1bd5b2", - "zh:e5dc40205d9cf6f353c0ca532ae29afc6c83928bc9bcca47d74b640d3bb5a38c", - "zh:ebf1acdcd13f10db1b9c85050ddaadc70ab269c47c5a240753362446442d8371", - "zh:f2fc28a4ad94af5e6144a7309286505e3eb7a94d9dc106722b506c372ff7f591", - "zh:f49445e8435944df122aa89853260a2716ba8b73d6a6a70cae1661554926d5a2", - "zh:fc3b5046e60ae7cab20715be23de8436eb12736136fd6d0f0cc1549ebda6cc73", - "zh:fdb98a53500e245a3b5bec077b994da6959dba8fc4eb7534528658d820e06bd5", - ] -} diff --git a/terraform/backend.tf b/terraform/backend.tf deleted file mode 100644 index b16f37b..0000000 --- a/terraform/backend.tf +++ /dev/null @@ -1,9 +0,0 @@ -terraform { - backend "s3" { - bucket = "issuefy-prod-terraform-state-ap-northeast-2" - key = "prod/terraform.tfstate" - region = "ap-northeast-2" - encrypt = true - dynamodb_table = "issuefy-terraform-lock" - } -} diff --git a/terraform/locals.tf b/terraform/locals.tf deleted file mode 100644 index 2ad8873..0000000 --- a/terraform/locals.tf +++ /dev/null @@ -1,314 +0,0 @@ -locals { - instance_subnet_map = { - prod = module.vpc.public_subnet_ids[0] - monitoring = module.vpc.public_subnet_ids[1] - nat = module.vpc.public_subnet_ids[0] - } -} - -locals { - iam_roles = { - "ec2-to-ecs" = { - assume_role_services = ["ec2.amazonaws.com"] - policy_arns = [ - "arn:aws:iam::aws:policy/service-role/AmazonEC2ContainerServiceforEC2Role", - "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess", - "arn:aws:iam::aws:policy/AmazonECS_FullAccess" - ] - tags = { - Purpose = "ECS EC2 Registration" - } - } - - "ecsTaskExecutionRole" = { - assume_role_services = ["ecs-tasks.amazonaws.com"] - policy_arns = [ - "arn:aws:iam::aws:policy/service-role/AmazonECSTaskExecutionRolePolicy" - ] - tags = { - Purpose = "ECS Task Execution" - } - } - - "ec2-monitoring" = { - assume_role_services = ["ec2.amazonaws.com"] - policy_arns = [ - "arn:aws:iam::aws:policy/AmazonEC2ReadOnlyAccess", - "arn:aws:iam::aws:policy/AmazonS3FullAccess" - ] - tags = { - Purpose = "EC2 Instance Monitoring" - } - } - } -} - -locals { - instance_profiles = { - for name, mod in module.iam_roles : - name => mod.instance_profile_name - } - - enriched_instance_definitions = { - for name, def in var.instance_definitions : - name => merge(def, { - key_name = def.key_name, - user_data = def.user_data, - iam_instance_profile = ( - def.iam_instance_profile != null - ? ( - contains(keys(local.instance_profiles), def.iam_instance_profile) - ? local.instance_profiles[def.iam_instance_profile] - : null - ) - : null - ) - }) - } -} - - -locals { - listeners = { - web = { - port = 3000 - protocol = "HTTP" - target_group_arn = module.alb_target_group.target_group_arns["monitor"] - } - - prometheus = { - port = 9090 - protocol = "HTTP" - target_group_arn = module.alb_target_group.target_group_arns["prometheus"] - } - - loki = { - port = 3100 - protocol = "HTTP" - target_group_arn = module.alb_target_group.target_group_arns["loki"] - } - - http = { - port = 80 - protocol = "HTTP" - target_group_arn = module.alb_target_group.target_group_arns["web"] - } - - # except HTTPS listener - # https = { - # port = 443 - # protocol = "HTTPS" - # target_group_arn = module.alb_target_group.target_group_arns["web"] - # } - } -} - -locals { - target_groups = { - "web" = { - name = "web" - port = 80 - protocol = "HTTP" - path = "/" - health_check = { - path = "/" - interval = 30 - timeout = 5 - healthy_threshold = 3 - unhealthy_threshold = 2 - } - } - - "monitor" = { - name = "monitor" - port = 3000 - protocol = "HTTP" - path = "/metrics" - health_check = { - path = "/login" - } - } - - "prometheus" = { - name = "prometheus" - port = 9090 - protocol = "HTTP" - path = "/" - health_check = { - path = "/graph" - } - } - - "loki" = { - name = "loki" - port = 3100 - protocol = "HTTP" - path = "/" - health_check = { - path = "/ready" - } - } - - "was" = { - name = "was" - port = 8080 - protocol = "HTTP" - path = "/" - health_check = { - path = "/api/health" - interval = 30 - timeout = 5 - healthy_threshold = 3 - unhealthy_threshold = 2 - } - } - } -} -locals { - ecr_repo_urls = { - issuefy-was = data.aws_ecr_repository.issuefy_was.repository_url - issuefy-web = data.aws_ecr_repository.issuefy_web.repository_url - issuefy-prometheus = data.aws_ecr_repository.issuefy_prometheus.repository_url - } -} - -locals { - ecs_services = { - "issuefy-was" = { - name = "issuefy-was" - task_definition = module.ecs_task.task_definition_arns["issuefy-was"] - desired_count = 1 - iam_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - load_balancer = { - target_group_arn = module.alb_target_group.target_group_arns["was"] - container_name = "issuefy-was" - container_port = 8080 - } - } - - "issuefy-web" = { - name = "issuefy-web" - task_definition = module.ecs_task.task_definition_arns["issuefy-web"] - desired_count = 1 - iam_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - load_balancer = { - target_group_arn = module.alb_target_group.target_group_arns["web"] - container_name = "issuefy-web" - container_port = 80 - } - } - - "issuefy-promtail" = { - name = "issuefy-promtail" - task_definition = module.ecs_task.task_definition_arns["issuefy-promtail"] - desired_count = 1 - iam_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - } - - "issuefy-prometheus-lower" = { - name = "issuefy-prometheus-lower" - task_definition = module.ecs_task.task_definition_arns["issuefy-prometheus-lower"] - desired_count = 1 - iam_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - } - - "issuefy-node-exporter" = { - name = "issuefy-node-exporter" - task_definition = module.ecs_task.task_definition_arns["issuefy-node-exporter"] - desired_count = 1 - iam_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - } - } -} - -locals { - ecs_task_definitions = { - issuefy-was = { - cpu = 512 - memory = 717 - network_mode = "bridge" - container_image = "${local.ecr_repo_urls["issuefy-was"]}:latest" - container_port = [8080, 9136] - host_port = [0, 9136] - log_group = "/ecs/issuefy-was" - task_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - execution_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - environment = {} - volumes = [ - { - name = "issuefy-log-volume" - host_path = "/home/ec2-user/logs/" - } - ] - } - - issuefy-web = { - cpu = 256 - memory = 307 - network_mode = "bridge" - container_image = "${local.ecr_repo_urls["issuefy-web"]}:latest" - container_port = [80] - host_port = [0] - log_group = "/ecs/issuefy-web" - task_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - execution_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - environment = {} - volumes = [] - } - - issuefy-promtail = { - cpu = 256 - memory = 262 - network_mode = "host" - container_image = "grafana/promtail:latest" - container_port = [] - host_port = [] - log_group = "/ecs/issuefy-promtail" - task_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - execution_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - ## have to change - environment = { - LOKI_URL = "http://10.0.15.90:3100/loki/api/v1/push" - } - volumes = [ - { - name = "issuefy-promtail-config" - host_path = "/home/ec2-user/logs/config.yml" - }, - { - name = "issuefy-promtail-logs" - host_path = "/home/ec2-user/logs" - } - ] - } - - issuefy-prometheus-lower = { - cpu = 256 - memory = 262 - network_mode = "host" - container_image = "${local.ecr_repo_urls["issuefy-prometheus"]}:lower_1.0" - - container_port = [9090] - host_port = [9090] - log_group = "/ecs/issuefy-prometheus-lower" - task_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - execution_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - environment = {} - volumes = [] - } - - issuefy-node-exporter = { - cpu = 256 - memory = 256 - network_mode = "host" - container_image = "${local.ecr_repo_urls["issuefy-prometheus"]}:node_exporter_1.0" - container_port = [9100] - host_port = [9100] - log_group = "/ecs/issuefy-node-exporter" - task_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - execution_role_arn = module.iam_roles["ecsTaskExecutionRole"].role_arn - environment = {} - volumes = [] - } - } -} diff --git a/terraform/main.tf b/terraform/main.tf deleted file mode 100644 index d92942e..0000000 --- a/terraform/main.tf +++ /dev/null @@ -1,137 +0,0 @@ -module "vpc" { - source = "./modules/vpc" - name_prefix = var.name_prefix - - tags = { - Environment = "prod" - } -} - -module "ec2" { - source = "./modules/ec2" - instance_subnet_map = local.instance_subnet_map - ec2_sg_id = module.security_group.ec2_sg_id - name_prefix = var.name_prefix - instance_definitions = local.enriched_instance_definitions -} - -module "security_group" { - source = "./modules/security" - name_prefix = var.name_prefix - vpc_id = module.vpc.vpc_id - - tags = { - Environment = "prod" - } -} - -data "aws_ssm_parameter" "rds_user_name" { - name = "/rds-user-name" - with_decryption = true -} - -data "aws_ssm_parameter" "rds_password" { - name = "/rds-password" - with_decryption = true -} - -module "rds" { - source = "./modules/rds" - identifier = "issuefy-db" - instance_class = "db.t3.micro" - allocated_storage = 20 - username = data.aws_ssm_parameter.rds_user_name.value - password = data.aws_ssm_parameter.rds_password.value - private_subnet_ids = module.vpc.private_subnet_ids - vpc_security_group_ids = [module.security_group.rds_sg_id] - multi_az = false - backup_retention_period = 0 - tags = { - Environment = "prod" - Service = "issuefy" - } -} - -module "iam" { - source = "./modules/iam" - group_name = "issuefy_power" - user_name = "roy_power" - - policy_arns = [ - "arn:aws:iam::aws:policy/AdministratorAccess", - "arn:aws:iam::aws:policy/AmazonElasticContainerRegistryPublicPowerUser", - "arn:aws:iam::aws:policy/AmazonS3FullAccess", - "arn:aws:iam::aws:policy/ElasticLoadBalancingReadOnly" - ] - - enable_console_access = true - enable_mfa_enforcement = true - - tags = { - Department = "issuefy" - Role = "power" - } -} - -module "iam_roles" { - source = "./modules/iamrole" - for_each = local.iam_roles - - name = each.key - assume_role_services = each.value.assume_role_services - policy_arns = each.value.policy_arns - tags = each.value.tags -} - -module "alb" { - source = "./modules/alb" - alb_security_group = module.security_group.alb_sg_id - name_prefix = var.name_prefix - subnets = module.vpc.public_subnet_ids -} - -module "alb_listener" { - source = "./modules/alb/listener" - alb_arn = module.alb.alb_arn - listeners = local.listeners -} - -module "alb_target_group" { - source = "./modules/alb/targetgroup" - target_groups = local.target_groups - vpc_id = module.vpc.vpc_id -} - -module "cloud_map" { - source = "./modules/cloudmap" - vpc_id = module.vpc.vpc_id -} - -module "ecs_cluster" { - source = "./modules/ecs/cluster" - namespace_id = module.cloud_map.namespace_id - cluster_name = "${var.name_prefix}-cluster" -} - -module "ecs_service" { - source = "./modules/ecs/service" - cluster_id = module.ecs_cluster.cluster_id - ecs_services = local.ecs_services -} - -module "ecs_task" { - source = "./modules/ecs/task" - ecs_task_definitions = local.ecs_task_definitions -} - -data "aws_ecr_repository" "issuefy_was" { - name = "issuefy-was" -} - -data "aws_ecr_repository" "issuefy_prometheus" { - name = "issuefy-prometheus" -} - -data "aws_ecr_repository" "issuefy_web" { - name = "issuefy-web" -} diff --git a/terraform/modules/alb/listener/main.tf b/terraform/modules/alb/listener/main.tf deleted file mode 100644 index fc53ebb..0000000 --- a/terraform/modules/alb/listener/main.tf +++ /dev/null @@ -1,12 +0,0 @@ -resource "aws_alb_listener" "this" { - for_each = var.listeners - - load_balancer_arn = var.alb_arn - port = each.value.port - protocol = each.value.protocol - - default_action { - type = "forward" - target_group_arn = each.value.target_group_arn - } -} diff --git a/terraform/modules/alb/listener/outputs.tf b/terraform/modules/alb/listener/outputs.tf deleted file mode 100644 index e69de29..0000000 diff --git a/terraform/modules/alb/listener/variables.tf b/terraform/modules/alb/listener/variables.tf deleted file mode 100644 index b5a8fce..0000000 --- a/terraform/modules/alb/listener/variables.tf +++ /dev/null @@ -1,9 +0,0 @@ -variable "alb_arn" {} - -variable "listeners" { - type = map(object({ - port = number - protocol = string - target_group_arn = string - })) -} diff --git a/terraform/modules/alb/main.tf b/terraform/modules/alb/main.tf deleted file mode 100644 index 53aff69..0000000 --- a/terraform/modules/alb/main.tf +++ /dev/null @@ -1,13 +0,0 @@ -resource "aws_alb" "issuefy_alb" { - name = "${var.name_prefix}-alb" - internal = false - load_balancer_type = var.loadbalancer_type - security_groups = [var.alb_security_group] - subnets = var.subnets - - enable_deletion_protection = false - - tags = { - Environment = "issuefy-alb" - } -} \ No newline at end of file diff --git a/terraform/modules/alb/outputs.tf b/terraform/modules/alb/outputs.tf deleted file mode 100644 index 2d7b410..0000000 --- a/terraform/modules/alb/outputs.tf +++ /dev/null @@ -1,3 +0,0 @@ -output "alb_arn" { - value = aws_alb.issuefy_alb.arn -} \ No newline at end of file diff --git a/terraform/modules/alb/targetgroup/main.tf b/terraform/modules/alb/targetgroup/main.tf deleted file mode 100644 index fd6b3bb..0000000 --- a/terraform/modules/alb/targetgroup/main.tf +++ /dev/null @@ -1,8 +0,0 @@ -resource "aws_lb_target_group" "issuefy_target_group" { - for_each = var.target_groups - - name = each.key - port = each.value.port - protocol = each.value.protocol - vpc_id = var.vpc_id -} diff --git a/terraform/modules/alb/targetgroup/outputs.tf b/terraform/modules/alb/targetgroup/outputs.tf deleted file mode 100644 index b2fee63..0000000 --- a/terraform/modules/alb/targetgroup/outputs.tf +++ /dev/null @@ -1,13 +0,0 @@ -output "target_group_arns" { - value = { - for k, tg in aws_lb_target_group.issuefy_target_group : - k => tg.arn - } -} - -output "target_group_names" { - value = { - for k, tg in aws_lb_target_group.issuefy_target_group : - k => tg.name - } -} diff --git a/terraform/modules/alb/targetgroup/variables.tf b/terraform/modules/alb/targetgroup/variables.tf deleted file mode 100644 index 2bfe24d..0000000 --- a/terraform/modules/alb/targetgroup/variables.tf +++ /dev/null @@ -1,9 +0,0 @@ -variable "target_groups" { - type = map(object({ - name = string - port = number - protocol = string - })) -} - -variable "vpc_id" {} \ No newline at end of file diff --git a/terraform/modules/alb/variables.tf b/terraform/modules/alb/variables.tf deleted file mode 100644 index 978a78d..0000000 --- a/terraform/modules/alb/variables.tf +++ /dev/null @@ -1,26 +0,0 @@ -variable "name_prefix" { - type = string - description = "Prefix for ALB and related resources" -} - -variable "subnets" { - type = list(string) - description = "List of public subnet IDs for the ALB" -} - -variable "alb_security_group" { - type = string - description = "Security group ID for the ALB" -} - -variable "loadbalancer_type" { - type = string - default = "application" - description = "Type of ALB (application | network)" -} - -variable "internal" { - type = bool - default = false - description = "Whether the ALB is internal or internet-facing" -} diff --git a/terraform/modules/cloudmap/main.tf b/terraform/modules/cloudmap/main.tf deleted file mode 100644 index b42213a..0000000 --- a/terraform/modules/cloudmap/main.tf +++ /dev/null @@ -1,4 +0,0 @@ -resource "aws_service_discovery_private_dns_namespace" "issuefy-ns" { - name = "issuefy-prod" - vpc = var.vpc_id -} \ No newline at end of file diff --git a/terraform/modules/cloudmap/outputs.tf b/terraform/modules/cloudmap/outputs.tf deleted file mode 100644 index cb50fe9..0000000 --- a/terraform/modules/cloudmap/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "namespace_id" { - value = aws_service_discovery_private_dns_namespace.issuefy-ns.id -} - -output "namespace_arn" { - value = aws_service_discovery_private_dns_namespace.issuefy-ns.arn -} \ No newline at end of file diff --git a/terraform/modules/cloudmap/variables.tf b/terraform/modules/cloudmap/variables.tf deleted file mode 100644 index b7bf843..0000000 --- a/terraform/modules/cloudmap/variables.tf +++ /dev/null @@ -1 +0,0 @@ -variable "vpc_id" {} \ No newline at end of file diff --git a/terraform/modules/ec2/main.tf b/terraform/modules/ec2/main.tf deleted file mode 100644 index 7d42a0a..0000000 --- a/terraform/modules/ec2/main.tf +++ /dev/null @@ -1,16 +0,0 @@ -resource "aws_instance" "multi_role" { - for_each = var.instance_definitions - - ami = each.value.ami - instance_type = each.value.instance_type - subnet_id = var.instance_subnet_map[each.key] - vpc_security_group_ids = [var.ec2_sg_id] - iam_instance_profile = try(each.value.iam_instance_profile, null) - key_name = try(each.value.key_name, null) - user_data = try(each.value.user_data, null) - user_data_replace_on_change = true - - tags = { - Name = "${var.name_prefix}-${each.key}" - } -} \ No newline at end of file diff --git a/terraform/modules/ec2/outputs.tf b/terraform/modules/ec2/outputs.tf deleted file mode 100644 index e69de29..0000000 diff --git a/terraform/modules/ec2/variables.tf b/terraform/modules/ec2/variables.tf deleted file mode 100644 index 6d56b22..0000000 --- a/terraform/modules/ec2/variables.tf +++ /dev/null @@ -1,29 +0,0 @@ -variable "instance_definitions" { - description = "EC2 instance definitions for different roles including AMI and instance type" - type = map(object({ - ami = string - instance_type = string - iam_instance_profile = optional(string) - key_name = string - user_data = optional(string) - })) -} - -variable "instance_subnet_map" { - type = map(string) -} - -variable "tags" { - type = map(string) - default = {} -} - -variable "name_prefix" { - description = "Name prefix for instance naming" - type = string -} - -variable "ec2_sg_id" { - description = "Security Group ID for EC2 instances" - type = string -} diff --git a/terraform/modules/ecr/main.tf b/terraform/modules/ecr/main.tf deleted file mode 100644 index 45d1b9f..0000000 --- a/terraform/modules/ecr/main.tf +++ /dev/null @@ -1,10 +0,0 @@ -resource "aws_ecr_repository" "this" { - name = var.repository_name - image_tag_mutability = var.image_tag_mutability - - image_scanning_configuration { - scan_on_push = var.scan_on_push - } - - tags = var.tags -} diff --git a/terraform/modules/ecr/outputs.tf b/terraform/modules/ecr/outputs.tf deleted file mode 100644 index 039cf36..0000000 --- a/terraform/modules/ecr/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "repository_url" { - value = aws_ecr_repository.this.repository_url -} - -output "repository_arn" { - value = aws_ecr_repository.this.arn -} diff --git a/terraform/modules/ecr/variables.tf b/terraform/modules/ecr/variables.tf deleted file mode 100644 index 8bf576a..0000000 --- a/terraform/modules/ecr/variables.tf +++ /dev/null @@ -1,15 +0,0 @@ -variable "repository_name" { - type = string -} - -variable "scan_on_push" { - type = bool -} - -variable "image_tag_mutability" { - type = string -} - -variable "tags" { - type = map(string) -} diff --git a/terraform/modules/ecs/cluster/main.tf b/terraform/modules/ecs/cluster/main.tf deleted file mode 100644 index 68b7eb1..0000000 --- a/terraform/modules/ecs/cluster/main.tf +++ /dev/null @@ -1,12 +0,0 @@ -resource "aws_ecs_cluster" "issuefy_cluster" { - name = var.cluster_name - - setting { - name = "containerInsights" - value = "disabled" - } - - tags = { - Name = var.cluster_name - } -} \ No newline at end of file diff --git a/terraform/modules/ecs/cluster/outputs.tf b/terraform/modules/ecs/cluster/outputs.tf deleted file mode 100644 index 9010ec8..0000000 --- a/terraform/modules/ecs/cluster/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "cluster_id" { - value = aws_ecs_cluster.issuefy_cluster.id -} - -output "cluster_name" { - value = aws_ecs_cluster.issuefy_cluster.name -} \ No newline at end of file diff --git a/terraform/modules/ecs/cluster/variables.tf b/terraform/modules/ecs/cluster/variables.tf deleted file mode 100644 index 9238ad3..0000000 --- a/terraform/modules/ecs/cluster/variables.tf +++ /dev/null @@ -1,9 +0,0 @@ -variable "cluster_name" { - description = "production cluster name" - default = "issuefy-cluster" -} - -variable "namespace_id" { - description = "production namespace id" - type = string -} \ No newline at end of file diff --git a/terraform/modules/ecs/service/main.tf b/terraform/modules/ecs/service/main.tf deleted file mode 100644 index f931097..0000000 --- a/terraform/modules/ecs/service/main.tf +++ /dev/null @@ -1,9 +0,0 @@ -resource "aws_ecs_service" "services" { - for_each = var.ecs_services - - name = each.key - cluster = var.cluster_id - task_definition = each.value.task_definition - desired_count = each.value.desired_count - # iam_role = each.value.iam_role_arn -} diff --git a/terraform/modules/ecs/service/outputs.tf b/terraform/modules/ecs/service/outputs.tf deleted file mode 100644 index e69de29..0000000 diff --git a/terraform/modules/ecs/service/variables.tf b/terraform/modules/ecs/service/variables.tf deleted file mode 100644 index c1f66ea..0000000 --- a/terraform/modules/ecs/service/variables.tf +++ /dev/null @@ -1,11 +0,0 @@ -variable "ecs_services" { - type = map(object({ - name = string - task_definition = string - desired_count = number - })) -} - -variable "cluster_id" { - type = string -} diff --git a/terraform/modules/ecs/task/main.tf b/terraform/modules/ecs/task/main.tf deleted file mode 100644 index 1214bcb..0000000 --- a/terraform/modules/ecs/task/main.tf +++ /dev/null @@ -1,55 +0,0 @@ -resource "aws_ecs_task_definition" "tasks" { - for_each = var.ecs_task_definitions - - family = each.key - network_mode = each.value.network_mode - requires_compatibilities = ["EC2"] - cpu = each.value.cpu - memory = each.value.memory - task_role_arn = each.value.task_role_arn - execution_role_arn = each.value.execution_role_arn - - dynamic "volume" { - for_each = each.value.volumes - content { - name = volume.value.name - host_path = volume.value.host_path - } - } - - container_definitions = jsonencode([ - { - name = each.key - image = each.value.container_image - cpu = each.value.cpu - memory = each.value.memory - essential = true - stopTimeout = 30 - portMappings = [ - for idx, port in each.value.container_port : { - name = "${each.key}-${port}-tcp" - containerPort = port - hostPort = each.value.host_port[idx] - protocol = "tcp" - } - ] - environment = [for k, v in each.value.environment : { name = k, value = v }] - logConfiguration = { - logDriver = "awslogs" - options = { - awslogs-group = each.value.log_group - awslogs-create-group = "true" - awslogs-region = "ap-northeast-2" - awslogs-stream-prefix = "ecs" - } - } - mountPoints = [ - for vol in each.value.volumes : { - sourceVolume = vol.name - containerPath = (vol.name == "issuefy-promtail-config" ? "/etc/promtail/config.yml" : "/logs") - readOnly = false - } - ] - } - ]) -} diff --git a/terraform/modules/ecs/task/outputs.tf b/terraform/modules/ecs/task/outputs.tf deleted file mode 100644 index 0f7f921..0000000 --- a/terraform/modules/ecs/task/outputs.tf +++ /dev/null @@ -1,6 +0,0 @@ -output "task_definition_arns" { - value = { - for k, task in aws_ecs_task_definition.tasks : - k => task.arn - } -} diff --git a/terraform/modules/ecs/task/variables.tf b/terraform/modules/ecs/task/variables.tf deleted file mode 100644 index 95b3f05..0000000 --- a/terraform/modules/ecs/task/variables.tf +++ /dev/null @@ -1,18 +0,0 @@ -variable "ecs_task_definitions" { - type = map(object({ - container_image = string - container_port = optional(list(number), []) - host_port = optional(list(number), []) - cpu = number - memory = number - task_role_arn = string - execution_role_arn = string - network_mode = string - log_group = string - volumes = optional(list(object({ - name = string - host_path = string - })), []) - environment = optional(map(string), {}) - })) -} diff --git a/terraform/modules/iam/main.tf b/terraform/modules/iam/main.tf deleted file mode 100644 index 31adaf0..0000000 --- a/terraform/modules/iam/main.tf +++ /dev/null @@ -1,47 +0,0 @@ -resource "aws_iam_group" "this" { - name = var.group_name -} - -resource "aws_iam_user" "this" { - name = var.user_name - tags = var.tags -} - -resource "aws_iam_group_membership" "membership" { - name = "${var.group_name}-membership" - users = [aws_iam_user.this.name] - group = aws_iam_group.this.name -} - -resource "aws_iam_group_policy_attachment" "policies" { - for_each = toset(var.policy_arns) - - group = aws_iam_group.this.name - policy_arn = each.value -} - -resource "aws_iam_policy" "deny_if_no_mfa" { - count = var.enable_mfa_enforcement ? 1 : 0 - name = "${var.group_name}-deny-no-mfa" - policy = data.aws_iam_policy_document.deny_without_mfa.json -} - -resource "aws_iam_group_policy_attachment" "deny_no_mfa_attach" { - count = var.enable_mfa_enforcement ? 1 : 0 - group = aws_iam_group.this.name - policy_arn = aws_iam_policy.deny_if_no_mfa[0].arn -} - -data "aws_iam_policy_document" "deny_without_mfa" { - statement { - effect = "Deny" - actions = ["*"] - resources = ["*"] - - condition { - test = "BoolIfExists" - variable = "aws:MultiFactorAuthPresent" - values = ["false"] - } - } -} diff --git a/terraform/modules/iam/outputs.tf b/terraform/modules/iam/outputs.tf deleted file mode 100644 index 2f85767..0000000 --- a/terraform/modules/iam/outputs.tf +++ /dev/null @@ -1,7 +0,0 @@ -output "user_name" { - value = aws_iam_user.this.name -} - -output "group_name" { - value = aws_iam_group.this.name -} diff --git a/terraform/modules/iam/variables.tf b/terraform/modules/iam/variables.tf deleted file mode 100644 index 8078535..0000000 --- a/terraform/modules/iam/variables.tf +++ /dev/null @@ -1,39 +0,0 @@ -variable "group_name" { - description = "IAM group name" - type = string -} - -variable "user_name" { - description = "IAM user name" - type = string -} - -variable "policy_arns" { - description = "List of IAM Policy ARNs to attach to the group" - type = list(string) -} - -variable "enable_console_access" { - description = "Whether to enable AWS Management Console access" - type = bool - default = false -} - -variable "console_password" { - description = "Initial password for console login" - type = string - default = null -} - -variable "enable_mfa_enforcement" { - description = "Whether to enforce MFA via IAM policy" - type = bool - default = true -} - - -variable "tags" { - description = "Tags for the IAM user" - type = map(string) - default = {} -} diff --git a/terraform/modules/iamrole/main.tf b/terraform/modules/iamrole/main.tf deleted file mode 100644 index 31f9f8f..0000000 --- a/terraform/modules/iamrole/main.tf +++ /dev/null @@ -1,27 +0,0 @@ -resource "aws_iam_role" "this" { - name = var.name - assume_role_policy = data.aws_iam_policy_document.assume_role.json - tags = var.tags -} - -resource "aws_iam_instance_profile" "this" { - name = var.name - role = aws_iam_role.this.name -} - -resource "aws_iam_role_policy_attachment" "this" { - for_each = toset(var.policy_arns) - role = aws_iam_role.this.name - policy_arn = each.value -} - -data "aws_iam_policy_document" "assume_role" { - statement { - actions = ["sts:AssumeRole"] - - principals { - type = "Service" - identifiers = var.assume_role_services - } - } -} diff --git a/terraform/modules/iamrole/outputs.tf b/terraform/modules/iamrole/outputs.tf deleted file mode 100644 index c42acae..0000000 --- a/terraform/modules/iamrole/outputs.tf +++ /dev/null @@ -1,11 +0,0 @@ -output "role_name" { - value = aws_iam_role.this.name -} - -output "role_arn" { - value = aws_iam_role.this.arn -} - -output "instance_profile_name" { - value = aws_iam_instance_profile.this.name -} diff --git a/terraform/modules/iamrole/variables.tf b/terraform/modules/iamrole/variables.tf deleted file mode 100644 index 42bbf95..0000000 --- a/terraform/modules/iamrole/variables.tf +++ /dev/null @@ -1,21 +0,0 @@ -variable "name" { - description = "IAM Role name" - type = string -} - -variable "assume_role_services" { - description = "List of services that can assume this role" - type = list(string) -} - -variable "policy_arns" { - description = "List of policy ARNs to attach to the role" - type = list(string) - default = [] -} - -variable "tags" { - description = "Tags to apply to the role" - type = map(string) - default = {} -} diff --git a/terraform/modules/rds/main.tf b/terraform/modules/rds/main.tf deleted file mode 100644 index 6d3a1ce..0000000 --- a/terraform/modules/rds/main.tf +++ /dev/null @@ -1,26 +0,0 @@ -resource "aws_db_subnet_group" "this" { - name = "${var.identifier}-subnet-group" - subnet_ids = var.private_subnet_ids - - tags = merge(var.tags, { - Name = "${var.identifier}-subnet-group" - }) -} - -resource "aws_db_instance" "this" { - identifier = var.identifier - engine = var.engine - engine_version = var.engine_version - instance_class = var.instance_class - allocated_storage = var.allocated_storage - username = var.username - password = var.password - vpc_security_group_ids = var.vpc_security_group_ids - db_subnet_group_name = aws_db_subnet_group.this.name - multi_az = var.multi_az - backup_retention_period = var.backup_retention_period - storage_encrypted = var.storage_encrypted - skip_final_snapshot = true - - tags = var.tags -} diff --git a/terraform/modules/rds/outputs.tf b/terraform/modules/rds/outputs.tf deleted file mode 100644 index b9cb73a..0000000 --- a/terraform/modules/rds/outputs.tf +++ /dev/null @@ -1,9 +0,0 @@ -output "endpoint" { - description = "RDS endpoint address" - value = aws_db_instance.this.endpoint -} - -output "arn" { - description = "RDS instance ARN" - value = aws_db_instance.this.arn -} \ No newline at end of file diff --git a/terraform/modules/rds/variables.tf b/terraform/modules/rds/variables.tf deleted file mode 100644 index 7a9bd81..0000000 --- a/terraform/modules/rds/variables.tf +++ /dev/null @@ -1,72 +0,0 @@ -variable "identifier" { - description = "RDS instance identifier" - type = string -} - -variable "engine" { - description = "Database engine" - type = string - default = "mysql" -} - -variable "engine_version" { - description = "Database engine version" - type = string - default = "8.0.40" -} - -variable "instance_class" { - description = "Instance type" - type = string -} - -variable "allocated_storage" { - description = "Storage size (GB)" - type = number -} - -variable "username" { - description = "Master username" - type = string -} - -variable "password" { - description = "Master password" - type = string - sensitive = true -} - -variable "vpc_security_group_ids" { - description = "List of VPC security group IDs" - type = list(string) -} - -variable "multi_az" { - description = "Multi-AZ deployment" - type = bool - default = false -} - -variable "backup_retention_period" { - description = "Backup retention (in days)" - type = number - default = 0 -} - -variable "storage_encrypted" { - description = "Whether to encrypt storage" - type = bool - default = true -} - -variable "tags" { - description = "Tags for the RDS instance" - type = map(string) - default = {} -} - -variable "private_subnet_ids" { - description = "Private subnet IDs to associate with DB subnet group" - type = list(string) -} - diff --git a/terraform/modules/security/main.tf b/terraform/modules/security/main.tf deleted file mode 100644 index 4e7ef82..0000000 --- a/terraform/modules/security/main.tf +++ /dev/null @@ -1,117 +0,0 @@ -resource "aws_security_group" "ec2" { - name = "${var.name_prefix}-ec2-sg" - description = "Security group for EC2 instances" - vpc_id = var.vpc_id - - ingress { - description = "Allow SSH access" - from_port = 22 - to_port = 22 - protocol = "tcp" - cidr_blocks = var.allowed_ssh_cidrs - } - - ingress { - description = "Allow HTTP access" - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = var.allowed_http_cidrs - } - - egress { - description = "Allow all outbound traffic" - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } - - tags = merge(var.tags, { - Name = "${var.name_prefix}-ec2-sg" - }) -} - -resource "aws_security_group" "rds" { - name = "${var.name_prefix}-rds-sg" - description = "Security group for RDS instances" - vpc_id = var.vpc_id - - ingress { - description = "Allow RDS access" - from_port = 3306 - to_port = 3306 - protocol = "tcp" - cidr_blocks = var.allowed_http_cidrs - } - - egress { - description = "Allow all outbound traffic" - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } - - tags = merge(var.tags, { - Name = "${var.name_prefix}-rds-sg" - }) -} - -resource "aws_security_group" "alb" { - name = "${var.name_prefix}-alb-sg" - description = "Security group for Application Loadbalancer" - vpc_id = var.vpc_id - - ingress { - description = "Allow HTTPS access" - from_port = 443 - to_port = 443 - protocol = "tcp" - cidr_blocks = var.allowed_ssh_cidrs - } - - ingress { - description = "Allow HTTP access" - from_port = 80 - to_port = 80 - protocol = "tcp" - cidr_blocks = var.allowed_http_cidrs - } - - ingress { - description = "Allow NginX access" - from_port = 3000 - to_port = 3000 - protocol = "tcp" - cidr_blocks = var.allowed_http_cidrs - } - - ingress { - description = "Allow Loki access" - from_port = 3001 - to_port = 3001 - protocol = "tcp" - cidr_blocks = var.allowed_http_cidrs - } - - ingress { - description = "Allow Prometheus access" - from_port = 9090 - to_port = 9090 - protocol = "tcp" - cidr_blocks = var.allowed_http_cidrs - } - - egress { - description = "Allow all outbound traffic" - from_port = 0 - to_port = 0 - protocol = "-1" - cidr_blocks = ["0.0.0.0/0"] - } - - tags = merge(var.tags, { - Name = "${var.name_prefix}-alb-sg" - }) -} diff --git a/terraform/modules/security/outputs.tf b/terraform/modules/security/outputs.tf deleted file mode 100644 index 7d6e8b1..0000000 --- a/terraform/modules/security/outputs.tf +++ /dev/null @@ -1,14 +0,0 @@ -output "ec2_sg_id" { - description = "Security group ID for EC2" - value = aws_security_group.ec2.id -} - -output "rds_sg_id" { - description = "Security group ID for RDS" - value = aws_security_group.rds.id -} - -output "alb_sg_id" { - description = "Security group ID for ALB" - value = aws_security_group.alb.id -} \ No newline at end of file diff --git a/terraform/modules/security/variables.tf b/terraform/modules/security/variables.tf deleted file mode 100644 index 5bbeb8b..0000000 --- a/terraform/modules/security/variables.tf +++ /dev/null @@ -1,27 +0,0 @@ -variable "name_prefix" { - description = "Prefix for naming the security group" - type = string -} - -variable "vpc_id" { - description = "VPC ID where the security group will be created" - type = string -} - -variable "allowed_ssh_cidrs" { - description = "CIDR blocks allowed for SSH access" - type = list(string) - default = ["0.0.0.0/0"] -} - -variable "allowed_http_cidrs" { - description = "CIDR blocks allowed for HTTP access" - type = list(string) - default = ["0.0.0.0/0"] -} - -variable "tags" { - description = "Tags to apply to the security group" - type = map(string) - default = {} -} diff --git a/terraform/modules/vpc/main.tf b/terraform/modules/vpc/main.tf deleted file mode 100644 index 032d74f..0000000 --- a/terraform/modules/vpc/main.tf +++ /dev/null @@ -1,76 +0,0 @@ -resource "aws_vpc" "this" { - cidr_block = var.vpc_cidr - enable_dns_hostnames = var.enable_dns_hostnames - enable_dns_support = var.enable_dns_support - enable_network_address_usage_metrics = var.enable_network_address_usage_metrics - - tags = merge(var.tags, { - Name = "${var.name_prefix}-vpc" - }) -} - -resource "aws_subnet" "public" { - count = length(var.public_subnet_cidrs) - vpc_id = aws_vpc.this.id - cidr_block = var.public_subnet_cidrs[count.index] - availability_zone = var.availability_zones[count.index] - map_public_ip_on_launch = true - - tags = merge(var.tags, { - Name = "${var.name_prefix}-pub-sub-${substr(var.availability_zones[count.index], -2, 2)}" - }) -} - -resource "aws_subnet" "private" { - count = length(var.private_subnet_cidrs) - vpc_id = aws_vpc.this.id - cidr_block = var.private_subnet_cidrs[count.index] - availability_zone = var.availability_zones[count.index] - - tags = merge(var.tags, { - Name = "${var.name_prefix}-pri-sub-${substr(var.availability_zones[count.index], -2, 2)}" - }) -} - -resource "aws_internet_gateway" "this" { - vpc_id = aws_vpc.this.id - - tags = merge(var.tags, { - Name = "${var.name_prefix}-igw" - }) -} - -resource "aws_route_table" "public" { - vpc_id = aws_vpc.this.id - - tags = merge(var.tags, { - Name = "${var.name_prefix}-rt-pub" - }) -} - -resource "aws_route_table" "private" { - count = length(var.private_subnet_cidrs) - vpc_id = aws_vpc.this.id - - tags = merge(var.tags, { - Name = "${var.name_prefix}-rt-pri-${substr(var.availability_zones[count.index], -2, 2)}" - }) -} - -resource "aws_route_table_association" "public" { - count = length(var.public_subnet_cidrs) - subnet_id = aws_subnet.public[count.index].id - route_table_id = aws_route_table.public.id -} - -resource "aws_route_table_association" "private" { - count = length(var.private_subnet_cidrs) - subnet_id = aws_subnet.private[count.index].id - route_table_id = aws_route_table.private[count.index].id -} - -resource "aws_route" "public_internet_gateway" { - route_table_id = aws_route_table.public.id - destination_cidr_block = "0.0.0.0/0" - gateway_id = aws_internet_gateway.this.id -} \ No newline at end of file diff --git a/terraform/modules/vpc/outputs.tf b/terraform/modules/vpc/outputs.tf deleted file mode 100644 index 7bf9121..0000000 --- a/terraform/modules/vpc/outputs.tf +++ /dev/null @@ -1,34 +0,0 @@ -output "vpc_id" { - description = "The ID of the VPC" - value = aws_vpc.this.id -} - -output "vpc_cidr_block" { - description = "The CIDR block of the VPC" - value = aws_vpc.this.cidr_block -} - -output "public_subnet_ids" { - description = "List of IDs of public subnets" - value = aws_subnet.public[*].id -} - -output "private_subnet_ids" { - description = "List of IDs of private subnets" - value = aws_subnet.private[*].id -} - -output "internet_gateway_id" { - description = "ID of the Internet Gateway" - value = aws_internet_gateway.this.id -} - -output "public_route_table_id" { - description = "ID of the public route table" - value = aws_route_table.public.id -} - -output "private_route_table_ids" { - description = "List of IDs of private route tables" - value = aws_route_table.private[*].id -} \ No newline at end of file diff --git a/terraform/modules/vpc/variables.tf b/terraform/modules/vpc/variables.tf deleted file mode 100644 index 0b30ee5..0000000 --- a/terraform/modules/vpc/variables.tf +++ /dev/null @@ -1,53 +0,0 @@ -variable "vpc_cidr" { - description = "CIDR block for VPC" - type = string - default = "10.0.0.0/16" -} - -variable "enable_dns_hostnames" { - description = "Enable DNS hostnames in VPC" - type = bool - default = true -} - -variable "enable_dns_support" { - description = "Enable DNS support in VPC" - type = bool - default = true -} - -variable "enable_network_address_usage_metrics" { - description = "Enable network address usage metrics" - type = bool - default = true -} - -variable "public_subnet_cidrs" { - description = "CIDR blocks for public subnets" - type = list(string) - default = ["10.0.0.0/20", "10.0.16.0/20"] -} - -variable "private_subnet_cidrs" { - description = "CIDR blocks for private subnets" - type = list(string) - default = ["10.0.128.0/20", "10.0.144.0/20"] -} - -variable "availability_zones" { - description = "Availability zones for subnets" - type = list(string) - default = ["ap-northeast-2a", "ap-northeast-2c"] -} - -variable "tags" { - description = "Tags to apply to resources" - type = map(string) - default = {} -} - -variable "name_prefix" { - description = "Prefix to use for resource names" - type = string - default = "issuefy" -} \ No newline at end of file diff --git a/terraform/outputs.tf b/terraform/outputs.tf deleted file mode 100644 index e69de29..0000000 diff --git a/terraform/providers.tf b/terraform/providers.tf deleted file mode 100644 index 7b61b44..0000000 --- a/terraform/providers.tf +++ /dev/null @@ -1,12 +0,0 @@ -terraform { - required_providers { - aws = { - source = "hashicorp/aws" - version = "5.54.1" - } - } -} - -provider "aws" { - region = "ap-northeast-2" -} \ No newline at end of file diff --git a/terraform/terraform.tfvars b/terraform/terraform.tfvars deleted file mode 100644 index 037afd7..0000000 --- a/terraform/terraform.tfvars +++ /dev/null @@ -1,32 +0,0 @@ -instance_definitions = { - prod = { - ami = "ami-012ea6058806ff688" - instance_type = "t3a.small" - iam_instance_profile = "ec2-to-ecs" - key_name = "issuefy-key" - user_data = <<-EOF -#!/bin/bash -echo ECS_CLUSTER=issuefy-cluster >> /etc/ecs/ecs.config -EOF - } - - monitoring = { - ami = "ami-05377cf8cfef186c2" - instance_type = "t2.micro" - iam_instance_profile = "ec2-monitoring" - key_name = "issuefy-key" - user_data = <<-EOF -#!/bin/bash -dnf update -y -dnf install -y docker -systemctl enable docker -systemctl start docker -EOF - } - - nat = { - ami = "ami-0fa9216d5e4fcd66d" - instance_type = "t3.nano" - key_name = "issuefy-key" - } -} diff --git a/terraform/variables.tf b/terraform/variables.tf deleted file mode 100644 index 007355e..0000000 --- a/terraform/variables.tf +++ /dev/null @@ -1,22 +0,0 @@ -variable "name_prefix" { - description = "project name prefix" - type = string - default = "issuefy" -} - -variable "instance_definitions" { - type = map(object({ - ami = string - instance_type = string - iam_instance_profile = optional(string) - key_name = string - user_data = optional(string) - })) -} - -variable "tags" { - type = map(string) - default = {} -} - -