IBM-Cloud / ansible-collection-ibm

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs
Mozilla Public License 2.0
70 stars 73 forks source link

Unable to delete IBM Public gateway in VPC gen2 using Ansible destroy playbook #97

Open indirakalagara opened 2 years ago

indirakalagara commented 2 years ago

Team, We have created an ansbile playbook to create ROKS cluster on Gen2 VPC as well as delete using ibm ansible collection Playbook: https://github.com/cloud-native-toolkit/ansible-ibm-roks

However, Public gateway is not getting deleted , even though the delete task is completed successfully. Can you please help to resolve the issue. ?

You can recreate the issue using the playbooks https://github.com/cloud-native-toolkit/ansible-ibm-roks

jimccann-rh commented 2 years ago

I think what could be your issue is you have a subnet attachment.

Issue is that code does not work. Not sure how their code pasted testing on 'delete'.

I did my own test and NO go.

Notice 0 (zero) destroyed.

ok: [localhost] => { "changed": false, "invocation": { "module_args": { "generation": 2, "ibmcloud_api_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", "id": null, "public_gateway": "r014-62f9476e-152d-4a7a-8fba-7262cc59884c", "region": "us-east", "state": "absent", "subnet": "0777-cb3b4ebb-129e-4f1a-89d3-a2ae2360aa2d" } }, "rc": 0, "resource": {}, "stderr": "", "stderr_lines": [], "stdout": "\nWarning: Argument is deprecated\n\nThe generation field is deprecated and will be removed after couple of\nreleases\n\n\nDestroy complete! Resources: 0 destroyed.\n", "stdout_lines": [ "", "Warning: Argument is deprecated", "", "The generation field is deprecated and will be removed after couple of", "releases", "", "", "Destroy complete! Resources: 0 destroyed." ] }

This was my code it did NOT remove the attachment.

- name: REMOVE VPC Gateway Attachment
  ibm_is_subnet_public_gateway_attachment:
    public_gateway: "{{ vpc_public_gateway.id }}"
    subnet: "{{ vars['vpc_subnet_' + vpc_subnet_public_gateway_attachment_name ].id }}"
    state: absent
  register: vpc_subnet_public_gateway_attachment_output