Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ibm_iam_auth_token_info fails with unsupported argument #111

Open
rsumner opened this issue Feb 10, 2023 · 0 comments
Open

ibm_iam_auth_token_info fails with unsupported argument #111

rsumner opened this issue Feb 10, 2023 · 0 comments

Comments

@rsumner
Copy link

rsumner commented Feb 10, 2023

The following task fails with a Terraform "unsupported argument" :

    - name: Get IAM Auth Token
      ibm_iam_auth_token_info:
      environment:
        IC_REGION: "{{ region }}"
        IC_API_KEY: "{{ ibmcloud_api_key }}"
      register: ibm_auth_token

I've also tried passing ibmcloud_api_key and region as arguments to task rather than passing them in as variables, but the result is the same. Here's verbose info from the failure:

fatal: [localhost]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "iaas_classic_api_key": null,
            "iaas_classic_username": null,
            "ibmcloud_api_key": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "region": "us-east"
        }
    },
    "msg": "",
    "rc": 1,
    "resource": {
        "_name": "ansible_20230210-145757",
        "_type": "ibm_iam_auth_token",
        "target": "ibm_iam_auth_token.ansible_20230210-145757"
    },
    "stderr": "\nError: Unsupported argument\n\n  on ibm_iam_auth_token_ansible_20230210-145757.tf line 2, in data \"ibm_iam_auth_token\" \"ansible_20230210-145757\":\n   2:   region = \"us-east\"\n\nAn argument named \"region\" is not expected here.\n\n\nError: Unsupported argument\n\n  on ibm_iam_auth_token_ansible_20230210-145757.tf line 3, in data \"ibm_iam_auth_token\" \"ansible_20230210-145757\":\n   3:   ibmcloud_api_key = \"********\"\n\nAn argument named \"ibmcloud_api_key\" is not expected here.\n\n",
    "stderr_lines": [
        "",
        "Error: Unsupported argument",
        "",
        "  on ibm_iam_auth_token_ansible_20230210-145757.tf line 2, in data \"ibm_iam_auth_token\" \"ansible_20230210-145757\":",
        "   2:   region = \"us-east\"",
        "",
        "An argument named \"region\" is not expected here.",
        "",
        "",
        "Error: Unsupported argument",
        "",
        "  on ibm_iam_auth_token_ansible_20230210-145757.tf line 3, in data \"ibm_iam_auth_token\" \"ansible_20230210-145757\":",
        "   3:   ibmcloud_api_key = \"********\"",
        "",
        "An argument named \"ibmcloud_api_key\" is not expected here.",
        ""
    ],
    "stdout": "",
    "stdout_lines": []
}

Looking at the generated Terraform plan that was placed in /var/tmp/ansible/ibmcloud, I can see that it's passing "region" and "ibmcloud_api_key" arguments into "data ibm_iam_auth_token" resource definition and not into provider definition. According to the ibmcloud provider documentation, the data resource does not support arguments and they should be supplied as provider arguments or consume the env vars.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant