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

Error: region not found for name "eu-central-2" #14

Closed
1 task done
markandersontrocme opened this issue Nov 14, 2022 · 4 comments · Fixed by #15
Closed
1 task done

Error: region not found for name "eu-central-2" #14

markandersontrocme opened this issue Nov 14, 2022 · 4 comments · Fixed by #15

Comments

@markandersontrocme
Copy link
Contributor

Description

Tried using the module, copied the example from here. When running terraform plan I get this error

│ Error: finding Region by name
│
│   with module.eks_cluster.module.pricing.data.aws_region.one["eu-central-2"],
│   on .terraform/modules/eks_cluster.pricing/modules/pricing/regions.tf line 5, in data "aws_region" "one":
│    5: data "aws_region" "one" {
│
│ region not found for name "eu-central-2"
  • ✋ I have searched the open/closed issues and my issue is not listed.

⚠️ Note

Before you submit an issue, please perform the following first:

  1. Remove the local .terraform directory (! ONLY if state is stored remotely, which hopefully you are following that best practice!): rm -rf .terraform/
  2. Re-initialize the project root to pull down modules: terraform init
  3. Re-attempt your terraform plan or apply and check if the issue still persists

Versions

  • Module version [Required]: 2.0.0

  • Terraform version:

Terraform v1.1.6

  • Provider version(s):
  • provider registry.terraform.io/hashicorp/aws v4.38.0

Reproduction Code [Required]

module "pricing" {
  source  = "terraform-aws-modules/pricing/aws//modules/pricing"
  version = "2.0.0"

  debug_output = true

  resources = {
    "aws_instance.this" = {
      instanceType = "t3.large"
      location     = "us-east-1"
    }
  }
}

Steps to reproduce the behavior:

Expected behavior

Looking to pricing_per_resources

Actual behavior

Getting an error: region not found for name "eu-central-2"

Terminal Output Screenshot(s)

Additional context

I have submitted 2 PRs in the past for fixing this for other regions, is there a more permanent solution? I tried using skip_region_validation = true but doesn't seem to work...

@antonbabenko
Copy link
Member

There can be a more universal solution involving the automatic generation of region maps values (like this one) where keys are outputs of the aws_regions data-source.

I didn't try it, but it seems to work and is more flexible.

@markandersontrocme
Copy link
Contributor Author

markandersontrocme commented Nov 14, 2022

I was able to fix it by making all_regions a variable and allowing the user to set it to false: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/regions#all_regions

I have a PR I will send soon if that works?

variable "query_all_regions" {
  description = "If true the source will query all regions regardless of availability"
  type        = bool
  default     = true
}

@antonbabenko
Copy link
Member

Cool. The only thing I am a bit worried about is potential inconsistency in values across regions (e.g. there is "APE1-NatGateway-Hours", but for some regions there can be weird exceptions). This means we need to have a way to override values. I am not saying that this is a problem already, but it can be an issue.

antonbabenko pushed a commit that referenced this issue Nov 15, 2022
Co-authored-by: Anton Babenko <anton@antonbabenko.com>
Closes #14
@github-actions
Copy link

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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 16, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants