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

Feature request: Data source for available datacenters. #290

Closed
james-masson opened this issue Nov 19, 2021 · 1 comment
Closed

Feature request: Data source for available datacenters. #290

james-masson opened this issue Nov 19, 2021 · 1 comment

Comments

@james-masson
Copy link

I'd like to create a prepared query that should exist in every datacenter.

Currently there seems to be no way to retrieve the list of datacenters that Consul has available, to provide these to a configured resource.

Configuring and updating a resource manually across a set of datacenters doesn't seem ideal.

Terraform Version

v0.15.1

Terraform Configuration Files

## This is what I would like to exist...
data "consul_datacenters" "this" {
}

# This was just from your examples... not the query I'm interested in.
resource "consul_prepared_query" "myapp-query" {
  for_each = toset(  data.consul_datacenters.this.all )
  name         = "myquery"
  datacenter   = each.key
  token        = "abcd"
  stored_token = "wxyz"
  only_passing = true
  near         = "_agent"

  service = "myapp"
  tags    = ["active", "!standby"]

  failover {
    nearest_n   = 3
    datacenters = ["us-west1", "us-east-2", "asia-east1"]
  }

  dns {
    ttl = "30s"
  }
}
@remilapeyre
Copy link
Contributor

Hi @james-masson, thanks for opening this issue. @Seth-Karlo made a PR to add this new datasource and it will ship in the next release that should be in a couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants