Skip to content

Commit

Permalink
Add legacy JSON example
Browse files Browse the repository at this point in the history
  • Loading branch information
nywilken committed Nov 3, 2023
1 parent 6de572b commit fa66efa
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
41 changes: 41 additions & 0 deletions example/instance-metadata/ubuntu-imdsv2-enabled.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"_comment": "Template used for testing issue 8157",
"variables": {
"region": "us-east-1"
},
"builders": [
{
"type": "amazon-ebs",
"ami_name": "packer-example-{{ timestamp }}",
"region": "{{ user `region`}}",
"instance_type": "t2.micro",
"source_ami_filter": {
"filters": {
"virtualization-type": "hvm",
"name": "ubuntu/images/*ubuntu-jammy-22.04-amd64-server-*",
"root-device-type": "ebs"
},
"owners": [
"099720109477"
],
"most_recent": true
},
"ssh_username": "ubuntu",
"communicator": "ssh",
"metadata_options":{
"http_endpoint" : "enabled",
"http_tokens": "required",
"http_put_response_hop_limit": 1
},
"imds_support":"v2.0"
}
],
"provisioners": [
{
"type": "shell",
"inline": [ "TOKEN=`curl -s -X PUT \"http://169.254.169.254/latest/api/token\" -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\"` && curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/"]
}
]
}


1 change: 0 additions & 1 deletion example/instance-metadata/ubuntu-imdsv2-enabled.pkr.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,4 @@ build {
provisioner "shell" {
inline = ["TOKEN=`curl -s -X PUT \"http://169.254.169.254/latest/api/token\" -H \"X-aws-ec2-metadata-token-ttl-seconds: 21600\"` && curl -H \"X-aws-ec2-metadata-token: $TOKEN\" -s http://169.254.169.254/latest/meta-data/"]
}
provisioner "breakpoint" {}
}

0 comments on commit fa66efa

Please sign in to comment.