Tag the AMI at build time with something stable like a version number or timestamp, then use the aws_ami data source in Terraform with most_recent set and a filter on that tag to resolve the id at plan time. This removes the hand-off step entirely: Packer just builds and tags, Terraform always finds the latest matching AMI. The same pattern works for any consumer that needs the newest image without a manual lookup.

Context: Stack Overflow #37357618 (accepted answer, 25 votes): the asker builds an AMI with Packer and deploys infrastructure with Terraform, and wants the AMI id to flow into Terraform automatically instead of being pasted in by hand. The accepted answer flips the dependency: do not push the id from Packer, have Terraform look it up.