diff --git a/README.md b/README.md index e588f3b..058ffb0 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,9 @@ While there are a few variables that can be configured through the module, the b - ec2_attributes By default, server sizes are automatically set but not AMIs and so you need to configure them +- image_filter_groups + + The AMIs that are listed in the Turbo Deploy interface is configured through the use of filters that are used by the AWS API, you can look through the full list of filters in this [AWS documentation](https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html) ## Example @@ -94,5 +97,35 @@ module "my_turbo_module" { ServerSizes = ["t3.medium", "t3.large", "t3.xlarge"] Amis = ["ami-0583d8c7a9c35822c", "ami-06338d230ffc3fc0c"] } + image_filter_groups = { + "alma-ami" = [ + { + name = "is-public" + values = ["true"] + }, + { + name = "name" + values = ["AlmaLinux OS*"] + }, + { + name = "state" + values = ["available"] + } + ] + "redhat-ami" = [ + { + name = "is-public" + values = ["true"] + }, + { + name = "name" + values = ["RHEL-9.4.0*"] + }, + { + name = "state" + values = ["available"] + } + ] + } } ``` diff --git a/main.tf b/main.tf index 9b9fdd5..f4232cc 100644 --- a/main.tf +++ b/main.tf @@ -446,6 +446,7 @@ resource "aws_lambda_function" "database_lambda" { WEBSERVER_HOSTNAME = var.turbo_deploy_hostname WEBSERVER_HTTP_PORT = var.turbo_deploy_http_port WEBSERVER_HTTPS_PORT = var.turbo_deploy_https_port + AMI_FILTERS = base64gzip(jsonencode(var.image_filter_groups)) } } } diff --git a/variables.tf b/variables.tf index a16e85f..9ebdd57 100644 --- a/variables.tf +++ b/variables.tf @@ -131,4 +131,29 @@ variable "public_key" { description = "The default public key to be added to all deployed instances" type = string default = null -} \ No newline at end of file +} + +# filter types can be found here https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeImages.html +variable "image_filter_groups" { + description = "Filter groups for different images" + type = map(list(object({ + name = string + values = list(string) + }))) + default = { + "alma-ami" = [ + { + name = "is-public" + values = ["true"] + }, + { + name = "name" + values = ["AlmaLinux OS*"] + }, + { + name = "state" + values = ["available"] + } + ] + } +}