added drone pipeline for push code to main
Some checks failed
continuous-integration/drone/push Build encountered an error

This commit is contained in:
2023-10-27 13:11:16 +02:00
parent 0438af9f6a
commit 838383a53c

View File

@@ -17,18 +17,81 @@ steps:
image: hashicorp/terraform:1.5 image: hashicorp/terraform:1.5
commands: commands:
- terraform -chdir=infrastructure fmt -diff -check - terraform -chdir=infrastructure fmt -diff -check
# when: when:
# event: event:
# - pull_request - pull_request
- name: terraform plan - name: terraform plan
image: hashicorp/terraform:1.5 image: hashicorp/terraform:1.5
commands: commands:
- terraform -chdir=infrastructure validate
- terraform -chdir=infrastructure plan - terraform -chdir=infrastructure plan
environment: environment:
TF_VAR_virtual_environment_endpoint: TF_VAR_virtual_environment_endpoint:
from_secret: virtual_environment_endpoint from_secret: virtual_environment_endpoint
TF_VAR_virtual_environment_api_token: TF_VAR_virtual_environment_api_token:
from_secret: virtual_environment_api_token from_secret: virtual_environment_api_token
# when: when:
# event: event:
# - pull_request - 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