Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

simple #8

Open
wants to merge 1 commit into
base: feature/swarms.ai
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file.
Empty file.
Original file line number Diff line number Diff line change
@@ -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 {}
Expand Down Expand Up @@ -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
# }
# }

}
69 changes: 40 additions & 29 deletions environments/swarms-aws-agent-api/dev/us-east-1/main.tf
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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)
Expand All @@ -66,7 +76,7 @@ variable "instance_types" {
#"t3.small",
#"t2.small", not working
# "t2.medium" #
"t3.medium"
# "t3.medium"
]
}

Expand Down Expand Up @@ -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
Expand All @@ -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
# }
Loading