Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a data source for aws_key_pair #15590

Closed
evandam opened this issue Oct 10, 2020 · 15 comments · Fixed by #15829
Closed

Add a data source for aws_key_pair #15590

evandam opened this issue Oct 10, 2020 · 15 comments · Fixed by #15829
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-data-source Introduces a new data source. service/ec2 Issues and PRs that pertain to the ec2 service.
Milestone

Comments

@evandam
Copy link

evandam commented Oct 10, 2020

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

Add a data source to find EC2 key pairs by name.

New or Affected Resource(s)

  • aws_key_pair

Potential Terraform Configuration

data "aws_key_pair" "my_key_pair" {
  name = "my_key_pair"
}

resource "aws_launch_configuration" "example" {
  key_name = data.aws_key_pair.my_key_pair.name
  ...
}
@evandam evandam added the enhancement Requests to existing resources that expand the functionality or scope. label Oct 10, 2020
@ghost ghost added service/autoscaling Issues and PRs that pertain to the autoscaling service. service/ec2 Issues and PRs that pertain to the ec2 service. labels Oct 10, 2020
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Oct 10, 2020
@ewbankkit ewbankkit added new-data-source Introduces a new data source. and removed needs-triage Waiting for first response or review from a maintainer. service/autoscaling Issues and PRs that pertain to the autoscaling service. labels Oct 13, 2020
@pkruk
Copy link
Contributor

pkruk commented Oct 18, 2020

I missed that too and maybe I can add this :) I will start working on that

@pkruk
Copy link
Contributor

pkruk commented Oct 24, 2020

I created a PR: #15829
If you find anything missing or sth which require attention I will try to fix ASAP:)

@pkruk
Copy link
Contributor

pkruk commented Nov 19, 2020

Hi :)
Can I ask for a review of my PR :)?

@giskarda
Copy link

Hi,

any news about this issue? Is there anything left I can help with? Would love to get this merged!

@pirobtumen
Copy link

Hi,

We would like to have this feature too. I think it's very useful.

@pkruk
Copy link
Contributor

pkruk commented Feb 25, 2021

Hi,

Any news about the review? I would like to proceed with this PR :)

@dipendrachaudhary
Copy link

dipendrachaudhary commented Apr 11, 2021

I'm gettint this error

//data source aws key pair

data "aws_key_pair" "test-key-pair" {
name = "ubuntu"
}

//resource aws public instance

resource "aws_instance" "test-pub-instance" {
count = var.count_pub_ec2
ami = data.aws_ami.data_pub_instance.id //var.pub_ami
instance_type = var.instance_type
tenancy = var.tenancy
subnet_id = var.public_subnet_id[count.index]
key_name = data.aws_key_pair.test-key-pair.name
vpc_security_group_ids = [var.vpc_security_group_ids]
associate_public_ip_address = true
availability_zone = var.availability_zones_ec2[count.index]
tags = {
Name = "${var.vpc_name}-pub-ec2-${count.index+1}"
}
}

dipendra@salt:~$ terraform plan

Error: Invalid data source

on modules/ec2/main.tf line 43, in data "aws_key_pair" "test-key-pair":
43: data "aws_key_pair" "test-key-pair" {

The provider provider.aws does not support data source "aws_key_pair".

@mbainter
Copy link
Contributor

mbainter commented May 4, 2021

dipendra@salt:~$ terraform plan

Error: Invalid data source

on modules/ec2/main.tf line 43, in data "aws_key_pair" "test-key-pair":
43: data "aws_key_pair" "test-key-pair" {

The provider provider.aws does not support data source "aws_key_pair".

Are you trying to use this in a released version of the AWS provider, or did you build it yourself after patching with this Pull Request?

@cloudxperts
Copy link

Hello Team

Do we have any update on this

@cloudxperts
Copy link

when we are getting this feature :)

data "aws_key_pair" "terraform-key-pair" {
filter = {
name = "cloudxperts-terraform-*"
}
}

output "keypair" {
value = data.terraform-key-pair.terraform-key-pair
}

@danielmacuare
Copy link

This is a pretty useful feature. Is there any update on this?

@dalvarezquiroga
Copy link

Very usefull. Merge requests is pending yet
PR: #15829

@breathingdust
Copy link
Member

Hi all 👋 Just letting you know that this is issue is featured on this quarters roadmap. If a PR exists to close the issue a maintainer will review and either make changes directly, or work with the original author to get the contribution merged. If you have written a PR to resolve the issue please ensure the "Allow edits from maintainers" box is checked. Thanks for your patience and we are looking forward to getting this merged soon!

@breathingdust breathingdust added this to the Roadmap milestone Nov 10, 2021
@github-actions github-actions bot modified the milestones: Roadmap, v3.65.0 Nov 10, 2021
@github-actions
Copy link

This functionality has been released in v3.65.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Requests to existing resources that expand the functionality or scope. new-data-source Introduces a new data source. service/ec2 Issues and PRs that pertain to the ec2 service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.