dtcloud_ssh_key (Resource)
Manages an SSH key that can be injected into a virtual machine at boot.
The API addresses keys by name and has no update endpoint, so the resource ID is the key name, and
changing either name or public_key replaces the key.
Example Usage
resource "dtcloud_ssh_key" "deploy" {
name = "deploy-key"
public_key = file("~/.ssh/id_ed25519.pub")
}
Schema
Required
name(String) The name of the SSH key. Used as the resource identifier. Changing this forces a new resource to be created.public_key(String) The public key material. Changing this forces a new resource to be created.
Optional
timeouts(Block, Optional) (see below for nested schema)
Read-Only
created_at(String) When the SSH key was created, in RFC 3339 format.fingerprint(String) The fingerprint of the SSH key.id(String) The ID of this resource.user_id(String) The ID of the user that owns the SSH key.
Nested Schema for timeouts
Optional:
create(String)
Behaviour worth knowing
- Trailing whitespace in
public_keyis ignored, so the newlinefile()usually adds does not show as a change. - A key the platform reports as deleted counts as gone and drops out of state.
Timeouts
Only create has a timeout, defaulting to 2 minutes. Creating a key is synchronous, so this bounds a
hung request rather than a wait. Override it with a timeouts block:
resource "dtcloud_ssh_key" "deploy" {
# ...
timeouts {
create = "5m"
}
}
Import
# SSH keys are addressed by name, not by id, so the name is the import id.
terraform import dtcloud_ssh_key.deploy deploy-key