I would handle it like this. 1) run shell (not local) curl the metadata service and save it to a file, say /tmp/ipaddress
2) use file provisioner download to fet it to your machine. 3) in a shell-local script read the IP into a variable. On Mon, Jul 27, 2020, 15:05 Renato Marcandier <[email protected]> wrote: > > Hello guys, > > I am trying to run this conf.sh script against my new AWS VM from my mac > laptop. > When the VM is up and running I am using this AWS command to grab the IP, > however, from inside packer, I am not able to grab it, only from my shell > terminal. > Can you see the problem? > > If is there any better way to achieve it just let me know. > > > > Packer.json > https://gist.github.com/rmarcandier/4962e295b61c3cdf3338acedc8d898a0 > > > Conf.sh: > https://gist.github.com/rmarcandier/653b268a155e14454a1db3dffb071f5c > > > > Error: > > ==> amazon-ebs: Pausing at breakpoint provisioner with note "this is a > breakpoint 1". > ==> amazon-ebs: Press enter to continue. > ==> amazon-ebs: Running local shell script: > /var/folders/9q/pzl_rvls7svbpv86bfcydrsc0000gn/T/packer-shell332274264 > amazon-ebs: i-086b22975ad9648ed > ==> amazon-ebs: Pausing at breakpoint provisioner with note "this is a > breakpoint 2". > ==> amazon-ebs: Press enter to continue. > ==> amazon-ebs: Running local shell script: > /var/folders/9q/pzl_rvls7svbpv86bfcydrsc0000gn/T/packer-shell839414416 > amazon-ebs: > ==> amazon-ebs: Pausing at breakpoint provisioner with note "this is a > breakpoint 3". > ==> amazon-ebs: Press enter to continue. > ==> amazon-ebs: Running local shell script: ./conf.sh > ==> amazon-ebs: % Total % Received % Xferd Average Speed Time > Time Time Current > ==> amazon-ebs: Dload Upload Total > Spent Left Speed > ==> amazon-ebs: 0 0 0 0 0 0 0 0 --:--:-- > --:--:-- --:--:-- 0curl: (6) Could not resolve host: $AWS_INSTANCE_IP > ==> amazon-ebs: % Total % Received % Xferd Average Speed Time > Time Time Current > ==> amazon-ebs: Dload Upload Total > Spent Left Speed > ==> amazon-ebs: 0 0 0 0 0 0 0 0 --:--:-- > --:--:-- --:--:-- 0curl: (6) Could not resolve host: $AWS_INSTANCE_IP > ==> amazon-ebs: Provisioning step had errors: Running the cleanup > provisioner, if present... > ==> amazon-ebs: Terminating the source AWS instance... > ==> amazon-ebs: Cleaning up any extra volumes... > ==> amazon-ebs: No volumes to clean up, skipping > Build 'amazon-ebs' errored: Script exited with non-zero exit status: > 6.Allowed exit codes are: [0] > > ==> Some builds didn't complete successfully and had errors: > --> amazon-ebs: Script exited with non-zero exit status: 6.Allowed exit > codes are: [0] > > ==> Builds finished but no artifacts were created. > ❯ AWS (master) ✘ > > Regards > RG > > -- > This mailing list is governed under the HashiCorp Community Guidelines - > https://www.hashicorp.com/community-guidelines.html. Behavior in > violation of those guidelines may result in your removal from this mailing > list. > > GitHub Issues: https://github.com/hashicorp/packer/issues > IRC: #packer-tool on Freenode > --- > You received this message because you are subscribed to the Google Groups > "Packer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/packer-tool/7f4e253d-2928-43f9-a2ef-a3a39420273co%40googlegroups.com > <https://groups.google.com/d/msgid/packer-tool/7f4e253d-2928-43f9-a2ef-a3a39420273co%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list. GitHub Issues: https://github.com/hashicorp/packer/issues IRC: #packer-tool on Freenode --- You received this message because you are subscribed to the Google Groups "Packer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/CALz9Rt9fwfSfBi6J5%3D2Z%2B5wzmoUVNp5GjaYGXNfaVb7RSWyNcg%40mail.gmail.com.
