From 838383a53c76c31208b84bcfb48d13c95ba849a9 Mon Sep 17 00:00:00 2001 From: Tim Unkrig Date: Fri, 27 Oct 2023 13:11:16 +0200 Subject: [PATCH] added drone pipeline for push code to main --- .drone.yml | 75 +++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 6 deletions(-) diff --git a/.drone.yml b/.drone.yml index 9c06fcc..7681722 100644 --- a/.drone.yml +++ b/.drone.yml @@ -17,18 +17,81 @@ steps: image: hashicorp/terraform:1.5 commands: - terraform -chdir=infrastructure fmt -diff -check - # when: - # event: - # - pull_request + when: + event: + - pull_request + - name: terraform plan image: hashicorp/terraform:1.5 commands: + - terraform -chdir=infrastructure validate - terraform -chdir=infrastructure plan environment: TF_VAR_virtual_environment_endpoint: from_secret: virtual_environment_endpoint TF_VAR_virtual_environment_api_token: from_secret: virtual_environment_api_token - # when: - # event: - # - pull_request \ No newline at end of file + when: + event: + - pull_request + + - name: terraform apply + image: hashicorp/terraform:1.5 + commands: + - terraform -chdir=infrastructure validate + - terraform -chdir=infrastructure plan + - terraform -chdir=infrastructure apply + environment: + TF_VAR_virtual_environment_endpoint: + from_secret: virtual_environment_endpoint + TF_VAR_virtual_environment_api_token: + from_secret: virtual_environment_api_token + when: + event: + - pull_request + + - name: Terraform infrastructure syntax check + image: hashicorp/terraform:1.5 + commands: + - terraform -chdir=infrastructure fmt -diff -check + when: + branch: + - main + event: + - push + - tag + + - name: terraform infrastructure plan + image: hashicorp/terraform:1.5 + commands: + - terraform -chdir=infrastructure validate + - terraform -chdir=infrastructure plan + environment: + TF_VAR_virtual_environment_endpoint: + from_secret: virtual_environment_endpoint + TF_VAR_virtual_environment_api_token: + from_secret: virtual_environment_api_token + when: + branch: + - main + event: + - push + - tag + + - name: terraform plan + image: hashicorp/terraform:1.5 + commands: + - terraform -chdir=infrastructure validate + - terraform -chdir=infrastructure plan + - terraform -chdir=infrastructure apply + environment: + TF_VAR_virtual_environment_endpoint: + from_secret: virtual_environment_endpoint + TF_VAR_virtual_environment_api_token: + from_secret: virtual_environment_api_token + when: + branch: + - main + event: + - push + - tag \ No newline at end of file