hashicorp / hashicorp/packer-plugin-googlecompute
Plugin ignores missing `gcloud` when use_iap is enabled
- Dominant language
- Go
- Stars
- 33
- Forks
- 72
- Avg merge
- 6h 47m
- Merged PRs (30d)
- 3
Description
#### Overview of the Issue
If `gcloud` is not present and `use_iap` is enabled, the build emits a debug log but continues. This eventually times out because the IAP tunnel cannot be started.
Unless debug logging is enabled, there is no indication to the user. The plugin should raise this as an error and stop the build.
#### Reproduction Steps
1. Set `use_iap = true`
2. Remove `gcloud` from $PATH
3. Run a build with `PACKER_LOG=1`
4. Observe `gcloud not found` debug log
5. Build eventually times out waiting for the tunnel
Example logs:
```
==> googlecompute.octogate: Step Launch IAP Tunnel...
2026/02/10 17:23:27 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:27 Found available port: 8802 on IP: 0.0.0.0
2026/02/10 17:23:27 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:27 Setting up proxy to listen on localhost at 8802
2026/02/10 17:23:27 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:27 Creating tunnel launch script with args []string{"compute", "start-iap-tunnel", "packer-698b696b-40af-41d3-b87f-0814f53cacca", "22", "--local-host-port=localhost:8802", "--zone", "us-central1-c", "--project", ""}
2026/02/10 17:23:27 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:27 [INFO] (google): Prepending inline gcloud setup script with #!/bin/sh
2026/02/10 17:23:28 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:28 stderr: /tmp/gcloud-setup2367886896: 4: gcloud: not found
2026/02/10 17:23:29 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:29 Retryable error: retrying for state DONE, got RUNNING
2026/02/10 17:23:57 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:57 No error detected after tunnel launch; continuing...
2026/02/10 17:23:57 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:57 Using host value: localhost
2026/02/10 17:23:57 packer-plugin-googlecompute_v1.2.5_x5.0_linux_amd64 plugin: 2026/02/10 17:23:57 [INFO] Waiting for SSH, up to timeout: 5m0s
```
### Plugin and Packer version
From `packer version`
```hcl
packer {
required_plugins {
googlecompute = {
version = "~> 1.2"
source = "github.com/hashicorp/googlecompute"
}
}
}
```
Contributor guide
Assessment
This issue has not been assessed yet.