Dimitar Dimov Thu, Jan 9, 5:21 PM (6 hours ago)
to Packer Unsubscribe
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": "PROJECT_ID"
},
"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.