-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.travis.yml
38 lines (35 loc) · 888 Bytes
/
.travis.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
---
sudo: required
dist: trusty
language: python
cache: pip
python:
- '2.7'
install:
# Install AWS CLI
- pip install awscli
- aws --version
# Install Terraform
- TERRAFORM_VERSION="0.10.2"
- wget https://releases.hashicorp.com/terraform/${TERRAFORM_VERSION}/terraform_${TERRAFORM_VERSION}_linux_amd64.zip -O /tmp/terraform.zip
- sudo unzip -d /usr/local/bin/ /tmp/terraform.zip
before_script:
# Determine environment
- export ENV=$(echo "${TRAVIS_BRANCH}" | perl -ne "print $& if /(?<=deploy\/).*/")
script:
- |
if [ -z "${ENV}" ]; then
echo "${TRAVIS_BRANCH} is not a branch to deploy."
else
source ./scripts/switch-role.sh
terraform init
terraform get
terraform workspace select ${ENV}
terraform plan
fi
deploy:
- provider: script
script: terraform apply
skip_cleanup: true
on:
branch: deploy/*