generated from cloudposse/terraform-example-module
-
-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Description
Describe the Feature
image_id - (Optional) The AMI from which to launch the instance or use a Systems Manager parameter convention e.g. resolve:ssm:parameter-name. See docs for more details.
The cloudposse asg module already supports this.
We should be able to modify this
terraform-aws-ecs-cluster/ec2.tf
Lines 1 to 4 in e8625ab
| data "aws_ssm_parameter" "ami" { | |
| count = local.enabled ? 1 : 0 | |
| name = "/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id" | |
| } |
and this
terraform-aws-ecs-cluster/ec2.tf
Line 48 in e8625ab
| image_id = each.value["image_id"] == null ? join("", data.aws_ssm_parameter.ami[*].value) : each.value["image_id"] |
with
variable "ssm_image_id" {
default = "/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id"
}data "aws_ssm_parameter" "ami" {
count = local.enabled ? 1 : 0
- name = "/aws/service/ecs/optimized-ami/amazon-linux-2/recommended/image_id"
+ name = var.ssm_image_id- image_id = each.value["image_id"] == null ? join("", data.aws_ssm_parameter.ami[*].value) : each.value["image_id"]
+ image_id = each.value["image_id"] == null ? "resolve:ssm:${var.ssm_image_id}" : each.value["image_id"]Expected Behavior
Use resolve:ssm directly in the launch template
Use Case
This allows us to never have to update the AMI again since the launch template will always use the latest that resolves in the upstream SSM parameter value
Describe Ideal Solution
Described above
Alternatives Considered
No response
Additional Context
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels