hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.76k stars 9.12k forks source link

[Enhancement]: Resource/aws_key_pair - Enable key pair generation by leaving out public key #39529

Open researchgecko opened 6 hours ago

researchgecko commented 6 hours ago

Description

CloudFormation allows for creating EC2 key pairs by omitting the public key material in AWS::EC2::KeyPair. Ref: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-keypair.html

At present, the public key is a required field in Terraform: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/key_pair#public_key

Is it possible to enable key pair creation by specifying key_name and leaving out public_key, similar to CloudFormation?

Affected Resource(s) and/or Data Source(s)

resource/aws_key_pair

Potential Terraform Configuration

resource "aws_key_pair" "deployer" {
  key_name   = "deployer-key"
}

References

AWS's CloudFormation guide for EC2 key pairs: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-keypair.html

Would you like to implement a fix?

None

github-actions[bot] commented 6 hours ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue