Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Terraform_ec2_instance
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rajat.kulkarni
Terraform_ec2_instance
Commits
58116d09
Commit
58116d09
authored
Oct 11, 2021
by
rajat.kulkarni
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update .gitlab-ci.yml
parent
73697475
Pipeline
#23184
canceled with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
67 deletions
+40
-67
.gitlab-ci.yml
.gitlab-ci.yml
+40
-67
No files found.
.gitlab-ci.yml
View file @
58116d09
# This file is a template, and might need editing before it works on your project.
# To contribute improvements to CI/CD templates, please follow the Development guide at:
# https://docs.gitlab.com/ee/development/cicd/templates.html
# This specific template is located at:
# https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Terraform.gitlab-ci.yml
#include:
# - template: Terraform/Base.gitlab-ci.yml # https://gitlab.com/gitlab-org/gitlab/blob/master/lib/gitlab/ci/templates/Terraform/Base.latest.gitlab-ci.yml
# Official image for Hashicorp's Terraform. It uses light image which is Alpine
# based as it is much lighter.
#
# Entrypoint is also needed as image by default set `terraform` binary as an
# entrypoint.
image
:
name
:
hashicorp/terraform:light
entrypoint
:
-
'
/usr/bin/env'
-
'
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
# Default output file for Terraform plan
variables
:
TF_VAR_ACCESS_KEY
:
${AWS_ACCESS_KEY_ID}
TF_VAR_SECRET_KEY
:
${AWS_SECRET_ACCESS_KEY}
TF_VAR_AWS_REGION
:
${AWS_DEFAULT_REGION}
PLAN
:
plan.tfplan
cache
:
paths
:
-
.terraform
before_script
:
-
terraform --version
-
terraform init
stages
:
-
install
-
validate
-
build
-
plan
-
apply
-
destroy
.common
:
image
:
name
:
hashicorp/terraform:0.14.2
install
:
tags
:
-
rr
stage
:
install
script
:
-curl -o terraform.zip https://releases.hashicorp.com/terraform/0.12.2/terraform_0.12.2_linux_amd64.zip
-
only
:
-
master
-
test
-
deploy
build
:
tags
:
-
rr
stage
:
build
validate
:
stage
:
validate
script
:
-
terraform --version
-
terraform init
only
:
-
master
-
terraform validate
plan
:
tags
:
-
rr
stage
:
plan
stage
:
build
script
:
-
terraform plan
only
:
-
master
-
terraform plan -out=$PLAN
artifacts
:
name
:
plan
paths
:
-
$PLAN
# Separate apply job for manual launching Terraform as it can be destructive
# action.
apply
:
tags
:
-
rr
stage
:
apply
stage
:
deploy
environment
:
name
:
production
script
:
-
terraform apply
-
terraform apply
-input=false $PLAN
dependencies
:
-
build
-
plan
when
:
manual
only
:
-
master
destroy
:
tags
:
-
rr
stage
:
destroy
script
:
-
echo "Destroying resources"
-
terraform destroy
dependencies
:
-
apply
when
:
manual
only
:
refs
:
-
master
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment