hashicorp / packer-plugin-googlecompute

Packer plugin for Google Compute Builder
https://www.packer.io/docs/builders/googlecompute
Mozilla Public License 2.0
25 stars 54 forks source link

Fix OsLogin authentication when running Packer with GCE service account #105

Closed nywilken closed 2 years ago

nywilken commented 2 years ago

The userinfo.email auth scope is required for obtaining access to the service account email associated with a token. Previously this scope was not provided resulting in no email information for the returned token. The email is needed for properly importing an OsLogin SSH key, thus causing a regression when using use_os_login with the DefaultTokenSource authentication method.

Closes #82

Test results before change

=== RUN   TestAccBuilder_DefaultTokenSource
    pluginacc.go:143: Error running plugin acceptance tests: Bad exit code. Logfile: packer_log_googlecompute-packer-default-ts.txt
        Logs can be found at /Users/wilkenrivera/Development/packer-plugin-googlecompute/builder/googlecompute/packer_log_googlecompute-packer-default-ts.txt
        and the acceptance test template can be found at /Users/wilkenrivera/Development/packer-plugin-googlecompute/builder/googlecompute/googlecompute-packer-default-ts.pkr.hcl
--- FAIL: TestAccBuilder_DefaultTokenSource (7.43s)

Test results after change

=== RUN   TestAccBuilder_DefaultTokenSource
--- PASS: TestAccBuilder_DefaultTokenSource (58.56s)