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

Request: aws_regions (plural) data source which can be filtered by product. #3763

Closed
apowers opened this issue Mar 13, 2018 · 6 comments
Closed
Labels
new-data-source Introduces a new data source. provider Pertains to the provider itself, rather than any interaction with AWS.

Comments

@apowers
Copy link

apowers commented Mar 13, 2018

Feature Request:
aws_regions (plural) data source which can be filtered by product.

Example of desired feature to return a list of regions that support EC2.

data "aws_regions" "ec2" {}
@bflad
Copy link
Contributor

bflad commented Mar 13, 2018

Sounds like an interesting use case! Are you able to explain how you were planning on using this within Terraform?

This seems like it might be possible using the endpoints data vendored with the AWS SDK (caveat: only up to date with the SDK version baked into the provider at time of release), although it would probably require an implementation like the below to keep it generic for supporting other services:

# Not implemented - may have different interface in the future
data "aws_regions" "ec2" {
  service_name = "ec2"
}

output "ec2_regions" {
  value = "${join(",", data.aws_regions.ec2.regions)}"
}

@bflad bflad added new-data-source Introduces a new data source. provider Pertains to the provider itself, rather than any interaction with AWS. labels Mar 13, 2018
@apowers
Copy link
Author

apowers commented Mar 13, 2018

Thank you for your quick reply.

The security team wants to deploy their auditing application and ensure that it is running in every region. When new regions are available, they want it to be deployed in those new regions automatically.

@bflad
Copy link
Contributor

bflad commented Mar 13, 2018

There is a caveat though, I do not believe its possible to automatically configure providers in this fashion as provider does not support count as if Terraform 0.11.3. See also: hashicorp/terraform#16967

@ghost
Copy link

ghost commented Dec 12, 2018

Other use case is having IAM policies update automatically. We use a naming convention for SSM logging buckets. To give the EC2 admins permissions I need to generate a list of buckets and I can't use remote state easily either.

@bflad
Copy link
Contributor

bflad commented Jul 7, 2020

Hi folks 👋 A new aws_regions data source was previously released in version 2.58.0 of the Terraform AWS Provider. It uses the EC2 DescribeRegions API to return a set of available regions, potentially filtered by their opt-in state. To further track Terraform support for declaring multiple providers with count/for_each-like syntax, please follow hashicorp/terraform#16967.

@bflad bflad closed this as completed Jul 7, 2020
@ghost
Copy link

ghost commented Aug 6, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
new-data-source Introduces a new data source. provider Pertains to the provider itself, rather than any interaction with AWS.
Projects
None yet
Development

No branches or pull requests

2 participants