Skip to content

Commit

Permalink
feat: Expose variables to set AMI share permisions
Browse files Browse the repository at this point in the history
  • Loading branch information
leigholiver authored and mye956 committed Nov 4, 2024
1 parent 3123e48 commit 216f070
Show file tree
Hide file tree
Showing 14 changed files with 57 additions and 2 deletions.
3 changes: 3 additions & 0 deletions al1.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ source "amazon-ebs" "al1" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
user_data_file = "scripts/al1/user_data.sh"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
Expand Down
3 changes: 3 additions & 0 deletions al2.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ source "amazon-ebs" "al2" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2023.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2023" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2023arm.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2023arm" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
4 changes: 3 additions & 1 deletion al2023neu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2023neu" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand All @@ -32,4 +35,3 @@ source "amazon-ebs" "al2023neu" {
ami_version = "2023.0.${var.ami_version_al2023}"
}
}

3 changes: 3 additions & 0 deletions al2arm.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2arm" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2gpu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2gpu" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2inf.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2inf" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2keplergpu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2keplergpu" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2kernel5dot10.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2kernel5dot10" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2kernel5dot10arm.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2kernel5dot10arm" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
3 changes: 3 additions & 0 deletions al2kernel5dot10gpu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2kernel5dot10gpu" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand Down
4 changes: 3 additions & 1 deletion al2kernel5dot10inf.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ source "amazon-ebs" "al2kernel5dot10inf" {
most_recent = true
include_deprecated = true
}
ami_ou_arns = "${var.ami_ou_arns}"
ami_org_arns = "${var.ami_org_arns}"
ami_users = "${var.ami_users}"
ssh_interface = "public_ip"
ssh_username = "ec2-user"
tags = {
Expand All @@ -32,4 +35,3 @@ source "amazon-ebs" "al2kernel5dot10inf" {
ami_version = "2.0.${var.ami_version_al2}"
}
}

18 changes: 18 additions & 0 deletions variables.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -238,3 +238,21 @@ variable "ebs_csi_driver_version" {
description = "EBS CSI driver version to build AMI with."
default = ""
}

variable "ami_ou_arns" {
type = list(string)
description = "A list of Amazon Resource Names (ARN) of AWS Organizations organizational units (OU) that have access to launch the resulting AMI(s)."
default = []
}

variable "ami_org_arns" {
type = list(string)
description = "A list of Amazon Resource Names (ARN) of AWS Organizations that have access to launch the resulting AMI(s)."
default = []
}

variable "ami_users" {
type = list(string)
description = "A list of account IDs that have access to launch the resulting AMI(s)."
default = []
}

0 comments on commit 216f070

Please sign in to comment.