elastic / terraform-provider-ec

https://registry.terraform.io/providers/elastic/ec/latest/docs
Apache License 2.0
172 stars 86 forks source link

ec_stack doesn't work for AWS regions #670

Open dhilgarth opened 1 year ago

dhilgarth commented 1 year ago

Readiness Checklist

Expected Behavior

I expect ec_stack to work with AWS regions. In detail, I expect the sample from your README to work:

data "ec_stack" "latest" {
  version_regex = "latest"
  region        = "us-east-1"
}

Current Behavior

This doesn't work, I get the following error

│ Failed retrieving the specified stack version: api error: 1 error occurred:
│       * root.region_not_found: Region [us-east-1] not found

I've also tried aws-us-east-1, no change.

Terraform definition

terraform {
  required_version = ">= 1.0.0"
  required_providers {
    ec = {
      source  = "elastic/ec"
      version = "~>0.7.0"
    }
  }
}

data "ec_stack" "latest" {
  version_regex = "latest"
  region        = "us-east-1"
}

output "version" {
  value = data.ec_stack.latest.version
}

Steps to Reproduce

  1. Put the above Terraform code into main.tf
  2. Execute terraform init
  3. Execute terraform apply -auto-approve

Context

Needed to create a cluster with the latest available version

Your Environment

dhilgarth commented 1 year ago

Okay, I figured it out: The reason is that my cloud.elastic account was created from Azure and therefore only allows creating Clusters in Azure. A better error message in that case would've saved me 2 hours, so: feature request :)