KeyError 'zone' when creating gcp_instance_template with pd-ssd
SUMMARY
When creating a simple gcp_compute_instance_template with disk params for persistend-disks, you will encounter zone issues. Specifying the zone parameter will result with a non allowed parameter "zone" error
ISSUE TYPE
- Bug Report
COMPONENT NAME
gcp_compute_instance_template
ANSIBLE VERSION
ansible 2.10.3
config file = /Users/test/Dev/go/src/github.com/myorg/my-backend/deployment/ansible/ansible.cfg
configured module search path = ['/Users/test/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/Cellar/ansible/2.10.3/libexec/lib/python3.9/site-packages/ansible
executable location = /usr/local/bin/ansible
python version = 3.9.0 (default, Nov 14 2020, 10:50:03) [Clang 12.0.0 (clang-1200.0.32.27)]
CONFIGURATION
INVENTORY_ENABLED(/Users/test/Dev/go/src/github.com/myorg/my-backend/deployment/ansible/ansible.cfg) = ['gcp_compute']
OS / ENVIRONMENT
Mac OS Big Sur
STEPS TO REPRODUCE
Try to create a instance template from the official documentation, with disk init parameters
- name: Create the instance template for elasticsearch
gcp_compute_instance_template:
name: "{{ template_name }}"
project: "{{ project_id }}"
auth_kind: serviceaccount
service_account_file: "{{ credentials_file }}"
state: present
properties:
disks:
- auto_delete: 'true'
boot: 'true'
initialize_params:
source_image: projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts
disk_type: 'pd-ssd'
disk_size_gb: 10
machine_type: "{{ instance_type }}"
EXPECTED RESULTS
A created instance template
ACTUAL RESULTS
KeyError: 'zone'
I'm facing the same issue. It is not possible to create a new instance template (version) with a disk_type different to "default" (pd-standard). Is there any chance to get this fixed? Since end of February 2020 an potential fix exists (https://github.com/ansible/ansible/pull/67610/commits/14382c47f36bbde4a76353bf91cf46e573684199).