hashicorp / packer-plugin-googlecompute

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

Packer > GCE Timeout failer. #85

Open hc-github-team-packer opened 2 years ago

hc-github-team-packer commented 2 years ago

This issue was originally opened by @tallyhoJericho in https://github.com/hashicorp/packer/issues/11565 and has been migrated to this repository. The original issue description is below.


When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Packer build timing out still after a lot of effort.

A paragraph or two about the issue you're experiencing.

Trying to create a custom image in GCP. Times out every time. Spent hours trying to find the problem. Ended up being reduced down to the simple example in the documentation. Found here: https://www.packer.io/plugins/builders/googlecompute Still timing out. Cheers

Steps to reproduce this issue

Follow Steps on mac. Running outside of google option. https://www.packer.io/plugins/builders/googlecompute

Packer version

1.7.10

Simplified Packer Template

packer {
    required_plugins {
        googlecompute = {
            version = "~> 1.0.0"
            source = "github.com/hashicorp/googlecompute"
        }
    }
}

source "googlecompute" "basic-example" {
    project_id = "tftesting-341109"
    source_image_family = "debian-9"
    network = "default"
    ssh_username = "packer"
    zone = "us-central1-a"
}

build {
    sources = ["sources.googlecompute.basic-example"]
}

Operating system and Environment details

Windows 11 & Mac os Monterey

GFR-Intel-HQ@GFRIntelHQ packer % packer build . googlecompute.basic-example: output will be in this color.

==> googlecompute.basic-example: Checking image does not exist... ==> googlecompute.basic-example: Creating temporary RSA SSH key for instance... ==> googlecompute.basic-example: Using image: debian-9-stretch-v20220118 ==> googlecompute.basic-example: Creating instance... googlecompute.basic-example: Loading zone: us-central1-a googlecompute.basic-example: Loading machine type: n1-standard-1 googlecompute.basic-example: Requesting instance creation... googlecompute.basic-example: Waiting for creation operation to complete... ==> googlecompute.basic-example: Error creating instance: time out while waiting for instance to create Build 'googlecompute.basic-example' errored after 5 minutes 4 seconds: Error creating instance: time out while waiting for instance to create

==> Wait completed after 5 minutes 4 seconds

==> Some builds didn't complete successfully and had errors: --> googlecompute.basic-example: Error creating instance: time out while waiting for instance to create

==> Builds finished but no artifacts were created.

Set the env var PACKER_LOG=1 for maximum log detail.

nywilken commented 1 year ago

Hi @tallyhoJericho I am unable to reproduce this issue given that the instance creation does occur in under 2 minutes, which is before the timeout. Unfortunately build times do vary at times so the results of the examples may vary a little. If you are running into this issue often I would recommend bumping the timeout window via the state_timeout configuration argument.

I'm going to label this as a docs enhancement issue, as I think we could provide some guidance for users who are experiencing timeouts due to the state not be set to running in time. If interested I would be more than happy to review a PR if you wanted to open a documentation pull-request. Cheers!