digitalocean_spaces_key
Generated on 17 Apr 2025
from Terraform version
v2.51.0
Provides a key resource for Spaces, DigitalOcean’s object storage product.
The Spaces API was designed to be interoperable with Amazon’s AWS S3 API. This allows users to interact with the service while using the tools they already know. Spaces mirrors S3’s authentication framework and requests to Spaces require a key pair similar to Amazon’s Access ID and Secret Key.
As a Spaces owner, you limit others’ access to your buckets using Spaces access keys. Access keys can provide several levels of permissions to create, destroy, read, and write to specific associated buckets. However, access keys only limit access to certain commands using the S3 API or CLI, not the control panel or other DigitalOcean resources.
Example Usage
Create a New Key
resource "digitalocean_spaces_key" "foobar" {
name = "foobar"
}
Create a New Key with Grants
resource "digitalocean_spaces_key" "foobar" {
name = "foobar"
grant {
bucket = "my-bucket"
permission = "read"
}
}
Create a New Key with full access
resource "digitalocean_spaces_key" "foobar" {
name = "foobar"
grant {
bucket = ""
permission = "fullaccess"
}
}
Argument Reference
The following arguments are supported:
name
- (Required) The name of the keygrant
- (Optional) A grant for the key (documented below).
The grant
object supports the following:
bucket
- (Required) Name of the bucket associated with this grant. In case of afullaccess
permission, this value should be an empty string.permission
- (Required) Permission associated with this grant. Values can beread
,readwrite
,fullaccess
.
Attributes Reference
The following attributes are exported:
name
- The name of the keygrant
- The list of grants associated with the keyaccess_key
- The access key ID of the keysecret_key
- The access key secret of the keycreated_at
- The creation time of the key