From 77775462ff802257fece757fc8ef7a86423e0f85 Mon Sep 17 00:00:00 2001 From: Scott Nowicki Date: Thu, 27 Apr 2017 12:16:00 -0500 Subject: [PATCH] consolidated deploy and after_deploy into a single script; simplified ci process; added os_profile_linux_config --- .travis.yml | 5 +---- .../after_deploy.ci.sh | 9 --------- .../deploy.ci.sh | 20 +++++++++++++++++++ .../main.tf | 4 ++++ 4 files changed, 25 insertions(+), 13 deletions(-) delete mode 100755 examples/azure-vm-simple-linux-managed-disk/after_deploy.ci.sh diff --git a/.travis.yml b/.travis.yml index e1e60f70e..95eea8d31 100644 --- a/.travis.yml +++ b/.travis.yml @@ -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 diff --git a/examples/azure-vm-simple-linux-managed-disk/after_deploy.ci.sh b/examples/azure-vm-simple-linux-managed-disk/after_deploy.ci.sh deleted file mode 100755 index 245aba380..000000000 --- a/examples/azure-vm-simple-linux-managed-disk/after_deploy.ci.sh +++ /dev/null @@ -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" diff --git a/examples/azure-vm-simple-linux-managed-disk/deploy.ci.sh b/examples/azure-vm-simple-linux-managed-disk/deploy.ci.sh index 8fa08573f..f3f20ba1d 100755 --- a/examples/azure-vm-simple-linux-managed-disk/deploy.ci.sh +++ b/examples/azure-vm-simple-linux-managed-disk/deploy.ci.sh @@ -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" diff --git a/examples/azure-vm-simple-linux-managed-disk/main.tf b/examples/azure-vm-simple-linux-managed-disk/main.tf index e9c0877d5..b476042c7 100644 --- a/examples/azure-vm-simple-linux-managed-disk/main.tf +++ b/examples/azure-vm-simple-linux-managed-disk/main.tf @@ -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}"