mirror of
https://github.com/farcasclaudiu/terraform-course.git
synced 2026-06-22 05:01:55 +03:00
packer AMI extraction changes
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
packer build -machine-readable packer-example.json | tee build.log
|
||||
AMI_ID=`egrep -oe 'ami-.{8}' build.log |tail -n1`
|
||||
ARTIFACT=`packer build -machine-readable packer-example.json |awk -F, '$0 ~/artifact,0,id/ {print $6}'`
|
||||
AMI_ID=`echo $ARTIFACT | cut -d ':' -f2`
|
||||
echo 'variable "AMI_ID" { default = "'${AMI_ID}'" }' > amivar.tf
|
||||
terraform init
|
||||
terraform apply
|
||||
|
||||
Reference in New Issue
Block a user