Skip to content

feat: support resolve: prefixed ami for launch-time resolution#4

Open
sgtoj wants to merge 1 commit into
mainfrom
feat/resolve-ami
Open

feat: support resolve: prefixed ami for launch-time resolution#4
sgtoj wants to merge 1 commit into
mainfrom
feat/resolve-ami

Conversation

@sgtoj

@sgtoj sgtoj commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

Adds an optional ami variable so users can pin instances to a resolve:ssm:* reference (or an explicit ami-* ID).

When a resolve:ssm:* value is supplied, it is passed straight through to the launch template's image_id. EC2 then resolves the SSM parameter to the latest AMI at instance launch time rather than at terraform apply time. This means ASG scale-ups / instance refreshes pick up the newest AMI without re-running Terraform.

Behavior

ami value Result
"" (default) Current behavior — SSM data source resolves latest AL2023 AMI at apply time
resolve:ssm:/path Passed through; EC2 resolves at launch time
ami-0123... Explicit AMI ID

Changes

  • variables.tf: new ami variable (default "") with validation restricting to empty, ami-*, or resolve:*
  • main.tf: local.image_id selects var.ami when set, else the existing SSM lookup; module image_id now uses local.image_id

Notes

Backwards compatible — default behavior is unchanged. terraform fmt passes locally; relying on CI for terraform validate (local provider download was unreliable).

adds an optional ami variable accepting an explicit ami-* id or a
resolve:ssm:* reference. when set, the value is passed through to the
launch template so ec2 resolves the ami at instance launch time rather
than at apply time. defaults to the apply-time ssm lookup when empty.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant