ansible-collections / ansible-collections/google.cloud

Unable to resize gcp disk through google.cloud.gcp_compute_disk

Open
#480 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
I am unable to resize the disk size through google.cloud.gcp_compute_disk.
The initial value for the disk size does not get updated to the new value

```
- hosts: localhost
tasks:
- name: create a disk
google.cloud.gcp_compute_disk:
name: test-disk
size_gb: 30
state: present
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_creds_type }}"
service_account_contents: "{{ gcp_creds }}"
zone: "{{ gcp_zone }}"

- name: resize the disk
google.cloud.gcp_compute_disk:
name: test-disk
size_gb: 60
state: present
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_creds_type }}"
service_account_contents: "{{ gcp_creds }}"
zone: "{{ gcp_zone }}"
```

##### ISSUE TYPE
- Bug Report

##### COMPONENT NAME
google.cloud.gcp_compute_disk.

##### ANSIBLE VERSION
```
ansible [core 2.11.6]
config file = /var/home/automate/eddie/infra-ansible-linux/ansible.cfg
configured module search path = ['/home/automate/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/automate/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/automate/.ansible/collections:/usr/share/ansible/collections
executable location = /home/automate/.local/bin/ansible
python version = 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
jinja version = 3.0.2
libyaml = True
```

##### COLLECTION VERSION

```paste below
# /home/automate/.ansible/collections/ansible_collections
Collection Version
----------------- -------
community.general 2.5.1

# /home/automate/.local/lib/python3.8/site-packages/ansible_collections
Collection Version
----------------- -------
community.general 3.8.1
```

##### CONFIGURATION

```paste below
DEFAULT_HOST_LIST(/var/home/automate/eddie/infra-ansible-linux/ansible.cfg) = ['/var/home/automate/eddie/infra-ansible-linux/inventory']
DEFAULT_ROLES_PATH(/var/home/automate/eddie/infra-ansible-linux/ansible.cfg) = ['/var/home/automate/eddie/infra-ansible-linux/roles', '/home/automate/.ansible/roles', '/var/home/automate/eddie/shared/roles']
DEFAULT_TIMEOUT(/var/home/automate/eddie/infra-ansible-linux/ansible.cfg) = 30
DEPRECATION_WARNINGS(/var/home/automate/eddie/infra-ansible-linux/ansible.cfg) = False
INVENTORY_IGNORE_EXTS(/var/home/automate/eddie/infra-ansible-linux/ansible.cfg) = ['~', '.orig', '.bak', '.cfg', '.retry', '.pyc', '.pyo']
```

##### OS / ENVIRONMENT

Ubuntu 20.04.4 LTS

##### STEPS TO REPRODUCE

```yaml
- hosts: localhost
tasks:
- name: create a disk
google.cloud.gcp_compute_disk:
name: test-disk
size_gb: 30
state: present
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_creds_type }}"
service_account_contents: "{{ gcp_creds }}"
zone: "{{ gcp_zone }}"

- name: resize the disk
google.cloud.gcp_compute_disk:
name: test-disk
size_gb: 60
state: present
project: "{{ gcp_project }}"
auth_kind: "{{ gcp_creds_type }}"
service_account_contents: "{{ gcp_creds }}"
zone: "{{ gcp_zone }}"
```

##### EXPECTED RESULTS

It should resize the disk to the new value

##### ACTUAL RESULTS

It does not resize the disk to the new value.

```paste below
PLAY [localhost] ************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************************
ok: [localhost]

TASK [create a disk] ********************************************************************************************************************************************************************************************
changed: [localhost]

TASK [resize the disk] ******************************************************************************************************************************************************************************************
changed: [localhost]

PLAY RECAP ******************************************************************************************************************************************************************************************************
localhost : ok=3 changed=2 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
```

Contributor guide

Open the contributing guide

Research direction

Start by locating the google.cloud.gcp_compute_disk module and trace how it handles an existing disk when size_gb changes. Reproduce the two-task playbook with a 30 GB disk followed by 60 GB, then verify that the second task actually resizes the disk and reports the correct result.

Written by the indexing model from the issue text.

Assessment

Tech stack
google-cloud, python
Domain
cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.