orchestration-tests/nomad/providers.tf

39 lines
920 B
Terraform
Raw Normal View History

2022-03-22 04:26:04 +00:00
# Configure Consul provider
provider "consul" {
address = var.consul_address
}
# Get Nomad client from Consul
data "consul_service" "nomad" {
name = "nomad-client"
}
# Get Vault client from Consul
data "consul_service" "vault" {
name = "vault"
2022-04-13 21:01:14 +00:00
tag = "active"
2022-03-22 04:26:04 +00:00
}
locals {
# Get Nomad address from Consul
2022-04-13 21:01:14 +00:00
nomad_node = data.consul_service.nomad.service[0]
2022-03-22 04:26:04 +00:00
nomad_node_address = "http://${local.nomad_node.node_address}:${local.nomad_node.port}"
# Get Vault address from Consul
2022-04-13 21:01:14 +00:00
vault_node = data.consul_service.vault.service[0]
2022-03-22 04:26:04 +00:00
vault_node_address = "http://${local.vault_node.node_address}:${local.vault_node.port}"
}
# Configure the Nomad provider
provider "nomad" {
2022-04-13 21:01:14 +00:00
address = local.nomad_node_address
2022-03-22 04:26:04 +00:00
secret_id = var.nomad_secret_id
2022-04-13 21:01:14 +00:00
region = "global"
2022-03-22 04:26:04 +00:00
}
# Configure the Vault provider
provider "vault" {
address = local.vault_node_address
2022-04-13 21:01:14 +00:00
token = var.vault_token
2022-03-22 04:26:04 +00:00
}