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.62k stars 9.01k forks source link

Add id to data source aws_route_table #21302

Open LinusU opened 2 years ago

LinusU commented 2 years ago

Community Note

Description

Could we add the id attribute to the aws_route_table data source? Specifically, I would like to be able to do this:

data "aws_route_table" "foo" {
  id = "rtb-11223344"
}

And then later be able to reference data from it.

New or Affected Resource(s)

Potential Terraform Configuration

data "aws_route_table" "foo" {
  id = "rtb-11223344"
}

References

n/a

justinretzolk commented 2 years ago

Hey @LinusU 👋 Unless I'm misunderstanding the request, this is currently possible by using the route_table_id argument:

data "aws_route_table" "foo" {
  route_table_id = "rtb-123456789"
}
LinusU commented 2 years ago

Hehe, you're very correct, I must have missed that!

It is a bit surprising though, since most (all?) other data resources uses just id instead of ${name}_id? 🤔 e.g. aws_subnet, aws_vpc, aws_vpn_gateway

Do you want me to close this or could we consider adding id as well, or maybe a line to the documentation that tells users to use route_table_id?

justinretzolk commented 2 years ago

Hey @LinusU 👋 It happens! I definitely see where you're coming from with regards to most resources using id rather than ${name}_id.

My perspective is that it is probably worth leaving this issue open for now so that we can gather additional feedback. We generally use "👍" reactions on issues to get an idea of community interest, so if this issue starts to get more reactions, it may be worth looking into adding the id attribute. Until then, I'd hesitate to ask you to work on a PR to add the id attribute, as if there's not much community feedback asking for the same thing, the PR may sit for a while waiting on a review, and I'd not want to take up your time in the meantime.

github-actions[bot] commented 9 months ago

Marking this issue as stale due to inactivity. This helps our maintainers find and focus on the active issues. If this issue receives no comments in the next 30 days it will automatically be closed. Maintainers can also remove the stale label.

If this issue was automatically closed and you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thank you!

LinusU commented 9 months ago

This still seems relevant