Commit 67eb1490 authored by rajat.kulkarni's avatar rajat.kulkarni

Update .gitlab-ci.yml

parent 4a5bf972
Pipeline #23338 failed
...@@ -4,97 +4,51 @@ ...@@ -4,97 +4,51 @@
# This specific template is located at: # This specific template is located at:
#https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml #https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
image:
name: hashicorp/terraform:light
entrypoint:
- '/usr/bin/env'
- 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
#image: registry.gitlab.com/gitlab-org/terraform-images/stable:latest
variables:
TF_VAR_ACCESS_KEY: ${AWS_ACCESS_KEY_ID}
TF_VAR_SECRET_KEY: ${AWS_SECRET_ACCESS_KEY}
TF_VAR_AWS_REGION: ${AWS_DEFAULT_REGION}
cache:
paths:
- .terraform
stages: stages:
- install - iac_validate
- build - iac_plan
- plan - iac_apply
- apply
- destroy default:
image:
#name: hashicorp/terraform:latest
entrypoint:
install: #- /usr/bin/env
tags: #- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- rr - ["/bin/sh", "-c"]
stage: install before_script:
script: - terraform init
- wget https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_linux_amd64.zip cache:
- unzip terraform_0.12.29_linux_amd64.zip key: terraform
paths:
- .terraform
#- mv terraform /usr/local/bin/ terraform_validate:
#- chown -R root:root /usr/local/bin/terraform stage: iac_validate
#- terraform_0.11.14_linux_amd64.zip
#- export PATH=$PATH:$HOME/terraform
only:
- master
build:
tags:
- rr
stage: build
script: script:
- terraform init - terraform validate
except:
only: refs:
- master - master
plan:
tags:
- rr
stage: plan
script:
- terraform plan
only:
- master
apply: terraform_plan:
tags: stage: iac_plan
- rr script:
stage: apply - terraform plan --out plan
script:
- terraform apply
dependencies:
- build
when: manual
only: only:
- master refs:
- master
artifacts:
paths:
- plan
destroy: terraform_apply:
tags: stage: iac_apply
- rr
stage: destroy
script: script:
- echo "Destroying resources" - terraform apply --auto-approve plan
- terraform destroy
dependencies:
- apply
when: manual when: manual
allow_failure: false
only: only:
refs: refs:
- master - master
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment