Sha256: 1c1b5b4e4180f781e8dbab1a5af98bcd15e526fda8637f19b9c44fbc047187e9

Contents?: true

Size: 1.13 KB

Versions: 2

Compression:

Stored size: 1.13 KB

Contents

image: ruby:latest

stages:
  - plan dev
  - up dev
  - plan prod
  - up prod

before_script: |
  # install terraform
  git clone https://github.com/tfutils/tfenv.git ~/.tfenv
  echo 'export PATH="$HOME/.tfenv/bin:$PATH"' >> ~/.bash_profile
  export PATH="$HOME/.tfenv/bin:$PATH"
  tfenv install latest
  tfenv use latest
  terraform --version
  # install terraspace
  bundle
  bundle exec terraspace new shim
  echo 'export PATH="/usr/local/bin:$PATH' >> ~/.bash_profile
  export PATH="/usr/local/bin:$PATH"

# Runs on Merge Request Only
plan_dev:
  stage: plan dev
  only:
  - merge_requests
  script:
    - terraspace plan demo

# Runs on Push Only
up_dev:
  stage: up dev
  rules:
    - if: '$CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == "main"'
  script:
    - terraspace up demo -y

# Runs Manually Only (part 1 of 2)
plan_prod:
  stage: plan prod
  rules:
    - if: '$CI_PIPELINE_SOURCE == "web"'
  script:
    - TS_ENV=prod terraspace plan demo

# Runs Manually Only (part 2 of 2)
up_prod:
  stage: up prod
  rules:
    - if: '$CI_PIPELINE_SOURCE == "web"'
      when: manual # manual approval
  script:
    - TS_ENV=prod terraspace up demo -y

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
terraspace_ci_gitlab-0.1.1 lib/template/.gitlab-ci.yml
terraspace_ci_gitlab-0.1.0 lib/template/.gitlab-ci.yml