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

Not documented: how to access ibm_resource_key.objectstorage.credentials.cos_hmac_keys.access_key_id #2180

Closed
powellquiring opened this issue Jan 19, 2021 · 6 comments · Fixed by #3439
Labels
service/Object Storage Issues related to Cloud Object Storage

Comments

@powellquiring
Copy link

In the example below it is possible to access ibm_resource_key.objectstorage.credentials.apikey but not the cos_hmac_keys.access_key_id and cos_hmac_keys.secret_access_key

resource "ibm_resource_instance" "objectstorage" {
  name              = "objectstorage"
  service           = "cloud-object-storage"
  plan              = var.cloudobjectstorage_plan
  location          = var.cloudobjectstorage_location
  resource_group_id = data.ibm_resource_group.group.id
}

resource "ibm_resource_key" "objectstorage" {
  name                 = "${var.environment_name}-cos-hmac-secret"
  role                 = "Writer"
  resource_instance_id = ibm_resource_instance.objectstorage.id

  parameters = {
     HMAC: true
  }
}
resource "kubernetes_secret" "cos" {
  type = "ibm/ibmc-s3fs"
  metadata {
    name = var.environment_name
  }
  data = {
    access-key = ibm_resource_key.objectstorage.credentials.cos_hmac_keys.access_key_id
    res-conf-apikey = ibm_resource_key.objectstorage.credentials.apikey
  }
}
➜  terraform git:(master) ✗ tfa
Error: Unsupported attribute
  on main.tf line 89, in resource "kubernetes_secret" "cos":
  89:     access-key = ibm_resource_key.objectstorage.credentials.cos_hmac_keys.access_key_id
This value does not have any attributes.

Snippet of the tf state file:

    {
      "mode": "managed",
      "type": "ibm_resource_key",
      "name": "objectstorage",
      "provider": "provider[\"registry.terraform.io/ibm-cloud/ibm\"]",
      "instances": [
        {
          "schema_version": 0,
          "attributes": {
            "credentials": {
              "apikey": "nNPVNt3NyadauyadayadayadaghjbTyPFy",
              "cos_hmac_keys.access_key_id": "6c2722b0yadyadayadayadae0c43d973",
              "cos_hmac_keys.secret_access_key": "65b4yadayadayadayadafd1a92a193ab5a5eed3",
              "endpoints": "https://control.cloud-object-storage.cloud.ibm.com/v2/endpoints",

@data-henrik
Copy link
Contributor

see #1741

@data-henrik
Copy link
Contributor

@powellquiring
Copy link
Author

Duplicate of #1741

@powellquiring
Copy link
Author

This worked:

resource "kubernetes_secret" "cos" {
  type = "ibm/ibmc-s3fs"
  metadata {
    name = var.environment_name
  }

  data = {
    access-key = ibm_resource_key.objectstorage.credentials["cos_hmac_keys.access_key_id"]
    secret-key = ibm_resource_key.objectstorage.credentials["cos_hmac_keys.secret_access_key"]
    res-conf-apikey = ibm_resource_key.objectstorage.credentials.apikey
  }
}

Please assign this to someone on the doc team.

I could not figure this out. I guess each of the services need to contribute service specific docs when required here: https://cloud.ibm.com/docs/terraform?topic=terraform-resource-mgmt-resources#resource-key

Or does each service create it's own add in section that discusses unique contribution?

@powellquiring powellquiring changed the title Not possible to access ibm_resource_key.objectstorage.credentials.cos_hmac_keys.access_key_id Not documented: how to access ibm_resource_key.objectstorage.credentials.cos_hmac_keys.access_key_id Jan 19, 2021
@powellquiring powellquiring reopened this Jan 19, 2021
@kavya498 kavya498 added the service/Object Storage Issues related to Cloud Object Storage label Mar 30, 2021
@powellquiring
Copy link
Author

https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/resources/resource_key

image

This isn't a string. Document what it really is.

@hkantare
Copy link
Collaborator

hkantare commented Dec 6, 2021

We will look into the issue in upcoming sprint

kavya498 added a commit to kavya498/terraform-provider-ibm that referenced this issue Dec 14, 2021
…_json in resource_key resource and datasource
kavya498 added a commit to kavya498/terraform-provider-ibm that referenced this issue Dec 15, 2021
…_json in resource_key resource and datasource
kavya498 added a commit to kavya498/terraform-provider-ibm that referenced this issue Dec 15, 2021
…_json in resource_key resource and datasource
hkantare pushed a commit that referenced this issue Dec 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
service/Object Storage Issues related to Cloud Object Storage
Projects
None yet
4 participants