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.75k stars 9.1k forks source link

[Enhancement]: ability to return all aws_route53_zone records without specifing name or zone_id #27851

Open travis-jorge opened 1 year ago

travis-jorge commented 1 year ago

Description

Please add the ability to return all aws_route53_zone records without specifing name or zone_id it would also be nice if you could specify a filter to search by tag without the name or zone_id provided.

Use Case:

product account has all the subdomain records when a new subdomain is created I need to update the primary operations account which is managed by a different aws account and different state file. I want to look up all the records in the product account and add them dynamically in the primary ops account state file

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

aws_route53_zone

Potential Terraform Configuration

retrieve all hosted zones that have a tag that matches
data "aws_route53_zone" "selected" {
   provider = aws.product_account
   filter {
    name   = "tag:Name"
    values = ["*internal*"]
  }
}
or the following to get everything 
data "aws_route53_zone" "selected" {
   provider = aws.product_account
}

References

No response

Would you like to implement a fix?

No response

github-actions[bot] commented 1 year ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

erz4 commented 1 year ago

So you want to be able to search by tags and by default return everything

Maybe it need to be new type of data resource that return list instead of just 1 match

That behavior working in aws console/cli?

erz4 commented 1 year ago

@travis-jorge like https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/route_tables

luarx commented 1 year ago

Is there any update on this?

My use case:

Obtain a list of aws_route53_records (this is were the new datasource will be required) Loop the previous list to create a aws_route53_health_check resource for each of those records

Siddarthyuvaraj commented 2 months ago

PR has been raised for this issue https://github.com/hashicorp/terraform-provider-aws/pull/38186