cleaned up argument passing;removed quotes from container args

This commit is contained in:
Scott Nowicki 2017-04-20 14:10:54 -05:00
parent 4edbc8bd92
commit 10f48d565e
2 changed files with 11 additions and 14 deletions

View File

@ -15,14 +15,14 @@ branches:
# install terraform # install terraform
before_deploy: before_deploy:
- KEY=$(cat /dev/urandom | tr -cd 'a-z' | head -c 12) - export KEY=$(cat /dev/urandom | tr -cd 'a-z' | head -c 12)
- PASSWORD=$KEY$(cat /dev/urandom | tr -cd 'A-Z' | head -c 2)$(cat /dev/urandom | tr -cd '0-9' | head -c 2) - export PASSWORD=$KEY$(cat /dev/urandom | tr -cd 'A-Z' | head -c 2)$(cat /dev/urandom | tr -cd '0-9' | head -c 2)
# terraform deploy script # terraform deploy script
deploy: deploy:
- provider: script - provider: script
skip_cleanup: true skip_cleanup: true
script: cd $TEST_DIR && ./deploy.sh $KEY $PASSWORD script: cd $TEST_DIR && ./deploy.sh
on: on:
repo: 10thmagnitude/terraform repo: 10thmagnitude/terraform
branch: topic-101-vm-simple-linux branch: topic-101-vm-simple-linux

View File

@ -6,28 +6,25 @@ set -o errexit -o nounset
# KEY=$(cat /dev/urandom | tr -cd 'a-z' | head -c 12) # KEY=$(cat /dev/urandom | tr -cd 'a-z' | head -c 12)
# PASSWORD=$KEY$(cat /dev/urandom | tr -cd 'A-Z' | head -c 2)$(cat /dev/urandom | tr -cd '0-9' | head -c 2) # PASSWORD=$KEY$(cat /dev/urandom | tr -cd 'A-Z' | head -c 2)$(cat /dev/urandom | tr -cd '0-9' | head -c 2)
KEY=$1
PASSWORD=$2
docker run --rm -it -v \ docker run --rm -it -v \
$(pwd):/data -w /data \ $(pwd):/data -w /data \
hashicorp/terraform:light \ hashicorp/terraform:light \
get get
docker run --rm -it -v \ docker run --rm -it -v \
-e ARM_CLIENT_ID="$ARM_CLIENT_ID" \ -e ARM_CLIENT_ID=$ARM_CLIENT_ID \
-e ARM_CLIENT_SECRET="$ARM_CLIENT_SECRET" \ -e ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET \
-e ARM_SUBSCRIPTION_ID="$ARM_SUBSCRIPTION_ID" \ -e ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID \
-e ARM_TENANT_ID="$ARM_SUBSCRIPTION_ID" \ -e ARM_TENANT_ID=$ARM_SUBSCRIPTION_ID \
$(pwd):/data -w /data \ $(pwd):/data -w /data \
hashicorp/terraform:light \ hashicorp/terraform:light \
plan -var dns_name=$KEY -var resource_group=$KEY -var admin_username=$KEY -var admin_password=$PASSWORD -out=out.tfplan plan -var dns_name=$KEY -var resource_group=$KEY -var admin_username=$KEY -var admin_password=$PASSWORD -out=out.tfplan
docker run --rm -it -v \ docker run --rm -it -v \
-e ARM_CLIENT_ID="$ARM_CLIENT_ID" \ -e ARM_CLIENT_ID=$ARM_CLIENT_ID \
-e ARM_CLIENT_SECRET="$ARM_CLIENT_SECRET" \ -e ARM_CLIENT_SECRET=$ARM_CLIENT_SECRET \
-e ARM_SUBSCRIPTION_ID="$ARM_SUBSCRIPTION_ID" \ -e ARM_SUBSCRIPTION_ID=$ARM_SUBSCRIPTION_ID \
-e ARM_TENANT_ID="$ARM_SUBSCRIPTION_ID" \ -e ARM_TENANT_ID=$ARM_SUBSCRIPTION_ID \
$(pwd):/data -w /data \ $(pwd):/data -w /data \
hashicorp/terraform:light \ hashicorp/terraform:light \
apply out.tfplan apply out.tfplan