jrweb247
jrweb247

Reputation: 95

googlecompute Error creating instance: time out while waiting for instance to create

I try to build the image with packer and it doesn't go as planned, from the beginning I have a timeout on the creation of the image and I can't find any help, someone has already had this problem? thanks

==> googlecompute: Checking image does not exist...
==> googlecompute: Creating temporary SSH key for instance...
==> googlecompute: Using image: debian-9-stretch-v20180105
==> googlecompute: Creating instance...
    googlecompute: Loading zone: europe-west1-d
    googlecompute: Loading machine type: n1-standard-1
    googlecompute: Requesting instance creation...
    googlecompute: Waiting for creation operation to complete...
==> googlecompute: Error creating instance: time out while waiting for instance to create
Build 'googlecompute' errored: Error creating instance: time out while waiting for instance to create

Upvotes: 0

Views: 3315

Answers (3)

SAGAR BHOOSHAN
SAGAR BHOOSHAN

Reputation: 329

The very reason why it could be failing is possibly you might be using a custom network other than default network. By default ingress ssh firewall rule is exists for default network only. So you need to create custom firewall rule for your network.

Check if ingress ssh firewall rule is available on the network used in packer config. If not create one as follows:

gcloud compute firewall-rules create my-ingress-ssh-rule \
--project=YOUR-PROJECT --description=my-ingress-ssh-rule-description \
--direction=INGRESS --priority=1000 \
--network=YOUR-NETWORK-IN-PACKER-CONFIG \
--action=ALLOW --rules=tcp:22 --source-ranges=0.0.0.0/0

Note: source-ranges=0.0.0.0/0 allows ssh from public, so keep that in mind.

Upvotes: 0

Prudhvi
Prudhvi

Reputation: 1

I still seeing the same issue with required roles for service account. Is their any other way to resolve this issue.

I am using packer-1.8.2 and googlecompute 1.0.13.

error image link

Upvotes: -1

ninohead
ninohead

Reputation: 364

I had a similar timeout error.

Solution was to have the correct role assigned to the service user. At least Compute Engine Instance Admin (v1) and Service Account User roles access should be assigned to the service user, using which you are trying to run the packer.

Upvotes: 3

Related Questions