From 3258e9673cddd8579b643ce2feea0f12f05b025d Mon Sep 17 00:00:00 2001 From: mike dupont Date: Tue, 17 Dec 2024 13:37:34 -0500 Subject: [PATCH] simple --- .../dev/us-east-1/alb/main.tf | 0 .../dev/us-east-1/asg/main.tf | 0 .../components/autoscaling_group/main.tf | 14 ++-- .../dev/us-east-1/main.tf | 69 +++++++++++-------- 4 files changed, 47 insertions(+), 36 deletions(-) delete mode 100644 environments/swarms-aws-agent-api/dev/us-east-1/alb/main.tf delete mode 100644 environments/swarms-aws-agent-api/dev/us-east-1/asg/main.tf diff --git a/environments/swarms-aws-agent-api/dev/us-east-1/alb/main.tf b/environments/swarms-aws-agent-api/dev/us-east-1/alb/main.tf deleted file mode 100644 index e69de29..0000000 diff --git a/environments/swarms-aws-agent-api/dev/us-east-1/asg/main.tf b/environments/swarms-aws-agent-api/dev/us-east-1/asg/main.tf deleted file mode 100644 index e69de29..0000000 diff --git a/environments/swarms-aws-agent-api/dev/us-east-1/components/autoscaling_group/main.tf b/environments/swarms-aws-agent-api/dev/us-east-1/components/autoscaling_group/main.tf index e5e31ef..839bbe4 100644 --- a/environments/swarms-aws-agent-api/dev/us-east-1/components/autoscaling_group/main.tf +++ b/environments/swarms-aws-agent-api/dev/us-east-1/components/autoscaling_group/main.tf @@ -1,5 +1,5 @@ variable aws_iam_instance_profile_ssm_arn {} -variable target_group_arn{} +#variable target_group_arn{} variable name {} variable instance_type {} variable launch_template_id {} @@ -58,11 +58,11 @@ module "autoscaling" { } # target_group_arn = - traffic_source_attachments = { - ex-alb = { - traffic_source_identifier = var.target_group_arn - traffic_source_type = "elbv2" # default - } - } + # traffic_source_attachments = { + # ex-alb = { + # traffic_source_identifier = var.target_group_arn + # traffic_source_type = "elbv2" # default + # } + # } } diff --git a/environments/swarms-aws-agent-api/dev/us-east-1/main.tf b/environments/swarms-aws-agent-api/dev/us-east-1/main.tf index c811e52..e7ad180 100644 --- a/environments/swarms-aws-agent-api/dev/us-east-1/main.tf +++ b/environments/swarms-aws-agent-api/dev/us-east-1/main.tf @@ -1,6 +1,6 @@ locals { # instance_type = "t3.large" - # instance_type = "t3.medium" + instance_type = "t3.medium" ami_name = "ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" name = "swarms" region = "us-east-2" @@ -43,19 +43,29 @@ module "kp" { source = "./components/keypairs" } -# module "lt" { -# instance_type = local.instance_type -# security_group_id = module.security.security_group_id -# source = "./components/launch_template" -# } - -# module "asg" { -# source = "./components/autoscaling_group" -# name="swarms" +module "lt" { + iam_instance_profile_name = aws_iam_instance_profile.ssm.name + instance_type = local.instance_type + security_group_id = module.security.security_group_id + source = "./components/launch_template" + vpc_id = local.vpc_id + tags = var.tags + ami_id = local.ami_id + name="swarms" + } + + module "asg" { + vpc_id = local.vpc_id + tags = var.tags + source = "./components/autoscaling_group" + name="swarms" # security_group_id = module.security.security_group_id -# instance_type = local.instance_type -# launch_template_id = module.lt.launch_template_id -# } + instance_type = local.instance_type + launch_template_id = module.lt.launch_template_id + image_id = local.ami_id + aws_iam_instance_profile_ssm_arn = aws_iam_instance_profile.ssm.arn + ec2_subnet_id = module.vpc.ec2_public_subnet_id_1 + } variable "instance_types" { type = list(string) @@ -66,7 +76,7 @@ variable "instance_types" { #"t3.small", #"t2.small", not working # "t2.medium" # - "t3.medium" +# "t3.medium" ] } @@ -116,7 +126,8 @@ output vpc { } -module "alb" { +module "alb" { + count = 0 source = "./components/application_load_balancer" domain_name = local.domain security_group_id = module.security.security_group_id # allowed to talk to internal @@ -131,17 +142,17 @@ output alb { } -module "asg_dynamic" { - tags = local.tags - vpc_id = local.vpc_id - image_id = local.ami_id - ec2_subnet_id = module.vpc.ec2_public_subnet_id_1 - for_each = toset(var.instance_types) - aws_iam_instance_profile_ssm_arn = aws_iam_instance_profile.ssm.arn - source = "./components/autoscaling_group" -# security_group_id = module.security.internal_security_group_id - instance_type = each.key - name = "swarms-size-${each.key}" - launch_template_id = module.lt_dynamic[each.key].launch_template_id - target_group_arn = module.alb.alb_target_group_arn -} +# module "asg_dynamic" { +# tags = local.tags +# vpc_id = local.vpc_id +# image_id = local.ami_id +# ec2_subnet_id = module.vpc.ec2_public_subnet_id_1 +# for_each = toset(var.instance_types) +# aws_iam_instance_profile_ssm_arn = aws_iam_instance_profile.ssm.arn +# source = "./components/autoscaling_group" +# # security_group_id = module.security.internal_security_group_id +# instance_type = each.key +# name = "swarms-size-${each.key}" +# launch_template_id = module.lt_dynamic[each.key].launch_template_id +# target_group_arn = module.alb.alb_target_group_arn +# }