From 60c7d22ffbbc8747b0f5c33e87e13d239e36b29e Mon Sep 17 00:00:00 2001 From: Murcurio <35284740+Murcurio@users.noreply.github.com> Date: Fri, 1 Feb 2019 15:36:40 +1100 Subject: [PATCH] Change metadata url to FQDN If instance has a different DNS/search domain then "metadata" alone won't work. The FQDN of "metadata.google.internal" is included in hosts file, and will work regardless of DNS configuration. Alternatively the IP 169.254.169.254 can be used. --- builder/googlecompute/startup.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/googlecompute/startup.go b/builder/googlecompute/startup.go index 687afec98..18d6961ef 100644 --- a/builder/googlecompute/startup.go +++ b/builder/googlecompute/startup.go @@ -15,7 +15,7 @@ const StartupScriptStatusNotDone string = "notdone" var StartupScriptLinux string = fmt.Sprintf(`#!/usr/bin/env bash echo "Packer startup script starting." RETVAL=0 -BASEMETADATAURL=http://metadata/computeMetadata/v1/instance/ +BASEMETADATAURL=http://metadata.google.internal/computeMetadata/v1/instance/ GetMetadata () { echo "$(curl -f -H "Metadata-Flavor: Google" ${BASEMETADATAURL}/${1} 2> /dev/null)"