github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/e2e/terraform/packer/windows-2016-amd64.pkr.hcl (about) 1 variable "build_sha" { 2 type = string 3 description = "the revision of the packer scripts building this image" 4 } 5 6 locals { 7 timestamp = regex_replace(timestamp(), "[- TZ:]", "") 8 version = "v3" 9 } 10 11 source "amazon-ebs" "latest_windows_2016" { 12 ami_name = "nomad-e2e-${local.version}-windows-2016-amd64-${local.timestamp}" 13 communicator = "ssh" 14 instance_type = "t2.medium" 15 region = "us-east-1" 16 user_data_file = "windows-2016-amd64/userdata.ps1" # enables ssh 17 ssh_timeout = "10m" 18 ssh_username = "Administrator" 19 20 source_ami_filter { 21 filters = { 22 name = "Windows_Server-2016-English-Full-Base-*" 23 root-device-type = "ebs" 24 virtualization-type = "hvm" 25 } 26 most_recent = true 27 owners = ["amazon"] 28 } 29 30 tags = { 31 OS = "Windows2016" 32 BuilderSha = var.build_sha 33 } 34 } 35 36 build { 37 sources = ["source.amazon-ebs.latest_windows_2016"] 38 39 provisioner "powershell" { 40 scripts = [ 41 "windows-2016-amd64/disable-windows-updates.ps1", 42 "windows-2016-amd64/fix-tls.ps1", 43 "windows-2016-amd64/install-nuget.ps1", 44 "windows-2016-amd64/install-docker.ps1", 45 "windows-2016-amd64/install-consul.ps1", 46 "windows-2016-amd64/install-nomad.ps1" 47 ] 48 } 49 50 # this restart is required for adding the "containers feature", but we can 51 # wait to do it until right before we do sysprep, which makes debugging 52 # builds slightly faster 53 provisioner "windows-restart" {} 54 55 provisioner "powershell" { 56 inline = [ 57 "C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SendWindowsIsReady.ps1 -Schedule", 58 "C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule", 59 "C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown" 60 ] 61 } 62 }