From 1542021f7e9d9b0b06660c49e879f845069e8116 Mon Sep 17 00:00:00 2001 From: main Date: Sun, 31 Jul 2022 07:46:24 +0200 Subject: [PATCH] Terraform provider passing changes Signed-off-by: main --- main.tf | 18 +++++++----------- nomad/main.tf | 16 ++++++++++++++++ nomad/regions/do-1/main.tf | 20 ++++++-------------- nomad/regions/main.tf | 19 +++++++++++++++++++ 4 files changed, 48 insertions(+), 25 deletions(-) diff --git a/main.tf b/main.tf index 9e7027f..e1a4b76 100644 --- a/main.tf +++ b/main.tf @@ -9,13 +9,13 @@ terraform { provider "nomad" { address = "http://10.64.1.201:4646" region = "homelab-1" - alias = "homelab" + alias = "homelab-1" } provider "nomad" { address = "http://10.64.1.201:4646" region = "do-1" - alias = "do" + alias = "do-1" } provider "vault" { @@ -38,15 +38,6 @@ variable "flake_sha" { type = string } -module "infrastructure" { - source = "./infrastructure" - - flake_rev = var.flake_rev - flake_host = var.flake_host - flake_host_alt = var.flake_host_alt - flake_sha = var.flake_sha -} - module "nomad" { source = "./nomad" @@ -54,4 +45,9 @@ module "nomad" { flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha + + providers = { + nomad.do-1 = nomad.do-1 + nomad.homelab-1 = nomad.homelab-1 + } } diff --git a/nomad/main.tf b/nomad/main.tf index bcb48db..517ca2b 100644 --- a/nomad/main.tf +++ b/nomad/main.tf @@ -1,3 +1,14 @@ +terraform { + required_providers { + nomad = { + configuration_aliases = [ + nomad.do-1, + nomad.homelab-1 + ] + } + } +} + variable "flake_rev" { type = string } @@ -21,4 +32,9 @@ module "regions" { flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha + + providers = { + nomad.do-1 = nomad.do-1 + nomad.homelab-1 = nomad.homelab-1 + } } diff --git a/nomad/regions/do-1/main.tf b/nomad/regions/do-1/main.tf index 591b7f1..cedfedb 100644 --- a/nomad/regions/do-1/main.tf +++ b/nomad/regions/do-1/main.tf @@ -1,3 +1,9 @@ +terraform { + required_providers { + nomad = {} + } +} + variable "flake_rev" { type = string } @@ -14,30 +20,16 @@ variable "flake_host_alt" { type = string } -provider "nomad" { - address = "http://10.64.1.201:4646" - region = "do-1" - alias = "do-1" -} - module "nfs" { source = "../../modules/nfs" node_dcs = [ "do-1" ] region = "do-1" - - providers = { - nomad = nomad.do-1 - } } module "gateway-mesh" { source = "../../modules/gateway-mesh" datacenters = [ "do-1" ] - - providers = { - nomad = nomad.do-1 - } } diff --git a/nomad/regions/main.tf b/nomad/regions/main.tf index a713f47..e0e0761 100644 --- a/nomad/regions/main.tf +++ b/nomad/regions/main.tf @@ -1,3 +1,14 @@ +terraform { + required_providers { + nomad = { + configuration_aliases = [ + nomad.do-1, + nomad.homelab-1 + ] + } + } +} + variable "flake_rev" { type = string } @@ -21,6 +32,10 @@ module "do-1" { flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha + + providers = { + nomad = nomad.do-1 + } } module "homelab-1" { @@ -30,4 +45,8 @@ module "homelab-1" { flake_host = var.flake_host flake_host_alt = var.flake_host_alt flake_sha = var.flake_sha + + providers = { + nomad = nomad.homelab-1 + } }