2015-03-06 19:00:41 +01:00
|
|
|
---
|
|
|
|
layout: "digitalocean"
|
|
|
|
page_title: "DigitalOcean: digitalocean_ssh_key"
|
|
|
|
sidebar_current: "docs-do-resource-ssh-key"
|
|
|
|
description: |-
|
|
|
|
Provides a DigitalOcean SSH key resource.
|
|
|
|
---
|
|
|
|
|
|
|
|
# digitalocean\_ssh_key
|
|
|
|
|
|
|
|
Provides a DigitalOcean SSH key resource to allow you manage SSH
|
|
|
|
keys for Droplet access. Keys created with this resource
|
|
|
|
can be referenced in your droplet configuration via their ID or
|
|
|
|
fingerprint.
|
|
|
|
|
|
|
|
## Example Usage
|
|
|
|
|
2017-04-17 12:17:54 +02:00
|
|
|
```hcl
|
2015-03-06 19:00:41 +01:00
|
|
|
# Create a new SSH key
|
|
|
|
resource "digitalocean_ssh_key" "default" {
|
2017-02-18 23:48:50 +01:00
|
|
|
name = "Terraform Example"
|
|
|
|
public_key = "${file("/Users/terraform/.ssh/id_rsa.pub")}"
|
2015-03-06 19:00:41 +01:00
|
|
|
}
|
|
|
|
```
|
|
|
|
|
|
|
|
## Argument Reference
|
|
|
|
|
|
|
|
The following arguments are supported:
|
|
|
|
|
|
|
|
* `name` - (Required) The name of the SSH key for identification
|
|
|
|
* `public_key` - (Required) The public key. If this is a file, it
|
|
|
|
can be read using the file interpolation function
|
|
|
|
|
|
|
|
## Attributes Reference
|
|
|
|
|
|
|
|
The following attributes are exported:
|
|
|
|
|
|
|
|
* `id` - The unique ID of the key
|
|
|
|
* `name` - The name of the SSH key
|
|
|
|
* `public_key` - The text of the public key
|
|
|
|
* `fingerprint` - The fingerprint of the SSH key
|
2016-07-19 18:22:30 +02:00
|
|
|
|
|
|
|
## Import
|
|
|
|
|
2017-02-18 23:48:50 +01:00
|
|
|
SSH Keys can be imported using the `ssh key id`, e.g.
|
2016-07-19 18:22:30 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
terraform import digitalocean_ssh_key.mykey 263654
|
|
|
|
```
|