From 500c5f5e574439c6b1e0ef1bcdba0760040f73e9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Nicolas=20B=C3=A9jean?= <nicolas@bejean.fr>
Date: Thu, 9 Dec 2021 20:45:36 +0100
Subject: [PATCH] Add API_KEY variable

---
 .gitlab-ci.yml                 | 2 ++
 manifests/elastic/main.tf      | 4 +++-
 manifests/elastic/variables.tf | 3 +++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9c998cc..8e12985 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -7,6 +7,8 @@ elastic:
   image:
     name: "hashicorp/terraform:1.0.11"
     entrypoint: [""]
+  variables:
+    TF_VAR_ec_apikey: $EC_API_KEY
   script:
     - cd ./manifests/elastic
     - terraform init 
diff --git a/manifests/elastic/main.tf b/manifests/elastic/main.tf
index 83795c3..5c0f658 100644
--- a/manifests/elastic/main.tf
+++ b/manifests/elastic/main.tf
@@ -7,4 +7,6 @@ terraform {
   }
 }
 
-provider "ec" {}
\ No newline at end of file
+provider "ec" {
+  apikey = var.ec_apikey
+}
\ No newline at end of file
diff --git a/manifests/elastic/variables.tf b/manifests/elastic/variables.tf
index e69de29..2b4efd3 100644
--- a/manifests/elastic/variables.tf
+++ b/manifests/elastic/variables.tf
@@ -0,0 +1,3 @@
+variable "ec_apikey" {
+  type = string
+}
\ No newline at end of file
-- 
GitLab