terraform-provider-stackitp.../docs/resources/key_pair.md
2024-11-12 17:45:43 +01:00

76 lines
2.6 KiB
Markdown

---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_key_pair Resource - stackit"
subcategory: ""
description: |-
Key pair resource schema. Must have a region specified in the provider configuration. Allows uploading an SSH public key to be used for server authentication.
Usage with server
```terraform
resource "stackitkeypair" "keypair" {
name = "example-key-pair"
publickey = chomp(file("path/to/idrsa.pub"))
}
resource "stackitserver" "example-server" {
projectid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-server"
bootvolume = {
size = 64
sourcetype = "image"
sourceid = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
availabilityzone = "eu01-1"
machinetype = "g1.1"
keypairname = "example-key-pair"
}
```
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources.
---
# stackit_key_pair (Resource)
Key pair resource schema. Must have a `region` specified in the provider configuration. Allows uploading an SSH public key to be used for server authentication.
### Usage with server
```terraform
resource "stackit_key_pair" "keypair" {
name = "example-key-pair"
public_key = chomp(file("path/to/id_rsa.pub"))
}
resource "stackit_server" "example-server" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
name = "example-server"
boot_volume = {
size = 64
source_type = "image"
source_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
availability_zone = "eu01-1"
machine_type = "g1.1"
keypair_name = "example-key-pair"
}
```
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.
<!-- schema generated by tfplugindocs -->
## Schema
### Required
- `name` (String) The name of the SSH key pair.
- `public_key` (String) A string representation of the public SSH key. E.g., `ssh-rsa <key_data>` or `ssh-ed25519 <key-data>`.
### Optional
- `labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container.
### Read-Only
- `fingerprint` (String) The fingerprint of the public SSH key.
- `id` (String) Terraform's internal resource ID. It takes the value of the key pair "`name`".