Skip to content

Commit 49786e2

Browse files
committed
Pass the revision down from ssm
1 parent 95f2cb5 commit 49786e2

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

packer/docs-rs-builder/builder.pkr.hcl

+10-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,16 @@ packer {
77
}
88
}
99

10+
data "amazon-parameterstore" "revision" {
11+
name = "/docs-rs/builder/sha"
12+
}
13+
14+
locals {
15+
revision = data.amazon-parameterstore.revision.value
16+
}
17+
1018
source "amazon-ebs" "ubuntu" {
11-
ami_name = "docs-rs-builder-${var.revision}"
19+
ami_name = "docs-rs-builder-${local.revision}"
1220
instance_type = "t2.large"
1321
region = "us-east-1"
1422
source_ami_filter {
@@ -41,5 +49,6 @@ build {
4149
playbook_file = "./play/playbook.yml"
4250
# The default is the user running packer
4351
user = "ubuntu"
52+
extra_arguments = [ "--extra-vars", "vars_repository_sha=${local.revision}"]
4453
}
4554
}

packer/docs-rs-builder/variables.pkr.hcl

-4
This file was deleted.

packer/packer

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ if __name__ == "__main__":
5151
parser = argparse.ArgumentParser()
5252
parser.add_argument("env")
5353
parser.add_argument("playbook")
54-
parser.add_argument('--var', action='append', help='Ansible variables as $key=$value')
54+
parser.add_argument('--var', action='append', help='Ansible variables as $key=$value', default=[])
5555
args = parser.parse_args()
5656

5757
workspace = create_workspace(args.env, args.playbook)

0 commit comments

Comments
 (0)