This repository has been archived by the owner on Aug 20, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moving to az do live subscription (#24)
* using F8 whilst we work out subscription issue * reference to latest ws2019 version * outputs for machines created * project startup script * file format change * use of makefile to run behaviour Co-Authored-By: Marc Denman <MarcDenman@users.noreply.github.com> * default branch to master * updated read me
- Loading branch information
Showing
16 changed files
with
301 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,4 +7,4 @@ | |
|
||
# .tfvars files | ||
*.tfvars | ||
*.tfvars.* | ||
tfplan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
DECRYPT= ./secret -d | ||
ENCRYPT= ./secret | ||
PLAN= tfplan | ||
PLAINTEXT= secrets.auto.tfvars | ||
ENCRYPTED= ${PLAINTEXT}.enc | ||
TF= terraform | ||
|
||
all: login apply clean | ||
|
||
clean: | ||
@rm -f ${PLAINTEXT} ${PLAN} | ||
|
||
plan: ${PLAN} | ||
|
||
${ENCRYPTED}: encrypt | ||
${PLAINTEXT}: decrypt | ||
|
||
${PLAN}: ${PLAINTEXT} | ||
@-echo "Validating ..." | ||
@${TF} validate | ||
@-echo "Creating ${PLAN} ..." | ||
@${TF} plan -out=${PLAN} -input=false | ||
|
||
login: | ||
@-echo "Azure Login ..." | ||
@az login --service-principal -u ${ARM_CLIENT_ID} -p ${ARM_CLIENT_SECRET} --tenant ${ARM_TENANT_ID} | ||
|
||
decrypt: | ||
@-echo "Decrypting ${ENCRYPTED} > ${PLAINTEXT} ..." | ||
@${DECRYPT} ${ENCRYPTED} > ${PLAINTEXT} | ||
|
||
encrypt: | ||
@-echo "Encrypting ${PLAINTEXT} > ${ENCRYPTED} ..." | ||
${ENCRYPT} ${PLAINTEXT} > ${ENCRYPTED} | ||
|
||
init: | ||
@-echo "Initialising ..." | ||
@${TF} init -input=false | ||
|
||
apply: ${PLAN} | ||
@-echo "Applying ${PLAN} ..." | ||
@${TF} apply -input=false -auto-approve tfplan |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "vmName" { | ||
value = azurerm_virtual_machine.VM.name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
output "vmName" { | ||
value = azurerm_virtual_machine.WSVM.name | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#! /bin/bash | ||
|
||
PROG=$(basename $0) | ||
|
||
printerr() { | ||
echo "$@" 1>&2 | ||
} | ||
|
||
usage() { | ||
printerr "Usage: $PROG [-d] [-k <key>] file" | ||
printerr " $PROG -h" | ||
[ -n "$1" ] && exit 1 | ||
} | ||
|
||
help() { | ||
usage | ||
printerr " -d decrypt. Default is to encrypt" | ||
printerr " -h help" | ||
printerr " -k <key> Key. Default \$ARM_ACCESS_KEY" | ||
exit 0 | ||
} | ||
|
||
fail() { printerr "$@"; exit 1; } | ||
|
||
while getopts ":df:hk:" o; do | ||
case "${o}" in | ||
d) | ||
DECRYPT=1 | ||
;; | ||
h) | ||
help | ||
;; | ||
k) | ||
K=$OPTARG | ||
;; | ||
*) | ||
usage 1 | ||
;; | ||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
[ "$#" != "1" ] && usage && exit 0 | ||
|
||
KEY=${K:-$ARM_ACCESS_KEY} | ||
FILE=$1 | ||
|
||
[ -z "$KEY" ] && fail "Key not specified" | ||
[ ! -f "$FILE" ] && fail "$FILE: no such file" | ||
|
||
OPENSSL="openssl enc -aes-256-cbc -md md5 -k $KEY" | ||
|
||
if [ -n "$DECRYPT" ] | ||
then | ||
base64 -d $FILE | $OPENSSL -d | ||
else | ||
$OPENSSL -in $FILE | base64 | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
U2FsdGVkX19+YgSa9+rKQJbKtDptckwOWxQrc9BIjIhhbV9nwNR6z9yGGIAnK0+rHQBnce3ZP+Y1 | ||
QhogkCIlY5nUNrUSW7PeZP8/wEFXp5y2MULSVr8OAGbcohLmvZdiN7H39tNYFr2Xe6/0iglQVwTy | ||
QTnztCuEXWvOZ+Ah4QA6+xbyqTWfKbs6gYHzBq5noXxSxxlxIVst5M1L5gBb9BAQraMzd9e62/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U0r6pjagLb3PaISjdtJD9SZkvtewMqioRblSVK65S3MCHLmb | ||
xLIUY6GXCg== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
terraform { | ||
backend "azurerm" { | ||
resource_group_name = "AzDoLive-rg" | ||
storage_account_name = "azdolivestorageaccount" | ||
container_name = "azdolivecontainer" | ||
key = "subscription.tfstate" | ||
} | ||
} | ||
|
||
data "azurerm_client_config" "current" {} | ||
|
||
data "azurerm_subscription" "current" { | ||
|
||
} | ||
|
||
data "azurerm_resource_group" "main" { | ||
name = "${var.PROJECT_IDENTITY}-rg" | ||
} | ||
|
||
module "keyvault4tf" { | ||
source = "github.com/ukho/terraform-modules/TerraformKeyVaultSecrets" | ||
ResourceGroupName = "${data.azurerm_resource_group.main.name}" | ||
SubscriptionId = "${var.SUBSCRIPTION_ID}" | ||
SubscriptionName = "${var.PROJECT_IDENTITY}" | ||
AdminAccessObjectId = "${var.AdminAccessObjectId}" | ||
TenantId = "${var.TENANT_ID}" | ||
ClientId = "${var.CLIENT_ID}" | ||
ClientSecret = "${var.CLIENT_SECRET}" | ||
AccessKey = "${var.ACCESS_KEY}" | ||
PipelineSp = "${var.PIPELINE_SP}" | ||
Location = "${data.azurerm_resource_group.main.location}" | ||
tags = "${var.TAGS}" | ||
} | ||
|
||
module "staticVNet" { | ||
source = "github.com/UKHO/terraform-modules/vnet" | ||
rg = "${data.azurerm_resource_group.main.name}" | ||
loc = "${data.azurerm_resource_group.main.location}" | ||
tags = "${var.TAGS}" | ||
name = "${var.PROJECT_IDENTITY}-network" | ||
addressspace = ["10.1.0.0/16"] | ||
dnsservers = [] | ||
subnet_names = ["${var.PROJECT_IDENTITY}-internal"] | ||
subnet_prefixes = ["10.1.0.0/24"] | ||
} | ||
|
||
module "nsgAssignment" { | ||
source = "github.com/UKHO/terraform-modules/networksecuritygroup" | ||
rg = "${data.azurerm_resource_group.main.name}" | ||
loc = "${data.azurerm_resource_group.main.location}" | ||
nsg_name = "${var.PROJECT_IDENTITY}-nsg" | ||
vnet_subnet_id = "${module.staticVNet.vnet_subnet_id}" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
U2FsdGVkX1/GGY4zUIZLJea4q/9/bi9PNPKYJmcgYD5bVPBFmI3Y4lENF3sMkjw7E23twvUuRbQQ | ||
6JIPLjJ2yZJxBO5YrjD/+uTKwSPhXlEJ65YThIMt5287cU/jcuPN19UeQBId8MBBq/kp+Bn8DbWe | ||
IjyxGISCa/XnqEBGg6Gmeg/LN0sfXAfsE6GsHbpY5isH6MQt24TqQ3JJN/G7Iem2eBpXaYtrHb6o | ||
f85ehMO1xkJZMIL+hqcb5ICClIBFC/8Tuzbo0BVBvPKER03Z+H+RjmrPOZ3qbpLzyiwspSyP4LJf | ||
IFaBIuXrn5JWmakiVHLRbdPG8ueNL6s/JzpzmC6zzNR2LpaHUfLKdReZIgCbmuhgI48CEG/IdAkV | ||
qo4sSZ3r6HeHHUrjgihlzJGKy/mQNqqtXwRiGXwQ59ZmjnbAwfw/9WFrwkKXYP7ZZD4iEF2aLbIm | ||
YkmYIdPnhBEEefEWREonulf3lMN7AG0wE/9pcDVXhJ5HPyGIhyUisjGjkot0DI8M0gFF/Da40Wbx | ||
OTS/5m2QOoaY16Yr7yPNWzV8dFbUzs1QV+XKc3wSPavYj6WF5wZH6pj0bgT6yj9mTSWy09MV+kmw | ||
+u2V5JwfQ/lQTB82qGIZyXziNHhzX+UzdYPX11hmE5E4PBkF9SUcuRhKxfbHmbyzCGPQmSglo4HI | ||
3EsgeRARIY2+W+pMAmFYvv8eI7cMDblvOw1jsMtvO3Bh4jZH1En0OQQiXhwJ3y5rT5mzFuwmzv2i | ||
nB0kri1/dgViupIAJBWykJEukdTqKBjJl6AjQ/BGcZMAYMsSQWd3TVkmZ97o1c0fzN18abTUj+0r | ||
gOjWnDxVD4UkNpyIWsb+KzfFzM257n4vN6TKxFY9CcRcH9TyAPL8FvPJx8RPArT+1GX7Z6HCGfBS | ||
mrg75SbcRQTMQBnIL587c3fy+EyETRKlcym0HH1sIQX9Lrga |
Oops, something went wrong.