Terraform provider reference / resources / object_storage_access_key

fiberax_object_storage_access_key (Resource)

An S3 access key of the object storage project: full access to every bucket of the project. For a key limited to one bucket use fiberax_object_storage_service_account.

The resource has no arguments: each one is a new key.

THE SECRET LIVES IN STATE. The platform returns the secret only in the answer that created the key, so the provider keeps it in the sensitive attribute secret_access_key - and the state file holds it in the clear. Keep the state where secrets may be kept.

On import there is no secret: reads never carry it, so secret_access_key stays empty. To get it, call the API action POST /v1/object-storage/access-keys/{access_key_id}/actions/reveal-secret (the provider has no actions), or replace the key.

The last key of a project cannot be deleted (object_storage_last_access_key). To rotate a key with terraform apply -replace, give it lifecycle { create_before_destroy = true }: the new key is created first and the old one is deleted after - and whoever uses the old secret must be given the new one in the same run.

Example Usage

# A key with full access to every bucket of the project. The secret is set only when the key
# is created here, and it is kept in state - keep the state where secrets may be kept.
resource "fiberax_object_storage_access_key" "ci" {
  provider = fiberax.storage

  # Rotate with terraform apply -replace: the new key comes first, the old one goes after.
  # Without this a project's only key cannot be replaced - the last key is never deleted.
  lifecycle {
    create_before_destroy = true
  }
}

output "ci_access_key_id" {
  value = fiberax_object_storage_access_key.ci.access_key_id
}

output "ci_secret_access_key" {
  value     = fiberax_object_storage_access_key.ci.secret_access_key
  sensitive = true
}

Schema

Read-Only

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# A key is imported by its access key ID. Reads never return the secret, so after import
# secret_access_key is empty: show it with the API action
# POST /v1/object-storage/access-keys/{access_key_id}/actions/reveal-secret, or replace the key.
terraform import fiberax_object_storage_access_key.ci AKIAEXAMPLE0000000000

Generated from the provider schema for version 0.11.0. How to install the provider: Terraform provider.