-
Notifications
You must be signed in to change notification settings - Fork 674
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_resource_key for COS does not nest HMAC object #1741
Comments
It seems the code only handles flat properties. |
I'm not clear with the issue but when I try the same we are able to access all credentials
In terraform statefile I can see data of secret listing all details |
First, I am creating the resource key, then trying to access the
The provider flattens them into
In other parts of the IBM terraform provider nested structures are handled correctly. |
Yes ....Its because of the limitation of datatypes in Terraform...We don't have any datatype which accepts the dynamic content with different types....So we used TypeMap to store the credentials which flatten because even the TypeMap can hold only elements with primitive types... |
It is a functional bug because it is unexpected to the user. The minimum would be to document it. |
@data-henrik this is my workaround: # Workaround because returned keys are not usable in terraform.
# TO BE CHANGED
locals {
access_key_id = {
for key,value in ibm_resource_key.cos_credentials.0.credentials:
"access_key_id" => value
if key == "cos_hmac_keys.access_key_id"
}
secret_access_key = {
for key,value in ibm_resource_key.cos_credentials.0.credentials:
"secret_access_key" => value
if key == "cos_hmac_keys.secret_access_key"
}
credentials = merge(local.access_key_id, local.secret_access_key)
} It will produce a usable terraform object in |
I didn't use any code, just "cos_hmac_keys.access_key_id" to get to the value. But first I had to discover the reason for the problem. |
I ran into this as well and needed slack to figure it out. I changed the issue #2180 to a documentation issue. |
I just ran into this again... Two solutions I can think of:
In my latest use case I wanted the json document. I was going to put it into a file and distribute it to an application that was using it. That way I could easily set up a test environment by copying the creds from the UI. |
…_json in resource_key resource and datasource
…_json in resource_key resource and datasource
…_json in resource_key resource and datasource
In trying to access the credentials for IBM Cloud Object Storage the nested parts with HMAC details are not accessible as expected via, e.g.,
credentials.cos_hmac_keys.access_key_id
, but it needscredentials["cos_hmac_keys.access_key_id"]
.Terraform Version
Run
terraform -v
to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.Affected Resource(s)
Please list the resources as a list, for example:
( - kubernetes_secret)
Terraform Configuration Files
Debug Output
terraform show -json
prints the key as:Expected Behavior
obtain HMAC details via
credentials.cos_hmac_keys.access_key_id
Actual Behavior
credentials["cos_hmac_keys.access_key_id"]
The text was updated successfully, but these errors were encountered: