NEW: packer files and minor update to aws-assume-role.py

This commit is contained in:
xpk
2025-06-10 09:49:00 +08:00
parent af3d1fe7b7
commit 6c764730d3
2 changed files with 59 additions and 12 deletions
+39
View File
@@ -0,0 +1,39 @@
# Packer file which query for the latest RHEL9 AMI and print it
packer {
required_plugins {
amazon = {
source = "github.com/hashicorp/amazon"
version = "~> 1"
}
}
}
variable "aws_region" {
type = string
default = "${env("AWS_REGION")}"
}
data "amazon-ami" "rhel" {
filters = {
name = "RHEL-9.*HVM_GA*x86_64*GP3"
root-device-type = "ebs"
virtualization-type = "hvm"
}
most_recent = true
owners = ["amazon"]
region = "${var.aws_region}"
}
source "null" "local" {
communicator = "none"
}
build {
name = "query"
sources = ["null.local"]
provisioner "shell-local" {
inline = ["echo ${data.amazon-ami.rhel.id} ${data.amazon-ami.rhel.name}"]
}
}