* chore(examples): Add import examples for all resources Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> * Add guide: How to import resources Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de> --------- Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
2.4 KiB
2.4 KiB
| page_title | subcategory | description |
|---|---|---|
| stackit_key_pair Resource - stackit | 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 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" } |
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
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"
}
Example Usage
# Create a key pair
resource "stackit_key_pair" "keypair" {
name = "example-key-pair"
public_key = chomp(file("path/to/id_rsa.pub"))
}
# Only use the import statement, if you want to import an existing key pair
import {
to = stackit_key_pair.import-example
id = var.keypair_name
}
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>orssh-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".