Closed ralbertazzi closed 2 years ago
hi @ralbertazzi we will take a look at what is going on here and work to get it resolved in time for the next release. Most likely within the next two weeks. For now as you said the workaround is to continue using v1.0.9 of the Google Compute Packer plugin if OSLogin is required.
The latest release of the plugin does contain SSH enhancements for some of the new Linux distributions so this poses a problem if oslogin is borked. I'll take a look shortly to see if a fix can get out sooner.
@ralbertazzi I believe you are referring to the version of the Google Compute plugin (v1.0.10) and not the version of Packer itself which is currently at 1.8.2. Seeing as you are using HCL templates I'm pretty sure its the plugin version. But want to confirm for folks who might be following the ticket.
You are absolutely right, I edited my initial comment
Hello :wave: thanks again for reporting, this should be fixed by #105. The issue was due to the userinfo.email scope not being available when authenticating using a default token. The PRs contains the necessary updates to fix the issue. There are some test binaries available via the link below if you would like to test the fix.
As a workaround, until the fix is released, you can explicitly set the account file path in the configuration.
variable "credentials_file" {
type = string
default = env("GOOGLE_APPLICATION_CREDENTIALS")
}
source "googlecompute" "cos_image" {
use_os_login = true
account_file = var.credentials_file
// Other parameter omitted for simplicity
}
Overview of the Issue
Service account authentication with OSLogin does not work on Packer 1.0.10. Reverting to Packer 1.0.9 solved the issue. My wild guess is that this PR may have caused the issue
Reproduction Steps
Authentication is performed through both the
gcloud
CLI andGOOGLE_APPLICATION_CREDENTIALS
environment variable. They both use a service account key.Run
packer build
trying to provision a VM withuse_os_login = true
Plugin and Packer version
From
plugin version
: 1.0.10Simplified Packer Buildfile
Operating system and Environment details
Linux
Log Fragments and crash.log files