packer AMI extraction changes

This commit is contained in:
Edward Viaene
2018-10-24 13:50:37 +00:00
parent 15c97a29ac
commit 099944bf18
+2 -2
View File
@@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
packer build -machine-readable packer-example.json | tee build.log ARTIFACT=`packer build -machine-readable packer-example.json |awk -F, '$0 ~/artifact,0,id/ {print $6}'`
AMI_ID=`egrep -oe 'ami-.{8}' build.log |tail -n1` AMI_ID=`echo $ARTIFACT | cut -d ':' -f2`
echo 'variable "AMI_ID" { default = "'${AMI_ID}'" }' > amivar.tf echo 'variable "AMI_ID" { default = "'${AMI_ID}'" }' > amivar.tf
terraform init terraform init
terraform apply terraform apply