ansible-collections / ansible-collections/google.cloud
KeyError 'zone' when creating gcp_instance_template with pd-ssd
- Dominant language
- Python
- Stars
- 105
- Forks
- 144
- Avg merge
- 5d 10h
- Merged PRs (30d)
- 4
Description
##### 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
```paste below
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
```paste below
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
```yaml
- 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
```paste below
KeyError: 'zone'
```
Contributor guide
Research direction
Start with the gcp_compute_instance_template module and reproduce the documented YAML example with disk initialize_params using pd-ssd. Trace how the module handles the disk parameters and zone, then verify that the instance template is created without the KeyError or an invalid-parameter error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- gcp, python
- Domain
- cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100