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.83k stars 9.17k forks source link

Data source aws_api_gateway_api_key lookup on name (not id) #8033

Open runesl opened 5 years ago

runesl commented 5 years ago

Community Note

Description

It should be possible to lookup aws_api_gateway_api_key by name. For example:

data "aws_api_gateway_api_key" "my-api-key" {
  name = "my_api_key_name"
}

Currently only id is supported, so this happens:

Error: data.aws_api_gateway_api_key.api-key: "id": required field is not set

RomanGlova commented 5 years ago

Looks like cannot be implemented since you can have same name on different keys

runesl commented 5 years ago

A lot of Terraform data sources work like I propose. They fail only when multiple instances matching the criteria are actually found. Looking up EBS volumes by tag for instance.

JulienBlancher commented 5 years ago

+1 for this! looking up by id is not very useful.

mikiisz commented 3 years ago

+1, are there any new updates about that feature request?

jhourque commented 1 year ago

+1, this is a nice feature but I think it would need to create a new data source : aws_api_gateway_api_keys aws_api_gateway_api_key is based on AWS API get-api-key which only allow api key id as parameter. aws_api_gateway_api_keys could be based on get-api-keys API which could request on name.

Anyway this is a must have feature.

d8aninja commented 12 months ago

Many AWS resources can have identical names and differing IDs/ARNs; why is this one special? This is a must have feature, still, going into 2024...