Skip to content

Commit

Permalink
Make AMI ID's configurable. (#39)
Browse files Browse the repository at this point in the history
* Support explicit batch AMI ID's

* Helps to get a ternary right.

* Bump swipe version.
  • Loading branch information
jgadling authored Jan 21, 2022
1 parent f146679 commit 4a4b91d
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module "batch_queue" {
vpc_id = module.batch_subnet[0].vpc_id
batch_subnet_ids = module.batch_subnet[0].batch_subnet_ids
}
ami_id = var.batch_ami_id
batch_ec2_instance_types = var.batch_ec2_instance_types
spot_min_vcpus = var.spot_min_vcpus
on_demand_min_vcpus = var.on_demand_min_vcpus
Expand Down
2 changes: 1 addition & 1 deletion terraform/modules/swipe-sfn-batch-queue/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ resource "aws_batch_compute_environment" "swipe_main" {
compute_resources {
instance_role = aws_iam_instance_profile.swipe_batch_main.arn
instance_type = var.batch_ec2_instance_types
image_id = data.aws_ssm_parameter.swipe_batch_ami.value
image_id = length(var.ami_id) > 0 ? var.ami_id : data.aws_ssm_parameter.swipe_batch_ami.value
ec2_key_pair = var.batch_ssh_key_pair_id != "" ? var.batch_ssh_key_pair_id : null
security_group_ids = [aws_security_group.swipe.id]
subnets = var.network_info.batch_subnet_ids
Expand Down
6 changes: 6 additions & 0 deletions terraform/modules/swipe-sfn-batch-queue/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ variable "batch_ssh_key_pair_id" {
type = string
}

variable "ami_id" {
description = "Override the default AMI image ID (default: latest AL2 ECS batch image)"
type = string
default = ""
}

variable "network_info" {
description = "VPC ID and subnet IDs within that VPC to use for AWS batch instances"
type = object({
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ variable "batch_ssh_public_key" {
default = ""
}

variable "batch_ami_id" {
description = "AMI ID to use (leave this empty to dynamically use the latest ECS optimized AMI)"
type = string
default = ""
}

variable "network_info" {
description = "VPC ID and subnet IDs within that VPC to use for AWS batch instances. If none is provided swipe will generate one"
type = object({
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.11.0-beta
v0.12.0-beta

0 comments on commit 4a4b91d

Please sign in to comment.