Terraform provider reference / resources / ssh_key

fiberax_ssh_key (Resource)

An SSH key in your account pool.

The pool belongs to the account, not to a project. A token of any of your projects sees every key you have, adds to the same pool and may delete any of them - that is how the product is built, not a flaw in the isolation. In practice: two configurations driven by tokens of DIFFERENT projects of one account see the same pool and will fight over it. Keep your keys in a single configuration.

An added key is not rolled out anywhere by itself: it becomes available to pick when creating a server. Both fields change only through recreation - this resource has no update.

Example Usage

# An SSH key in your account pool.
#
# THE POOL BELONGS TO THE WHOLE ACCOUNT, not to a project: a token issued for any of
# your projects sees all your keys and may delete any of them. With several projects,
# keep the keys in ONE configuration - otherwise two configurations fight over one pool.
resource "fiberax_ssh_key" "deploy" {
  name = "deploy@ci"

  # A trailing newline in the .pub file does no harm: the platform stores the material
  # trimmed, and the provider compares values by their substance, not byte by byte.
  public_key = file("~/.ssh/id_ed25519.pub")
}

# A key is not deployed anywhere by itself - it becomes available to choose when a
# server is created.
resource "fiberax_server" "web" {
  name           = "web-01"
  server_type_id = 4
  image          = "fcf9f69c8630904c1d6d73a821f4e674"

  cores     = 2
  memory_mb = 2048
  disk_gb   = 20

  ssh_keys    = [fiberax_ssh_key.deploy.id]
  public_ipv4 = { new = true }
}

Schema

Required

The platform cannot rename a key: changing this field recreates the resource.

This value is not a secret and is kept in state in the clear: the private half is not stored in the system at all.

Changing the material recreates the resource. Recreation goes in the order delete, then create: while the old key is still in the pool, its name is taken.

Read-Only

Import

Import is supported using the following syntax:

The terraform import command can be used, for example:

# An existing key is imported by its ID. IDs are visible in the client area and in the
# response of GET /v1/ssh-keys.
terraform import fiberax_ssh_key.deploy 58

Generated from the provider schema for version 0.3.0. How to install the provider: Terraform provider.