Skip to content

Commit

Permalink
Overrides for tags and run_tags (#303)
Browse files Browse the repository at this point in the history
Overrides for tags and run_tags
  • Loading branch information
guikcd authored Dec 3, 2024
1 parent d1415d3 commit 4b0cd07
Show file tree
Hide file tree
Showing 14 changed files with 155 additions and 104 deletions.
19 changes: 11 additions & 8 deletions al1.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al1 = "${var.ami_name_prefix_al1}${var.ami_version_al1}-amazon-ecs-optimized"
default_tags = {
os_version = "Amazon Linux"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al1}"
ecs_agent_version = "${var.ecs_version_al1}"
ami_type = "al1"
ami_version = "2018.03.${var.ami_version_al1}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al1" {
Expand Down Expand Up @@ -33,14 +42,8 @@ source "amazon-ebs" "al1" {
user_data_file = "scripts/al1/user_data.sh"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al1}"
ecs_agent_version = "${var.ecs_version_al1}"
ami_type = "al1"
ami_version = "2018.03.${var.ami_version_al1}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}

build {
Expand Down
19 changes: 11 additions & 8 deletions al2.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,15 @@ locals {
"69-available-updates-begin",
"71-available-updates-finish"
]
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2" {
Expand All @@ -32,14 +41,8 @@ source "amazon-ebs" "al2" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}

build {
Expand Down
19 changes: 11 additions & 8 deletions al2023.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2023 = "${var.ami_name_prefix_al2023}-hvm-2023.0.${var.ami_version_al2023}${var.kernel_version_al2023}-x86_64"
default_tags = {
os_version = "Amazon Linux 2023"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al2023}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2023"
ami_version = "2023.0.${var.ami_version_al2023}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2023" {
Expand All @@ -26,14 +35,8 @@ source "amazon-ebs" "al2023" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2023"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al2023}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2023"
ami_version = "2023.0.${var.ami_version_al2023}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}

build {
Expand Down
19 changes: 11 additions & 8 deletions al2023arm.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2023arm = "${var.ami_name_prefix_al2023}-hvm-2023.0.${var.ami_version_al2023}${var.kernel_version_al2023arm}-arm64"
default_tags = {
os_version = "Amazon Linux 2023"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al2023}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2023arm"
ami_version = "2023.0.${var.ami_version_al2023}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2023arm" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2023arm" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2023"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al2023}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2023arm"
ami_version = "2023.0.${var.ami_version_al2023}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2023neu.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2023neu = "${var.ami_name_prefix_al2023}-neuron-hvm-2023.0.${var.ami_version_al2023}${var.kernel_version_al2023}-x86_64"
default_tags = {
os_version = "Amazon Linux 2023"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al2023}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2023neu"
ami_version = "2023.0.${var.ami_version_al2023}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2023neu" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2023neu" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2023"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version_al2023}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2023neu"
ami_version = "2023.0.${var.ami_version_al2023}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2arm.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2arm = "${var.ami_name_prefix_al2}-hvm-2.0.${var.ami_version_al2}-arm64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2arm"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2arm" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2arm" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2arm"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2gpu.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2gpu = "${var.ami_name_prefix_al2}-gpu-hvm-2.0.${var.ami_version_al2}-x86_64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2gpu"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2gpu" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2gpu" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2gpu"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2inf.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2inf = "${var.ami_name_prefix_al2}-inf-hvm-2.0.${var.ami_version_al2}-x86_64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2inf"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2inf" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2inf" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2inf"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2keplergpu.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2keplergpu = "${var.ami_name_prefix_al2}-kepler-gpu-hvm-2.0.${var.ami_version_al2}-x86_64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2keplergpu"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2keplergpu" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2keplergpu" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2keplergpu"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2kernel5dot10.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2kernel5dot10 = "${var.ami_name_prefix_al2}-kernel-5.10-hvm-2.0.${var.ami_version_al2}-x86_64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2kernel5dot10" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2kernel5dot10" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2kernel5dot10arm.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2kernel5dot10arm = "${var.ami_name_prefix_al2}-kernel-5.10-hvm-2.0.${var.ami_version_al2}-arm64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10arm"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2kernel5dot10arm" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2kernel5dot10arm" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10arm"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2kernel5dot10gpu.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2kernel5dot10gpu = "${var.ami_name_prefix_al2}-kernel-5.10-gpu-hvm-2.0.${var.ami_version_al2}-x86_64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10gpu"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2kernel5dot10gpu" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2kernel5dot10gpu" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10gpu"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
19 changes: 11 additions & 8 deletions al2kernel5dot10inf.pkr.hcl
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
locals {
ami_name_al2kernel5dot10inf = "${var.ami_name_prefix_al2}-kernel-5.10-inf-hvm-2.0.${var.ami_version_al2}-x86_64-ebs"
default_tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10inf"
ami_version = "2.0.${var.ami_version_al2}"
}
merged_tags = merge("${local.default_tags}", "${var.tags}")
}

source "amazon-ebs" "al2kernel5dot10inf" {
Expand All @@ -26,12 +35,6 @@ source "amazon-ebs" "al2kernel5dot10inf" {
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
os_version = "Amazon Linux 2"
source_image_name = "{{ .SourceAMIName }}"
ecs_runtime_version = "Docker version ${var.docker_version}"
ecs_agent_version = "${var.ecs_agent_version}"
ami_type = "al2kernel5dot10inf"
ami_version = "2.0.${var.ami_version_al2}"
}
tags = "${local.merged_tags}"
run_tags = "${var.run_tags}"
}
Loading

0 comments on commit 4b0cd07

Please sign in to comment.