consolidated deploy and after_deploy into a single script; simplified ci process; added os_profile_linux_config

This commit is contained in:
Scott Nowicki 2017-04-27 12:16:00 -05:00
parent 64b52ee25f
commit 77775462ff
4 changed files with 25 additions and 13 deletions

View File

@ -22,7 +22,7 @@ before_deploy:
- export KEY=$(cat /dev/urandom | tr -cd 'a-z' | head -c 12)
- 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:
- provider: script
skip_cleanup: true
@ -30,6 +30,3 @@ deploy:
on:
repo: harijayms/terraform
branch: master
# handle cleanup of resources
after_deploy: cd $TRAVIS_BUILD_DIR/$TEST_DIR && ./after_deploy.ci.sh

View File

@ -1,9 +0,0 @@
#!/bin/bash
set -o errexit -o nounset
# cleanup deployed azure resources
docker run --rm -it \
azuresdk/azure-cli-python \
sh -c "az login --service-principal -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET --tenant $ARM_TENANT_ID; \
az group delete -y -n $KEY"

View File

@ -15,3 +15,23 @@ docker run --rm -it \
/bin/terraform validate; \
/bin/terraform plan -out=out.tfplan -var dns_name=$KEY -var hostname=$KEY -var resource_group=$KEY -var admin_password=$PASSWORD; \
/bin/terraform apply out.tfplan"
# cleanup deployed azure resources via terraform
docker run --rm -it \
-e ARM_CLIENT_ID \
-e ARM_CLIENT_SECRET \
-e ARM_SUBSCRIPTION_ID \
-e ARM_TENANT_ID \
-v $(pwd):/data \
--workdir=/data \
--entrypoint "/bin/sh" \
hashicorp/terraform:light \
-c "/bin/terraform destroy -force -var dns_name=$KEY -var hostname=$KEY -var resource_group=$KEY -var admin_password=$PASSWORD;"
# cleanup deployed azure resources via azure-cli
# docker run --rm -it \
# azuresdk/azure-cli-python \
# sh -c "az login --service-principal -u $ARM_CLIENT_ID -p $ARM_CLIENT_SECRET --tenant $ARM_TENANT_ID; \
# az group delete -y -n $KEY"

View File

@ -97,6 +97,10 @@ resource "azurerm_virtual_machine" "vm" {
admin_password = "${var.admin_password}"
}
os_profile_linux_config {
disable_password_authentication = false
}
boot_diagnostics {
enabled = "true"
storage_uri = "${azurerm_storage_account.stor.primary_blob_endpoint}"