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

aws_region data source breaks when new regions are launched #26558

Open
jbg opened this issue Aug 31, 2022 · 6 comments
Open

aws_region data source breaks when new regions are launched #26558

jbg opened this issue Aug 31, 2022 · 6 comments
Labels
bug Addresses a defect in current functionality. service/meta Issues and PRs that pertain to the meta service.

Comments

@jbg
Copy link
Contributor

jbg commented Aug 31, 2022

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

Terraform CLI and Terraform AWS Provider Version

Terraform v1.2.8
+ provider registry.terraform.io/hashicorp/aws v4.28.0

Affected Resource(s)

  • aws_region data source

Terraform Configuration Files

In a module, purely to get the region name of the provider the module is being used with:

data "aws_region" "current" {}

Expected Behavior

It returns at least the region name that the provider is configured with, even if it doesn't know the endpoint and/or description for that region. It literally just has to pass the string through.

Actual Behavior

╷
│ Error: region not found for name "me-central-1"
│ 
│   with module.foo.data.aws_region.current,
│   on modules/foo/main.tf line 15, in data "aws_region" "current":
│   15: data "aws_region" "current" {}
│ 
╵

Steps to Reproduce

  1. Wait for AWS to launch a new region (they just launched me-central-1, so you can try now!)
  2. Add a provider for that region, with skip_region_validation = true because the provider doesn't know about the new region yet
  3. terraform plan

Discussion

I realise the aws_region data source probably has a lookup table internally to find out endpoint & description for the region. But I would guess in the vast majority of cases people do not care about those attributes because they are just using this data source to get the region name of the provider that a module was configured with.

It would be great to avoid this unnecessary breakage when new regions are launched, because there's always a delay after launch before the provider catches up.

Maybe to prevent any unexpected breakage due to null endpoint and description, there could be a skip_region_validation argument like the provider has, so people have to opt-in to potentially not getting those values.

References

@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label Aug 31, 2022
@ewbankkit ewbankkit added bug Addresses a defect in current functionality. service/meta and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 31, 2022
@ewbankkit
Copy link
Contributor

@jbg Thanks for raising this issue 👏.
The aws_region data source looks up AWS Region information from the AWS SDK for Go endpoints package and we are dependent on merging new versions of this SDK to pick up additional Regions.
me-central-1 was added via AWS SDK for Go v1.44.88: #26563 and will be supported via the aws_region data source in Terraform AWS Provider v4.29.0, to be released later this week.

@ewbankkit ewbankkit added this to the v4.29.0 milestone Aug 31, 2022
@jbg
Copy link
Contributor Author

jbg commented Aug 31, 2022

But you don't need aws-sdk-go to just pass the string through from the provider (which already validated it, or was told not to validate it). That would only be needed to look up the endpoint, which most users of the data source probably don't care about.

@ewbankkit ewbankkit reopened this Aug 31, 2022
@ewbankkit ewbankkit removed this from the v4.29.0 milestone Aug 31, 2022
@gdavison
Copy link
Contributor

gdavison commented Sep 1, 2022

The data source should also allow us to try to retrieve information for named regions that aren't supported yet. endpoints.PartitionForRegion() does a regex match to determine the expected partition.

endpoints.Partition.EndpointFor() can then be used to retrieve the EC2 endpoint, since it falls back to default endpoint construction if they're not specified.

If there's no match, we should return a warning. Optionally, we could add a strictness mode with no-check, warn, strict, and default to warn

@kfirgollan
Copy link

Just happened again with il-central-1

@dsmithuk
Copy link

Hi all,
Seems to be happening with Malaysia ap-southeast-5 too.

@ewbankkit ewbankkit added the service/meta Issues and PRs that pertain to the meta service. label Sep 11, 2024
@ewbankkit
Copy link
Contributor

Relates #39224.
As AWS SDK for Go v2 is now in maintenance mode we need to implement hashicorp/aws-sdk-go-base#649.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Addresses a defect in current functionality. service/meta Issues and PRs that pertain to the meta service.
Projects
None yet
Development

No branches or pull requests

6 participants