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

Provider panics when reading service api key with unretrievable apikey attribute #4616

Closed
lorepanichi opened this issue Jun 7, 2023 · 0 comments · Fixed by #4617
Closed
Labels
service/IAM Issues related to IAM

Comments

@lorepanichi
Copy link
Contributor

lorepanichi commented Jun 7, 2023

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform IBM Provider Version

1.53.0

Affected Resource(s)

  • ibm_iam_service_api_key

Terraform Configuration Files

resource "ibm_iam_service_id" "service_id" {
  name        = "test-service-id"
  description = "some service id"
}

resource "ibm_iam_service_api_key" "api_key" {
  name           = "test-api-key"
  description = "some api key"
  iam_service_id = ibm_iam_service_id.service_id.iam_id
  store_value    = false
}

Panic Output

crash.log

Expected Behavior

Refreshing state read resource op should complete without making provider crash.

Actual Behavior

This ibm sdk function will return an apiKey struct with *string Apikey set to nil when the apikey is unretrievable (see store_value parameter in the apidocs for a way to hide that sensitive value from key details).
That zero pointer is then dereferenced here, making the provider panic as reported in the log.

Steps to Reproduce

  1. Create a service api key with store_value set to false;
  2. Import the key into state invoking terraform as such:
terraform import ibm_iam_service_api_key.api_key ApiKey-xyz

Important Factoids

It's probably uncommon to hit this bug, because this one prevents any ibm_iam_service_api_key with unretrievable apikey to be created by terraform at all.

References

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

Successfully merging a pull request may close this issue.

1 participant