ansible-collections / ansible-collections/google.cloud

gcp_compute_region_disk ignores source_snapshot parameter

Open Beginner friendly
#736 1 comment 0 reactions 0 assignees View on GitHub
stale
Dominant language
Python
Stars
105
Forks
144
Avg merge
5d 10h
Merged PRs (30d)
4

Description

##### SUMMARY
When using the `gcp_compute_region_disk` module with the `source_snapshot` parameter, the parameter is ignored and an empty disk is created.
I believe this is due to the absence of `source_snapshot` from this modules `resource_to_request` function:
https://github.com/ansible-collections/google.cloud/blob/eec40d5ca1f684e22134f2613482e36ed4ecd17c/plugins/modules/gcp_compute_region_disk.py#L508

See the `gcp_compute_disk` module, which does work:
https://github.com/ansible-collections/google.cloud/blob/eec40d5ca1f684e22134f2613482e36ed4ecd17c/plugins/modules/gcp_compute_disk.py#L665

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
gcp_compute_region_disk

##### ANSIBLE VERSION
```paste below
2.14.18
```

##### COLLECTION VERSION
```paste below
1.1.3
```

##### CONFIGURATION
None changed

##### OS / ENVIRONMENT
Docker

##### STEPS TO REPRODUCE
Create a disk using the following snippet.
Inspect the created disk and see that it has no source snapshot.

```yaml
- name: Create disk
gcp_compute_region_disk:
project: my-project
name: my-disk
source_snapshot:
selfLink: "{{ data_disk_snapshot.resources[0].selfLink }}"
region: europe-north1
replica_zones:
- europe-north1-a
- europe-north1-b
```

##### EXPECTED RESULTS
A disk should be created from the specified source snapshot.

##### ACTUAL RESULTS
An empty disk was created, the `source_snapshot` parameter is not present in the GCP resource spec.

Contributor guide

Open the contributing guide

Research direction

Start in plugins/modules/gcp_compute_region_disk.py at the resource_to_request function referenced in the issue, then compare it with the corresponding function in gcp_compute_disk.py. Reproduce the YAML example against GCP and inspect the created regional disk; done means source_snapshot is included in the resource request and the disk is created from that snapshot.

Written by the indexing model from the issue text.

Assessment

Tech stack
gcp, python
Domain
cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.