terraform-aws-modules / terraform-aws-key-pair

Terraform module to create AWS EC2 key pair resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/key-pair/aws
Apache License 2.0
83 stars 127 forks source link

How can I get private key for login ? #11

Closed dtherhtun closed 4 years ago

dtherhtun commented 4 years ago

if i create like this how can I get private key ?

resource "random_pet" "this" {
  length = 2
}

resource "tls_private_key" "this" {
  algorithm = "RSA"
}

module "key_pair" {
  source = "../../modules/aws/key-pair"

  key_name   = random_pet.this.id
  public_key = tls_private_key.this.public_key_openssh

  tags = {
    Terraform = "true"
  }
}
cageyv commented 4 years ago

Probably you can get it from tfstate file terraform show -json terraform.tfstate "tls_private_key.this" or use this key somewhere. store inside aws.

dtherhtun commented 4 years ago

Thanks.

tovbinm commented 3 years ago

Nice!

github-actions[bot] commented 2 years ago

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.