@@ -108,32 +108,6 @@ module "batch" {
108108 c_unmanaged = {
109109 name_prefix = " ec2_unmanaged"
110110 type = " UNMANAGED"
111-
112- compute_resources = {
113- type = " EC2"
114- allocation_strategy = " BEST_FIT_PROGRESSIVE"
115-
116- min_vcpus = 4
117- max_vcpus = 16
118- desired_vcpus = 4
119- instance_types = [" m4.large" , " m3.large" , " r4.large" , " r3.large" ]
120-
121- security_group_ids = [module.vpc_endpoint_security_group.security_group_id]
122- subnets = module.vpc.private_subnets
123-
124- ec2_configuration = {
125- image_id_override = data.aws_ami.ubuntu.image_id
126- }
127-
128- # Note - any tag changes here will force compute environment replacement
129- # which can lead to job queue conflicts. Only specify tags that will be static
130- # for the lifetime of the compute environment
131- tags = {
132- # This will set the name on the Ec2 instances launched by this compute environment
133- Name = " ${ local . name } -unmanaged"
134- Type = " Ec2UnManaged"
135- }
136- }
137111 }
138112 }
139113
@@ -144,6 +118,8 @@ module "batch" {
144118 state = " ENABLED"
145119 priority = 1
146120
121+ compute_environments = [" b_ec2_spot" ]
122+
147123 tags = {
148124 JobQueue = " Low priority job queue"
149125 }
@@ -225,7 +201,7 @@ module "batch" {
225201
226202module "vpc" {
227203 source = " terraform-aws-modules/vpc/aws"
228- version = " ~> 3 .0"
204+ version = " ~> 4 .0"
229205
230206 name = local. name
231207 cidr = " 10.99.0.0/18"
@@ -234,20 +210,14 @@ module "vpc" {
234210 public_subnets = [" 10.99.0.0/24" , " 10.99.1.0/24" , " 10.99.2.0/24" ]
235211 private_subnets = [" 10.99.3.0/24" , " 10.99.4.0/24" , " 10.99.5.0/24" ]
236212
237- enable_nat_gateway = true
238- single_nat_gateway = true
239- map_public_ip_on_launch = false
213+ enable_nat_gateway = true
214+ single_nat_gateway = true
240215
241216 public_route_table_tags = { Name = " ${ local . name } -public" }
242217 public_subnet_tags = { Name = " ${ local . name } -public" }
243218 private_route_table_tags = { Name = " ${ local . name } -private" }
244219 private_subnet_tags = { Name = " ${ local . name } -private" }
245220
246- manage_default_security_group = true
247- default_security_group_name = " ${ local . name } -default"
248- default_security_group_ingress = []
249- default_security_group_egress = []
250-
251221 enable_dhcp_options = true
252222 enable_dns_hostnames = true
253223 dhcp_options_domain_name = data. aws_region . current . name == " us-east-1" ? " ec2.internal" : " ${ data . aws_region . current . name } .compute.internal"
@@ -257,7 +227,7 @@ module "vpc" {
257227
258228module "vpc_endpoints" {
259229 source = " terraform-aws-modules/vpc/aws//modules/vpc-endpoints"
260- version = " ~> 3 .0"
230+ version = " ~> 4 .0"
261231
262232 vpc_id = module. vpc . vpc_id
263233 security_group_ids = [module . vpc_endpoint_security_group . security_group_id ]
@@ -317,16 +287,6 @@ module "vpc_endpoint_security_group" {
317287 tags = local. tags
318288}
319289
320- data "aws_ami" "ubuntu" {
321- owners = [" 099720109477" ]
322- most_recent = true
323-
324- filter {
325- name = " name"
326- values = [" ubuntu/images/hvm-ssd/ubuntu-*-20.04-amd64-server-*" ]
327- }
328- }
329-
330290resource "aws_cloudwatch_log_group" "this" {
331291 name = " /aws/batch/${ local . name } "
332292 retention_in_days = 1
0 commit comments