Skip to content

Commit

Permalink
Merge pull request #24 from hic-infra/inline_script
Browse files Browse the repository at this point in the history
Custom script block defined in image config
  • Loading branch information
AaronJackson authored Nov 29, 2023
2 parents 2a2d180 + f0ae6ba commit 7724f4e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions templates/default.j2
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@

{% set s3_resources = s3_resources|default("",true) %}

{% set inline = (inline|default("echo \"Inline script.\"",true)).split("\n") %}

{% include template.name + ".pkr.hcl" %}
5 changes: 5 additions & 0 deletions templates/ubuntu.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ build {
]
}

provisioner "shell" {
remote_folder = "/opt/ami-setup"
inline = {{inline|tojson}}
}

post-processor "manifest" {
output = "builds/${var.ami-prefix}manifest.json"
strip_path = true
Expand Down
4 changes: 4 additions & 0 deletions templates/windows.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ build {
]
}

provisioner "powershell" {
inline = {{inline|tojson}}
}

provisioner "powershell" {
inline = [
# Re-initialise the AWS instance on startup
Expand Down

0 comments on commit 7724f4e

Please sign in to comment.