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