· 9 years ago · Dec 09, 2016, 02:48 AM
1{
2 "variables": {
3 "aws_access_key": "{{env `AWS_ACCESS_KEY`}}",
4 "aws_secret_key": "{{env `AWS_SECRET_KEY`}}"
5 },
6 "builders": [
7 {
8 "type": "amazon-ebs",
9 "access_key": "{{user `aws_access_key`}}",
10 "secret_key": "{{user `aws_secret_key`}}",
11 "region": "ap-southeast-2",
12 "source_ami": "ami-d97e40ba",
13 "instance_type": "c3.large",
14 "ami_name": "Win2016-PackerElevatedOutputBug",
15 "communicator": "winrm",
16 "winrm_username": "Administrator",
17 "windows_password_timeout": "20m",
18 "subnet_id": "subnet-11111111",
19 "associate_public_ip_address": true,
20 "security_group_id": "sg-11111111",
21 "user_data_file": "setup-winrm.txt"
22 }
23 ],
24 "provisioners": [
25 {
26 "type":"powershell",
27 "inline": [
28 "net user adminuser SuperS3cr3t /ADD",
29 "net localgroup Administrators adminuser /add"
30 ]
31 },
32 {
33 "type": "powershell",
34 "inline": "write-output 'Hello. This output should appear in the log during the packer run'",
35 "elevated_user": "adminuser",
36 "elevated_password": "SuperS3cr3t"
37 }
38 ]
39}