From 68f7d63698f0121a1bd5bcf0636b90d733aa6428 Mon Sep 17 00:00:00 2001
From: James Arcus <jimbo@ucc.asn.au>
Date: Mon, 16 Dec 2024 23:05:41 +0800
Subject: [PATCH] Create initial CI config

---
 .gitlab-ci.yml | 38 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..9a725ac
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,38 @@
+workflow:
+  rules:
+    - changes:
+      - "*.tf"
+      - "*.yml"
+
+stages:
+  - validate
+  - plan
+  - apply
+
+validate:
+  stage:
+    validate
+  before_script:
+    - mkdir -p /services/wheel-runner/data/member-vm-automation
+    - tofu init
+  script:
+    - tofu validate
+
+plan:
+  stage:
+    plan
+  before_script:
+    - tofu init
+  script:
+    - tofu plan -state /services/wheel-runner/data/member-vm-automation/terraform.tfstate -out /services/wheel-runner/data/member-vm-automation/tf-$CI_PIPELINE_IID.plan
+
+apply:
+  stage:
+    apply
+  rules:
+    - if: '$CI_COMMIT_BRANCH == "main"'
+      when: manual
+  before_script:
+    - tofu init
+  script:
+    - tofu apply -state /services/wheel-runner/data/member-vm-automation/terraform.tfstate /services/wheel-runner/data/member-vm-automation/tf-$CI_PIPELINE_IID.plan
-- 
GitLab