Skip to content

Commit

Permalink
use t2 instances for rhel 6 ami (#5553)
Browse files Browse the repository at this point in the history
* use t2 instances for rhel 6 ami

* syntax

* add asgs to temp and change default tags
  • Loading branch information
robertsweetman authored Apr 3, 2024
1 parent bd5751d commit 1ff359b
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ locals {
vpc_security_group_ids = ["web"]
})
tags = {
os-type = "Linux"
component = "onr_web"
ami = "base_rhel_7_9"
os-type = "Linux"
component = "web"
server-type = "onr-web"
}
# FIXME: ebs_volumes list is NOT YET CORRECT and will need to change
ebs_volumes = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,20 @@ locals {
# instance_type = "t3.large"
# })
# })
# NOTE: Sadly rhel 6 ami's (below) do not support ASGs due to ELB networking constraints
dev-boe-a = merge(local.defaults_boe_ec2,
{
config = merge(local.defaults_boe_ec2.config, {
availability_zone = "${local.region}a"
})
instance = merge(local.defaults_boe_ec2.instance, {
instance_type = "t3.large"
})
user_data_cloud_init = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible, {
args = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible.args, {
branch = "main"
})
})
})
}
# dev-boe-a = merge(local.defaults_boe_ec2,
# {
# config = merge(local.defaults_boe_ec2.config, {
# availability_zone = "${local.region}a"
# })
# instance = merge(local.defaults_boe_ec2.instance, {
# instance_type = "t2.large"
# })
# user_data_cloud_init = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible, {
# args = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible.args, {
# branch = "main"
# })
# })
# })
# dev-bods-a = merge(local.defaults_bods_ec2,
# {
# config = merge(local.defaults_bods_ec2.config, {
Expand All @@ -38,7 +36,7 @@ locals {
# instance_type = "t3.large"
# })
# })
# }
}

baseline_ec2_autoscaling_groups = {
dev-web-asg = merge(local.defaults_web_ec2.config, {
Expand All @@ -58,6 +56,35 @@ locals {
})
autoscaling_schedules = module.baseline_presets.ec2_autoscaling_schedules.working_hours
})
dev-boe-asg = merge(local.defaults_boe_ec2, {
config = merge(local.defaults_boe_ec2.config, {
availability_zone = "${local.region}a"
})
instance = merge(local.defaults_boe_ec2.instance, {
instance_type = "t2.large"
})
user_data_cloud_init = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible, {
args = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible.args, {
branch = "main"
})
})
autoscaling_group = merge(module.baseline_presets.ec2_autoscaling_group.default, {
desired_capacity = 0
})
autoscaling_schedules = module.baseline_presets.ec2_autoscaling_schedules.working_hours
})
dev-bods-asg = merge(local.defaults_bods_ec2, {
config = merge(local.defaults_bods_ec2.config,{
availability_zone = "${local.region}a"
})
instance = merge(local.defaults_bods_ec2.instance, {
instance_type = "t3.large"
})
autoscaling_group = merge(module.baseline_presets.ec2_autoscaling_group.default, {
desired_capacity = 0
})
autoscaling_schedules = module.baseline_presets.ec2_autoscaling_schedules.working_hours
})
}
}
}
Expand Down
48 changes: 48 additions & 0 deletions terraform/environments/oasys-national-reporting/locals_test.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,53 @@ locals {

# baseline config
test_config = {
baseline_ec2_autoscaling_groups = {
test-web-asg = merge(local.defaults_web_ec2.config, {
config = merge(local.defaults_web_ec2.config, {
availability_zone = "${local.region}a"
})
instance = merge(local.defaults_web_ec2.instance, {
instance_type = "t3.large"
})
user_data_cloud_init = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible, {
args = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible.args, {
branch = "main"
})
})
autoscaling_group = merge(module.baseline_presets.ec2_autoscaling_group.default, {
desired_capacity = 0
})
autoscaling_schedules = module.baseline_presets.ec2_autoscaling_schedules.working_hours
})
test-boe-asg = merge(local.defaults_boe_ec2, {
config = merge(local.defaults_boe_ec2.config, {
availability_zone = "${local.region}a"
})
instance = merge(local.defaults_boe_ec2.instance, {
instance_type = "t2.large"
})
user_data_cloud_init = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible, {
args = merge(module.baseline_presets.ec2_instance.user_data_cloud_init.ssm_agent_and_ansible.args, {
branch = "main"
})
})
autoscaling_group = merge(module.baseline_presets.ec2_autoscaling_group.default, {
desired_capacity = 0
})
autoscaling_schedules = module.baseline_presets.ec2_autoscaling_schedules.working_hours
})
test-bods-asg = merge(local.defaults_bods_ec2, {
config = merge(local.defaults_bods_ec2.config,{
availability_zone = "${local.region}a"
})
instance = merge(local.defaults_bods_ec2.instance, {
instance_type = "t3.large"
})
autoscaling_group = merge(module.baseline_presets.ec2_autoscaling_group.default, {
desired_capacity = 0
})
autoscaling_schedules = module.baseline_presets.ec2_autoscaling_schedules.working_hours
})
}
}
}

0 comments on commit 1ff359b

Please sign in to comment.