Hi all!
Running via terminal produces the expected result of installing the agent whilst running via packer causes the following failure:
==> googlecompute: Failed to download metadata for repo 'google-cloud-logging'
==> googlecompute: Error: Failed to download metadata for repo 'google-cloud-logging'
Now I understand that this looks a lot like the "I'm using /sh instead of /bash" from the
https://packer.io/docs/provisioners/shell.html#troubleshooting section of the documentation. However this is not the case as I explicitly run the script with bash and have verified that it is being run with bash through packer in a couple of different ways.
I've included a replication case below that can easily be spun up by anyone with a Google Cloud Project. Hopefully someone here can see what is going wrong?
Thanks!
{
"variables": {},
"builders": [{
"type": "googlecompute",
"ssh_username": "provisioning",
"source_image_family": "centos-8",
"zone": "europe-west1-b",
"disable_default_service_account": true,
"image_name": "centos-8-base-{{isotime \"2006-01-02\"}}"
}],
"provisioners": [
{
"type": "shell",
"inline": [
"sudo yum upgrade -y"
]
},
{
"type": "shell",
"inline": [
"curl -sL https://dl.google.com/cloudagents/install-logging-agent.sh | sudo bash -"
]
}
]
}