Up-to-date reference of API arguments for ECS key management you can get at documentation portal

opentelekomcloud_compute_keypair_v2

Manages a V2 keypair resource within OpenTelekomCloud.

~> Important Security Notice The private key generated by this resource will be stored unencrypted in your Terraform state file. Use of this resource for production deployments is not recommended. Instead, generate a private key file outside of Terraform and distribute it securely to the system where Terraform will be run.

Example Usage

Importing an SSH key

resource "opentelekomcloud_compute_keypair_v2" "import-keypair" {
  name       = "imported-keypair"
  public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB"
}

Creating an SSH key

resource "opentelekomcloud_compute_keypair_v2" "create-keypair" {
  name = "new-keypair"
}

Argument Reference

The following arguments are supported:

  • name - (Required) A unique name for the keypair. Changing this creates a new keypair.

  • public_key - (Optional) A pregenerated OpenSSH-formatted public key. Changing this creates a new keypair. If a public key is not specified, then a public/private key pair will be automatically generated. If a pair is created, then destroying this resource means you will lose access to that keypair forever.

  • value_specs - (Optional) Map of additional options.

Attributes Reference

The following attributes are exported:

  • name - See Argument Reference above.

  • public_key - See Argument Reference above.

  • private_key - The generated private key when no public key is specified.

  • value_specs - See Argument Reference above.

  • shared - Indicates that keypair is shared (global) and not managed by Terraform.

Import

Key pairs can be imported using the name, e.g.

terraform import opentelekomcloud_compute_keypair_v2.my-keypair test-keypair

Imported key pairs are considered to be not shared.