From 8766b36144b2052777afdb506694cf666d084945 Mon Sep 17 00:00:00 2001
From: Jan Jungnickel <jan@jungnickel.com>
Date: Mon, 4 Dec 2017 16:41:35 +0100
Subject: [PATCH] Make path to generated inventory configurable

---
 contrib/terraform/aws/create-infrastructure.tf | 2 +-
 contrib/terraform/aws/terraform.tfvars         | 2 ++
 contrib/terraform/aws/variables.tf             | 4 ++++
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/contrib/terraform/aws/create-infrastructure.tf b/contrib/terraform/aws/create-infrastructure.tf
index 9c0617d84..1ff584f0c 100644
--- a/contrib/terraform/aws/create-infrastructure.tf
+++ b/contrib/terraform/aws/create-infrastructure.tf
@@ -181,7 +181,7 @@ data "template_file" "inventory" {
 
 resource "null_resource" "inventories" {
   provisioner "local-exec" {
-      command = "echo '${data.template_file.inventory.rendered}' > ../../../inventory/hosts"
+      command = "echo '${data.template_file.inventory.rendered}' > ${var.inventory_file}"
   }
 
   triggers {
diff --git a/contrib/terraform/aws/terraform.tfvars b/contrib/terraform/aws/terraform.tfvars
index 99ea64eed..c5b1dbff1 100644
--- a/contrib/terraform/aws/terraform.tfvars
+++ b/contrib/terraform/aws/terraform.tfvars
@@ -31,3 +31,5 @@ default_tags = {
 #  Env = "devtest"
 #  Product = "kubernetes"
 }
+
+inventory_file = "../../../inventory/hosts"
diff --git a/contrib/terraform/aws/variables.tf b/contrib/terraform/aws/variables.tf
index 58dd31388..37aab2bae 100644
--- a/contrib/terraform/aws/variables.tf
+++ b/contrib/terraform/aws/variables.tf
@@ -103,3 +103,7 @@ variable "default_tags" {
   description = "Default tags for all resources"
   type = "map"
 }
+
+variable "inventory_file" {
+  description = "Where to store the generated inventory file"
+}
-- 
GitLab