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.
The following task fails with a Terraform "unsupported argument" :
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:
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.