change ami naming

This commit is contained in:
Mahmood Ali 2021-01-12 13:30:30 -05:00
parent 0af1509a77
commit 82637715cf
3 changed files with 13 additions and 5 deletions

View File

@ -1,3 +1,7 @@
locals {
ami_prefix = "nomad-e2e-v2"
}
resource "aws_instance" "server" {
ami = data.aws_ami.ubuntu_bionic_amd64.image_id
instance_type = var.instance_type
@ -60,7 +64,7 @@ data "aws_ami" "ubuntu_bionic_amd64" {
filter {
name = "name"
values = ["nomad-e2e-ubuntu-bionic-amd64-*"]
values = ["${local.ami_prefix}-ubuntu-bionic-amd64-*"]
}
filter {
@ -75,7 +79,7 @@ data "aws_ami" "windows_2016_amd64" {
filter {
name = "name"
values = ["nomad-e2e-windows-2016-amd64-*"]
values = ["${local.ami_prefix}-windows-2016-amd64-*"]
}
filter {

View File

@ -1,10 +1,11 @@
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
distro = "ubuntu-bionic-18.04-amd64-server-*"
version = "v2"
}
source "amazon-ebs" "latest_ubuntu_bionic" {
ami_name = "nomad-e2e-ubuntu-bionic-amd64-${local.timestamp}"
ami_name = "nomad-e2e-${local.version}-ubuntu-bionic-amd64-${local.timestamp}"
iam_instance_profile = "packer_build" // defined in nomad-e2e repo
instance_type = "t2.medium"
region = "us-east-1"

View File

@ -1,7 +1,10 @@
locals { timestamp = regex_replace(timestamp(), "[- TZ:]", "") }
locals {
timestamp = regex_replace(timestamp(), "[- TZ:]", "")
version = "v2"
}
source "amazon-ebs" "latest_windows_2016" {
ami_name = "nomad-e2e-windows-2016-amd64-${local.timestamp}"
ami_name = "nomad-e2e-${local.version}-windows-2016-amd64-${local.timestamp}"
communicator = "ssh"
instance_type = "t2.medium"
region = "us-east-1"