diff --git a/.travis.yml b/.travis.yml index edf26582c..06fa72134 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: generic # establish environment variables env: - - TEST_DIR=examples/101-vm-simple-linux + - TEST_DIR=examples/azure-vm-simple-linux branches: only: diff --git a/examples/101-vm-simple-linux/deploy.sh b/examples/101-vm-simple-linux/deploy.sh index 3d95969f6..a900e65c7 100644 --- a/examples/101-vm-simple-linux/deploy.sh +++ b/examples/101-vm-simple-linux/deploy.sh @@ -2,11 +2,27 @@ set -o errexit -o nounset -HOSTNAME=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 16) +# generate a unique string for CI deployment +KEY=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 16) terraform get -terraform plan -var 'dns_name='$HOSTNAME -terraform apply -var 'dns_name='$HOSTNAME + +terraform plan \ + -var 'dns_name='$KEY \ + -var 'admin_password='$KEY \ + -var 'admin_username='$KEY \ + -var 'resource_group='$KEY + +terraform apply + -var 'dns_name='$KEY \ + -var 'admin_password='$KEY \ + -var 'admin_username='$KEY \ + -var 'resource_group='$KEY + + +# TODO: determine external validation, possibly Azure CLI + +terraform destroy # echo "Setting git user name" # git config user.name $GH_USER_NAME diff --git a/examples/101-vm-simple-linux/.gitignore b/examples/azure-vm-simple-linux/.gitignore similarity index 100% rename from examples/101-vm-simple-linux/.gitignore rename to examples/azure-vm-simple-linux/.gitignore diff --git a/examples/101-vm-simple-linux/README.md b/examples/azure-vm-simple-linux/README.md similarity index 100% rename from examples/101-vm-simple-linux/README.md rename to examples/azure-vm-simple-linux/README.md diff --git a/examples/azure-vm-simple-linux/deploy.sh b/examples/azure-vm-simple-linux/deploy.sh new file mode 100644 index 000000000..6028622c3 --- /dev/null +++ b/examples/azure-vm-simple-linux/deploy.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -o errexit -o nounset + +HOSTNAME=$(cat /dev/urandom | tr -cd 'a-f0-9' | head -c 16) + +terraform get +terraform plan -var 'dns_name='$HOSTNAME +terraform apply -var 'dns_name='$HOSTNAME + +# TODO: determine external validation, possibly Azure CLI + +terraform destroy + +# echo "Setting git user name" +# git config user.name $GH_USER_NAME +# +# echo "Setting git user email" +# git config user.email $GH_USER_EMAIL +# +# echo "Adding git upstream remote" +# git remote add upstream "https://$GH_TOKEN@github.com/$GH_REPO.git" +# +# git checkout master + + +# +# NOW=$(TZ=America/Chicago date) +# +# git commit -m "tfstate: $NOW [ci skip]" +# +# echo "Pushing changes to upstream master" +# git push upstream master diff --git a/examples/101-vm-simple-linux/main.tf b/examples/azure-vm-simple-linux/main.tf similarity index 98% rename from examples/101-vm-simple-linux/main.tf rename to examples/azure-vm-simple-linux/main.tf index f0ef74241..a94d4325c 100644 --- a/examples/101-vm-simple-linux/main.tf +++ b/examples/azure-vm-simple-linux/main.tf @@ -39,7 +39,7 @@ resource "azurerm_public_ip" "pip" { } resource "azurerm_storage_account" "stor" { - name = "${var.hostname}stor" + name = "${var.dns_name}stor" location = "${var.location}" resource_group_name = "${azurerm_resource_group.rg.name}" account_type = "${var.storage_account_type}" @@ -117,4 +117,4 @@ output "hostname" { output "vm_fqdn" { value = "${azurerm_public_ip.pip.fqdn}" -} \ No newline at end of file +} diff --git a/examples/101-vm-simple-linux/variables.tf b/examples/azure-vm-simple-linux/variables.tf similarity index 96% rename from examples/101-vm-simple-linux/variables.tf rename to examples/azure-vm-simple-linux/variables.tf index b2ab32721..915751c8c 100644 --- a/examples/101-vm-simple-linux/variables.tf +++ b/examples/azure-vm-simple-linux/variables.tf @@ -1,6 +1,5 @@ variable "resource_group" { description = "The name of the resource group in which to create the virtual network." - default = "myresourcegroup" } variable "rg_prefix" { @@ -69,10 +68,8 @@ variable "dns_name" { variable "admin_username" { description = "administrator user name" - default = "vmadmin" } variable "admin_password" { description = "administrator password (recommended to disable password auth)" - default = "T3rr@f0rmP@ssword" }