Resource

dcloud_iam_access_key

An access key of an IAM user: access_key_id and secret_key, used together as EWS-ACCESS-KEY <access_key_id>:<secret_key> (the provider's access_key). The secret is returned once, at create, and kept in state: protect the state as you would the key.

Example Usage

resource "dcloud_iam_user" "ci" {
  username = "ci"
  type     = "service_account"
}

resource "dcloud_iam_access_key" "ci" {
  iam_user_id = dcloud_iam_user.ci.id
  status      = "active"
}

# The value the CLI and this provider take as their access key.
output "ci_access_key" {
  value     = "${dcloud_iam_access_key.ci.access_key_id}:${dcloud_iam_access_key.ci.secret_key}"
  sensitive = true
}

Schema

Optional

  • act_as_member (Boolean) Must be true when iamUserId is another person’s own IAM user: everything done with the key is recorded as that person, and the audit entry names both Changing it replaces the resource.
  • description (String) What the key is for. Changing it replaces the resource.
  • expires_in_days (Number) Days until the key expires. Default: the organization's default (90); at most its maximum (365). Changing it replaces the key. Changing it replaces the resource.
  • iam_user_id (String) The IAM user the key belongs to. Default: the caller's own user. Changing it replaces the resource.
  • scope_policy (String) A policy document (JSON; use jsonencode) that caps the key: a request needs the IAM user's policies AND this document to allow it, e.g. S3 reads on one bucket. Changing it replaces the resource.
  • status (String) active, or inactive to stop the key working without deleting it. One of: active, inactive.

Read-Only

  • access_key_id (String) The public half, EWS1….
  • expires_at (String) When the key stops working. Every key expires.
  • id (String) The resource's id.
  • last_used_at (String) When the key last authenticated a request.
  • secret_key (String, Sensitive) The secret half. Returned only at create; empty after an import.

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# The secret is returned only at create: after an import `secret_key` is empty.
terraform import dcloud_iam_access_key.ci <access-key-id>

Generated from the provider's schema.