openstack_compute_keypair_v2
Эта инструкция — копия официальной документации OpenStack Terraform-провайдера в Terraform Registry.
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
Import an Existing Public Key
resource "openstack_compute_keypair_v2" "test-keypair" {
name = "my-keypair"
public_key = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDAjpC1hwiOCCmKEWxJ4qzTTsJbKzndLotBCz5PcwtUnflmU+gHJtWMZKpuEGVi29h0A/+ydKek1O18k10Ff+4tyFjiHDQAnOfgWf7+b1yK+qDip3X1C0UPMbwHlTfSGWLGZqd9LvEFx9k3h/M+VtMvwR1lJ9LUyTAImnNjWG7TaIPmui30HvM2UiFEmqkr4ijq45MyX2+fLIePLRIF61p4whjHAQYufqyno3BS48icQb4p6iVEZPo4AE2o9oIyQvj2mx4dk5Y8CgSETOZTYDOR3rU2fZTRDRgPJDH9FWvQjF5tA0p3d9CoWWd2s6GKKbfoUIi8R/Db1BSPJwkqB"
}
Generate a Public/Private Key Pair
resource "openstack_compute_keypair_v2" "test-keypair" {
name = "my-keypair"
}
Argument Reference
The following arguments are supported:
-
region
- (Optional) The region in which to obtain the V2 Compute client. Keypairs are associated with accounts, but a Compute client is needed to create one. If omitted, theregion
argument of the provider is used. Changing this creates a new keypair. -
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. -
user_id
- (Optional) This allows administrative users to operate key-pairs of specified user ID. For this feature your need to have openstack microversion 2.10 (Liberty) or later. -
value_specs
- (Optional) Map of additional options.
Attributes Reference
The following attributes are exported:
region
- See Argument Reference above.name
- See Argument Reference above.public_key
- See Argument Reference above.fingerprint
- The fingerprint of the public key.private_key
- The generated private key when no public key is specified.
Import
Keypairs can be imported using the name
, e.g.
$ terraform import openstack_compute_keypair_v2.my-keypair test-keypair