renamed folder; updated deployment script; prompt for additional variables
This commit is contained in:
parent
c4ac9c3dbb
commit
048ab5a774
|
@ -2,7 +2,7 @@ language: generic
|
||||||
|
|
||||||
# establish environment variables
|
# establish environment variables
|
||||||
env:
|
env:
|
||||||
- TEST_DIR=examples/101-vm-simple-linux
|
- TEST_DIR=examples/azure-vm-simple-linux
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
|
|
|
@ -2,11 +2,27 @@
|
||||||
|
|
||||||
set -o errexit -o nounset
|
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 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"
|
# echo "Setting git user name"
|
||||||
# git config user.name $GH_USER_NAME
|
# git config user.name $GH_USER_NAME
|
||||||
|
|
|
@ -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
|
|
@ -39,7 +39,7 @@ resource "azurerm_public_ip" "pip" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "azurerm_storage_account" "stor" {
|
resource "azurerm_storage_account" "stor" {
|
||||||
name = "${var.hostname}stor"
|
name = "${var.dns_name}stor"
|
||||||
location = "${var.location}"
|
location = "${var.location}"
|
||||||
resource_group_name = "${azurerm_resource_group.rg.name}"
|
resource_group_name = "${azurerm_resource_group.rg.name}"
|
||||||
account_type = "${var.storage_account_type}"
|
account_type = "${var.storage_account_type}"
|
||||||
|
@ -117,4 +117,4 @@ output "hostname" {
|
||||||
|
|
||||||
output "vm_fqdn" {
|
output "vm_fqdn" {
|
||||||
value = "${azurerm_public_ip.pip.fqdn}"
|
value = "${azurerm_public_ip.pip.fqdn}"
|
||||||
}
|
}
|
|
@ -1,6 +1,5 @@
|
||||||
variable "resource_group" {
|
variable "resource_group" {
|
||||||
description = "The name of the resource group in which to create the virtual network."
|
description = "The name of the resource group in which to create the virtual network."
|
||||||
default = "myresourcegroup"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "rg_prefix" {
|
variable "rg_prefix" {
|
||||||
|
@ -69,10 +68,8 @@ variable "dns_name" {
|
||||||
|
|
||||||
variable "admin_username" {
|
variable "admin_username" {
|
||||||
description = "administrator user name"
|
description = "administrator user name"
|
||||||
default = "vmadmin"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
variable "admin_password" {
|
variable "admin_password" {
|
||||||
description = "administrator password (recommended to disable password auth)"
|
description = "administrator password (recommended to disable password auth)"
|
||||||
default = "T3rr@f0rmP@ssword"
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue