terraform-aws-modules / terraform-aws-ec2-instance

Terraform module to create AWS EC2 instance(s) resources πŸ‡ΊπŸ‡¦
https://registry.terraform.io/modules/terraform-aws-modules/ec2-instance/aws
Apache License 2.0
754 stars 1.87k forks source link

EC2 module new variable "kms_create" #356

Closed junha-ahn closed 1 year ago

junha-ahn commented 1 year ago

Is your request related to a new offering from AWS?

Is this functionality available in the AWS provider for Terraform? See CHANGELOG.md, too.

Is your request related to a problem? Please describe.

No, This issue for New Feature.

For now, ec2 moudule just use key_name variable

If you inputkey_name, than It find the already exist Key Pair on AWS. never craete a new key pair, so you have to create key manually

module "bastion" {
  source  = "terraform-aws-modules/ec2-instance/aws"
  ami = local.ubuntu_22_ami

  ...

  key_name = module.key_pair.key_pair_name # <<<<<----
}

module "key_pair" {
  source = "terraform-aws-modules/key-pair/aws"
  key_name           = "bastion"
  create_private_key = true
}

resource "local_file" "private_key_pem" {
    content  = module.key_pair.private_key_pem
    filename = "bastion.pem"
}

Describe the solution you'd like.

How about add new variable create_kms (default : false) If you input true, then the ec2 module create a new key_pair

Give me some feedback ("dont do it because..." or something)

If It's ok, I want to contribute this project with this Issue!

Example: My Cloned Repo Commit

Describe alternatives you've considered.

Additional context

New Variable

New Output

github-actions[bot] commented 1 year 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.