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

Adding fix for is instance profiles #85

Closed greyhoundforty closed 2 years ago

greyhoundforty commented 2 years ago

Prior to the proposed change, the code to list VPC instance profiles was failing due to a supposed Unsupported argument even though all three were expected.

Ansible Code used for testing

---
- name: List Instance Profiles
  hosts: localhost
  vars:
    region: "{{ lookup('env', 'IC_REGION') }}"
    resource_group: "{{ lookup('env', 'IC_RESOURCE_GROUP') }}"
  collections:
   - ibm.cloudcollection

  tasks:
    - ibm_is_instance_profiles_info:
        region: "{{ region }}"
      register: instance_profiles_list

    - debug:
        var: instance_profiles_list.resource.profiles | list

Produced the error:

TASK [ibm_is_instance_profiles_info] ***********************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "", "rc": 1, "resource": {"_name": "ansible_20220201-094045", "_type": "ibm_is_instance_profiles", "target": "ibm_is_instance_profiles.ansible_20220201-094045"}, "stderr": "\nError: Unsupported argument\n\n  on ibm_is_instance_profiles_ansible_20220201-094045.tf line 2, in data \"ibm_is_instance_profiles\" \"ansible_20220201-094045\":\n   2:   region = \"us-south\"\n\nAn argument named \"region\" is not expected here.\n\n\nError: Unsupported argument\n\n  on ibm_is_instance_profiles_ansible_20220201-094045.tf line 3, in data \"ibm_is_instance_profiles\" \"ansible_20220201-094045\":\n   3:   ibmcloud_api_key = \"********\"\n\nAn argument named \"ibmcloud_api_key\" is not expected here.\n\n\nError: Unsupported argument\n\n  on ibm_is_instance_profiles_ansible_20220201-094045.tf line 4, in data \"ibm_is_instance_profiles\" \"ansible_20220201-094045\":\n   4:   generation = 2\n\nAn argument named \"generation\" is not expected here.\n\n", "stderr_lines": ["", "Error: Unsupported argument", "", "  on ibm_is_instance_profiles_ansible_20220201-094045.tf line 2, in data \"ibm_is_instance_profiles\" \"ansible_20220201-094045\":", "   2:   region = \"us-south\"", "", "An argument named \"region\" is not expected here.", "", "", "Error: Unsupported argument", "", "  on ibm_is_instance_profiles_ansible_20220201-094045.tf line 3, in data \"ibm_is_instance_profiles\" \"ansible_20220201-094045\":", "   3:   ibmcloud_api_key = \"********\"", "", "An argument named \"ibmcloud_api_key\" is not expected here.", "", "", "Error: Unsupported argument", "", "  on ibm_is_instance_profiles_ansible_20220201-094045.tf line 4, in data \"ibm_is_instance_profiles\" \"ansible_20220201-094045\":", "   4:   generation = 2", "", "An argument named \"generation\" is not expected here.", ""], "stdout": "\nWarning: Argument is deprecated\n\nThe generation field is deprecated and will be removed after couple of\nreleases\n\n", "stdout_lines": ["", "Warning: Argument is deprecated", "", "The generation field is deprecated and will be removed after couple of", "releases", ""]}
greyhoundforty commented 2 years ago

Fixes #82

kavya498 commented 2 years ago

@greyhoundforty , modules folder is auto-generated.. @Anil-CM , can you please help fix this issue..

greyhoundforty commented 2 years ago

Ah, thanks for the update @kavya498 . Are there guides for generating these myself when I want to test something?

jaywcarman commented 2 years ago

@greyhoundforty The generator code is not open source. I just sent a PM with more info.

jimccann-rh commented 2 years ago

Curious is this going to get merged?? Seems to be a simple fix.

jimccann-rh commented 2 years ago

Thanks!