Skip to content

Commit

Permalink
Merge branch 'main' into choose-userdata
Browse files Browse the repository at this point in the history
  • Loading branch information
hskiba authored Oct 31, 2024
2 parents 04431c9 + 15f8160 commit 1e494d9
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 1 deletion.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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"]
}
]
}
}
```
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,7 @@ resource "aws_lambda_function" "database_lambda" {
WEBSERVER_HTTP_PORT = var.turbo_deploy_http_port
WEBSERVER_HTTPS_PORT = var.turbo_deploy_https_port
USER_SCRIPTS = jsonencode(keys(var.user_scripts))
AMI_FILTERS = base64gzip(jsonencode(var.image_filter_groups))
}
}
}
Expand Down
27 changes: 26 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,29 @@ variable "public_key" {
description = "The default public key to be added to all deployed instances"
type = string
default = null
}
}

# 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"]
}
]
}
}

0 comments on commit 1e494d9

Please sign in to comment.