Skip to content

Instantly share code, notes, and snippets.

@rednuht
Created September 4, 2020 06:45
Show Gist options
  • Save rednuht/f2c62fbc47186e41d0f8e9707954bcc7 to your computer and use it in GitHub Desktop.
Save rednuht/f2c62fbc47186e41d0f8e9707954bcc7 to your computer and use it in GitHub Desktop.
{
"variables": {
"aws_access_key": "{{env `AWS_ACCESS_KEY_ID`}}",
"aws_secret_key": "{{env `AWS_SECRET_ACCESS_KEY`}}",
"token": "{{env `AWS_SESSION_TOKEN`}}",
"security_group_id": "{{env `security_group_id`}}",
"subnet_id": "{{env `subnet_id`}}",
"vpc_id": "{{env `vpc_id`}}",
"region": "eu-west-1",
},
"builders": [
{
"type": "amazon-ebs",
"vpc_id": "{{ user `vpc_id` }}",
"subnet_id": "{{ user `subnet_id` }}",
"security_group_id": "{{ user `security_group_id` }}",
"access_key": "{{ user `aws_access_key` }}",
"secret_key": "{{ user `aws_secret_key` }}",
"token": "{{ user `token` }}",
"region": "{{ user `region` }}",
"instance_type": "t3.large",
"encrypt_boot": true,
"ami_regions": ["{{ user `region` }}"],
"region_kms_key_ids": {
"{{ user `region` }}": ""
},
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "Windows_Server-2016-English-Full-Base*",
"root-device-type": "ebs"
},
"most_recent": true,
"owners": "amazon"
},
"launch_block_device_mappings": [
{
"device_name": "/dev/sda1",
"volume_size": 100,
"volume_type": "gp2",
"delete_on_termination": true
}
],
"ami_name": "unable-to-delete-snapshot",
"user_data_file": "...",
"communicator": "winrm",
"winrm_username": "Administrator",
"winrm_use_ssl": true,
"winrm_port": 5986,
"winrm_insecure": true,
"windows_password_timeout": "10m",
"tags": {
"Team": "MY_SPECIAL_TAG"
},
"run_tags": {
"Team": "MY_SPECIAL_TAG"
},
"run_volume_tags": {
"Team": "MY_SPECIAL_TAG"
},
"snapshot_tags": {
"Team": "MY_SPECIAL_TAG"
}
}
],
"provisioners": [
{
"type": "powershell",
"inline": [
"& C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\InitializeInstance.ps1 -Schedule",
"& C:\\ProgramData\\Amazon\\EC2-Windows\\Launch\\Scripts\\SysprepInstance.ps1 -NoShutdown"
]
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment