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
install:
tags:
- rr
stage: install
script:
- wget https://releases.hashicorp.com/terraform/0.12.29/terraform_0.12.29_linux_amd64.zip
- unzip terraform_0.12.29_linux_amd64.zip
#- mv terraform /usr/local/bin/
#- chown -R root:root /usr/local/bin/terraform
#- terraform_0.11.14_linux_amd64.zip
#- export PATH=$PATH:$HOME/terraform
only:
- master
build: default:
tags: image:
- rr #name: hashicorp/terraform:latest
stage: build entrypoint:
script: #- /usr/bin/env
#- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
- ["/bin/sh", "-c"]
before_script:
- terraform init - terraform init
cache:
key: terraform
paths:
- .terraform
only: terraform_validate:
- master stage: iac_validate
plan:
tags:
- rr
stage: plan
script: script:
- terraform plan - terraform validate
only: except:
refs:
- master - master
apply: terraform_plan:
tags: stage: iac_plan
- rr
stage: apply
script: script:
- terraform apply - terraform plan --out plan
dependencies:
- build
when: manual
only: only:
refs:
- master - master
artifacts:
paths:
- plan
terraform_apply:
destroy: stage: iac_apply
tags:
- 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