| --- | |
| layout: "cloudstack" | |
| page_title: "CloudStack: cloudstack_ssh_keypair" | |
| sidebar_current: "docs-cloudstack-resource-ssh-keypair" | |
| description: |- | |
| Creates or registers an SSH key pair. | |
| --- | |
| # cloudstack_ssh_keypair | |
| Creates or registers an SSH key pair. | |
| ## Example Usage | |
| ```hcl | |
| resource "cloudstack_ssh_keypair" "default" { | |
| name = "myKey" | |
| public_key = "${file("~/.ssh/id_rsa.pub")}" | |
| project = "myProject" | |
| } | |
| ``` | |
| ## Argument Reference | |
| The following arguments are supported: | |
| * `name` - (Required) The name of the SSH key pair. This is a unique value | |
| within a CloudStack account. Changing this forces a new resource to be | |
| created. | |
| * `public_key` - (Optional) The public key to register with CloudStack. If | |
| this is omitted, CloudStack will generate a new key pair. The key can | |
| be loaded from a file on disk using the | |
| [`file()` function](https://www.terraform.io/docs/configuration/functions/file.html). | |
| Changing this forces a new resource to be created. | |
| * `project` - (Optional) The name or ID of the project to register this | |
| key to. Changing this forces a new resource to be created. | |
| ## Attributes Reference | |
| The following attributes are exported: | |
| * `id` - The key pair ID. | |
| * `fingerprint` - The fingerprint of the public key specified or created. | |
| * `private_key` - The private key generated by CloudStack. Only available | |
| if CloudStack generated the key pair. |