Try using source_image instead of source_image_family and point out the
exact image. Also verify that you can launch an instance from that image
with the gcloud command on the same host running Packer with the same
credentials.

On Thu, Jan 9, 2020, 17:21 Dimitar Dimov <dzdi...@gmail.com> wrote:

> I've been using the tools from HashiCorp (Packer and Terraform) to create
> images and then build VMs by using Jenkins on AWS. Now I have a project
> that is on GCloud and I have successfully configured Terraform to create a
> VM but when I try to run packer I get the following error root@packer
> packer]# packer build createImage.json
>
> googlecompute output will be in this color.
>
> ==> googlecompute: Checking image does not exist...
> ==> googlecompute: Creating temporary SSH key for instance...
> ==> googlecompute: Error getting source image for instance creation: Could 
> not find image, centos-7, in projects, [persuasive-axe-264518 centos-cloud 
> coreos-cloud debian-cloud google-containers opensuse-cloud rhel-cloud 
> suse-cloud ubuntu-os-cloud windows-cloud gce-nvme]: 11 error(s) occurred:
> ==> googlecompute:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> ==> googlecompute: * googleapi: got HTTP response code 400 with body:
> Build 'googlecompute' errored: Error getting source image for instance 
> creation: Could not find image, centos-7, in projects, [persuasive-axe-264518 
> centos-cloud coreos-cloud debian-cloud google-containers opensuse-cloud 
> rhel-cloud suse-cloud ubuntu-os-cloud windows-cloud gce-nvme]: 11 error(s) 
> occurred:
>
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
>
> ==> Some builds didn't complete successfully and had errors:
> --> googlecompute: Error getting source image for instance creation: Could 
> not find image, centos-7, in projects, [persuasive-axe-264518 centos-cloud 
> coreos-cloud debian-cloud google-containers opensuse-cloud rhel-cloud 
> suse-cloud ubuntu-os-cloud windows-cloud gce-nvme]: 11 error(s) occurred:
>
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
> * googleapi: got HTTP response code 400 with body:
>
> ==> Builds finished but no artifacts were created.
>
> This is my createImage.json
>
> {
>  "variables": {
>     "project_id": "persuasive-axe-264518"
>   },
>  "builders": [
>     {
>       "type": "googlecompute",
>       "region": "europe-west1",
>       "zone": "europe-west1-b",
>       "project_id": "{{user `project_id`}}",
>       "source_image_family": "centos-7",
>       "image_name": "My-Test-Image",
>       "disk_size": 10,
>       "machine_type": "f1-micro",
>       "ssh_username": "centos"
>     }
>   ]
> }
>
> I should mention that the service account that I am using is even given a
> owner permission just to be sure that I have no issues with the
> permissions. Does anybody has any idea why I have this issue while on AWS
> it works great.
>
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in
> violation of those guidelines may result in your removal from this mailing
> list.
>
> GitHub Issues: https://github.com/mitchellh/packer/issues
> IRC: #packer-tool on Freenode
> ---
> You received this message because you are subscribed to the Google Groups
> "Packer" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to packer-tool+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/packer-tool/31c87536-32d5-4744-8ac5-1d03fca1fcaf%40googlegroups.com
> <https://groups.google.com/d/msgid/packer-tool/31c87536-32d5-4744-8ac5-1d03fca1fcaf%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to packer-tool+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/CALz9Rt_m5kypVig4ANEwWG1rchmc1e41TpLBkCmfNhx7OnwZWQ%40mail.gmail.com.

Reply via email to