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"
}
}
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.
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