Consolidate variables and make file (#262)

This commit is contained in:
Marcus Robinson 2021-06-15 09:05:47 +01:00 коммит произвёл GitHub
Родитель 0fe739b8d5
Коммит 7807b71002
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
42 изменённых файлов: 240 добавлений и 363 удалений

56
.github/workflows/deploy_tre.yml поставляемый
Просмотреть файл

@ -30,13 +30,13 @@ jobs:
- name: Deploy TRE
shell: bash
env:
TF_VAR_tre_id: ${{ secrets.TRE_ID }}
TF_VAR_state_storage: ${{ secrets.STATE_STORAGE_ACCOUNT_NAME }}
TF_VAR_mgmt_res_group: ${{ secrets.MGMT_RESOURCE_GROUP }}
TF_VAR_state_container: ${{ secrets.TF_STATE_CONTAINER }}
TF_VAR_location: ${{ secrets.LOCATION }}
TF_VAR_acr_name: ${{ secrets.ACR_NAME }}
TF_VAR_address_space: ${{ secrets.ADDRESS_SPACE }}
TRE_ID: ${{ secrets.TRE_ID }}
TERRAFORM_STATE_CONTAINER_NAME: ${{ secrets.TF_STATE_CONTAINER }}
MGMT_RESOURCE_GROUP_NAME: ${{ secrets.MGMT_RESOURCE_GROUP }}
MGMT_STORAGE_ACCOUNT_NAME: ${{ secrets.STATE_STORAGE_ACCOUNT_NAME }}
LOCATION: ${{ secrets.LOCATION }}
ACR_NAME: ${{ secrets.ACR_NAME }}
ADDRESS_SPACE: ${{ secrets.ADDRESS_SPACE }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
AZURE_CONTRIBUTOR_SP: ${{ secrets.AZURE_CONTRIBUTOR_SP }}
run: |
@ -52,14 +52,21 @@ jobs:
echo $GITHUB_REF
if [ $GITHUB_EVENT_NAME == 'push' ] && [ $GITHUB_REF == 'refs/heads/develop' ]; then
TF_VAR_image_tag='develop-latest'
IMAGE_TAG='develop-latest'
elif [ $GITHUB_EVENT_NAME == 'push' ] && [ $GITHUB_REF == 'refs/heads/main' ]; then
TF_VAR_image_tag='main-latest'
IMAGE_TAG='main-latest'
else
TF_VAR_image_tag=$GITHUB_SHA
IMAGE_TAG=$GITHUB_SHA
fi
export TF_VAR_image_tag
export IMAGE_TAG
export TF_VAR_tre_id=$TRE_ID
export TF_VAR_mgmt_storage_account_name=$MGMT_STORAGE_ACCOUNT_NAME
export TF_VAR_mgmt_resource_group_name=$MGMT_RESOURCE_GROUP_NAME
export TF_VAR_terraform_state_container_name=$TERRAFORM_STATE_CONTAINER_NAME
export TF_VAR_location=$LOCATION
export TF_VAR_acr_name=$ACR_NAME
export TF_VAR_address_space=$ADDRESS_SPACE
make all
@ -82,10 +89,10 @@ jobs:
LOCATION: ${{ secrets.LOCATION }}
WORKSPACE_ID: "0001"
ADDRESS_SPACE: "10.2.1.0/24"
TF_VAR_acr_name: ${{ secrets.ACR_NAME }}
TF_VAR_tfstate_container_name: ${{ secrets.TF_STATE_CONTAINER }}
TF_VAR_tfstate_resource_group_name: ${{ secrets.MGMT_RESOURCE_GROUP }}
TF_VAR_tfstate_storage_account_name: ${{ secrets.STATE_STORAGE_ACCOUNT_NAME }}
ACR_NAME: ${{ secrets.ACR_NAME }}
TERRAFORM_STATE_CONTAINER_NAME: ${{ secrets.TF_STATE_CONTAINER }}
MGMT_RESOURCE_GROUP_NAME: ${{ secrets.MGMT_RESOURCE_GROUP }}
MGMT_STORAGE_ACCOUNT_NAME: ${{ secrets.STATE_STORAGE_ACCOUNT_NAME }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
run: |
export USE_ENV_VARS_NOT_FILES=true
@ -98,8 +105,8 @@ jobs:
curl -L https://cdn.porter.sh/latest/install-linux.sh | bash && ~/.porter/porter mixin install docker
export PATH=~/.porter/:$PATH
make workspaces-vanilla-porter-publish
make workspaces-vanilla-porter-install
make porter-publish DIR=./workspaces/vanilla
make porter-install DIR=./workspaces/vanilla
deploy_azureml_devtestlabs_workspace:
name: Deploy Azure ML and DevTest Labs Workspace
@ -120,11 +127,10 @@ jobs:
LOCATION: ${{ secrets.LOCATION }}
WORKSPACE_ID: "0002"
ADDRESS_SPACE: "10.2.2.0/24"
TF_VAR_acr_name: ${{ secrets.ACR_NAME }}
ACR_NAME: ${{ secrets.ACR_NAME }}
TF_VAR_tfstate_container_name: ${{ secrets.TF_STATE_CONTAINER }}
TF_VAR_tfstate_resource_group_name: ${{ secrets.MGMT_RESOURCE_GROUP }}
TF_VAR_tfstate_storage_account_name: ${{ secrets.STATE_STORAGE_ACCOUNT_NAME }}
TERRAFORM_STATE_CONTAINER_NAME: ${{ secrets.TF_STATE_CONTAINER }}
MGMT_RESOURCE_GROUP_NAME: ${{ secrets.MGMT_RESOURCE_GROUP }}
MGMT_STORAGE_ACCOUNT_NAME: ${{ secrets.STATE_STORAGE_ACCOUNT_NAME }}
AZURE_CREDENTIALS: ${{ secrets.AZURE_CREDENTIALS }}
run: |
@ -138,7 +144,7 @@ jobs:
curl -L https://cdn.porter.sh/latest/install-linux.sh | bash && ~/.porter/porter mixin install docker
export PATH=~/.porter/:$PATH
make services-azureml-porter-publish
make services-devtestlabs-porter-publish
make workspaces-azureml_devtestlabs-porter-publish
make workspaces-azureml_devtestlabs-porter-install
make porter-publish DIR=./workspaces/services/azureml
make porter-publish DIR=./workspaces/services/devtestlabs
make porter-publish DIR=./workspaces/azureml_devtestlabs
make porter-install DIR=./workspaces/azureml_devtestlabs

214
Makefile
Просмотреть файл

@ -7,51 +7,54 @@ all: bootstrap mgmt-deploy build-api-image push-api-image build-cnab-image push-
bootstrap:
echo -e "\n\e[34m»»» 🧩 \e[96mBootstrap Terraform\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh nodocker \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& . ./devops/scripts/load_terraform_env.sh ./devops/.env \
&& cd ./devops/terraform && ./bootstrap.sh
mgmt-deploy:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying management infrastructure\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh nodocker \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_terraform_env.sh ./devops/.env \
&& cd ./devops/terraform && ./deploy.sh
mgmt-destroy:
echo -e "\n\e[34m»»» 🧩 \e[96mDestroying management infrastructure\e[0m..." \
. ./devops/scripts/check_dependencies.sh nodocker \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_terraform_env.sh ./devops/.env \
&& cd ./devops/terraform && ./destroy.sh
build-api-image:
echo -e "\n\e[34m»»» 🧩 \e[96mBuilding Images\e[0m..." \
echo -e "\n\e[34m»»» 🧩 \e[96mBuilding API Image\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& ./devops/scripts/build_images.sh api
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& docker build -t "$${ACR_NAME}.azurecr.io/microsoft/azuretre/management-api:$${IMAGE_TAG}" ./management_api_app/
build-cnab-image:
echo -e "\n\e[34m»»» 🧩 \e[96mBuilding Images\e[0m..." \
echo -e "\n\e[34m»»» 🧩 \e[96mBuilding CNAB Image\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& ./devops/scripts/build_images.sh cnab
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& docker build -t "$${ACR_NAME}.azurecr.io/microsoft/azuretre/cnab-aci:$${IMAGE_TAG}" ./CNAB_container/
push-api-image:
echo -e "\n\e[34m»»» 🧩 \e[96mPushing Images\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& ./devops/scripts/push_images.sh api
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& az acr login -n $${ACR_NAME} \
&& docker push "$${ACR_NAME}.azurecr.io/microsoft/azuretre/management-api:$${IMAGE_TAG}"
push-cnab-image:
echo -e "\n\e[34m»»» 🧩 \e[96mPushing Images\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& ./devops/scripts/push_images.sh cnab
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& az acr login -n $${ACR_NAME} \
&& docker push "$${ACR_NAME}.azurecr.io/microsoft/azuretre/cnab-aci:$${IMAGE_TAG}"
tre-deploy:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying TRE\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh nodocker \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& cd ./templates/core/terraform/ && ./deploy.sh \
&& . ./devops/scripts/load_terraform_env.sh ./devops/.env \
&& . ./devops/scripts/load_terraform_env.sh ./templates/core/.env \
&& cd ./templates/core/terraform/ && ./deploy.sh
&& cd ../../../ && ./devops/scripts/set_contributor_sp_secrets.sh
letsencrypt:
@ -64,151 +67,56 @@ letsencrypt:
tre-destroy:
echo -e "\n\e[34m»»» 🧩 \e[96mDestroying TRE\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh nodocker \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& . ./devops/scripts/load_terraform_env.sh ./devops/.env \
&& . ./devops/scripts/load_terraform_env.sh ./templates/core/.env \
&& cd ./templates/core/terraform/ && ./destroy.sh
workspaces-vanilla-tf-deploy:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying Base Workspace with Terraform\e[0m..." \
terraform-deploy:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying ${DIR} with Terraform\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& . ./devops/scripts/load_env.sh ./workspaces/vanilla/terraform/.env \
&& cd ./workspaces/vanilla/terraform/ && ./deploy.sh
&& . ./devops/scripts/load_terraform_env.sh ./devops/.env \
&& . ./devops/scripts/load_terraform_env.sh ./templates/core/.env \
&& . ./devops/scripts/load_terraform_env.sh ${DIR}/terraform/.env \
&& cd /${DIR}/terraform/ && ./deploy.sh
workspaces-vanilla-tf-destroy:
echo -e "\n\e[34m»»» 🧩 \e[96mDestroying Base Workspace\e[0m..." \
terraform-destroy:
echo -e "\n\e[34m»»» 🧩 \e[96mDestroying ${DIR} Service\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& . ./devops/scripts/load_env.sh ./workspaces/vanilla/terraform/.env \
&& cd ./workspaces/vanilla/terraform/ && ./destroy.sh
&& . ./devops/scripts/load_terraform_env.sh ./devops/.env \
&& . ./devops/scripts/load_terraform_env.sh ./templates/core/.env \
&& . ./devops/scripts/load_terraform_env.sh ${DIR}/terraform/.env \
&& cd ${DIR}/terraform/ && ./destroy.sh
workspaces-vanilla-porter-build:
echo -e "\n\e[34m»»» 🧩 \e[Building vanilla workspace bundle\e[0m..." \
porter-build:
echo -e "\n\e[34m»»» 🧩 \e[96mBuilding ${DIR} bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& cd ./workspaces/vanilla/ && porter build --debug
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/.env \
&& . ./devops/scripts/load_env.sh ${DIR}/.env \
&& cd ${DIR} && porter build --debug
workspaces-vanilla-porter-install:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying Base Workspace with Porter\e[0m..." \
porter-install:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying ${DIR} with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/vanilla/.env \
&& cd ./workspaces/vanilla/ && porter install -p ./parameters.json --cred ./azure.json --debug
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/.env \
&& . ./devops/scripts/load_env.sh ${DIR}/.env \
&& cd ${DIR} && porter install -p ./parameters.json --cred ./azure.json --param porter_driver=docker --allow-docker-host-access --debug
workspaces-vanilla-porter-uninstall:
echo -e "\n\e[34m»»» 🧩 \e[96mUninstalling Base Workspace with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/vanilla/.env \
&& cd ./workspaces/vanilla/ && porter uninstall -p ./parameters.json --cred ./azure.json --debug
porter-uninstall:
echo -e "\n\e[34m»»» 🧩 \e[96mUninstalling ${DIR} with Porter\e[0m..." \
&& ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/.env \
&& . ./devops/scripts/load_env.sh ${DIR}/.env \
&& cd ${DIR} && porter uninstall -p ./parameters.json --cred ./azure.json --debug
workspaces-vanilla-porter-publish:
echo -e "\n\e[34m»»» 🧩 \e[96mPublishing vanilla workspace bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& cd ./workspaces/vanilla/ && ../../devops/scripts/publish_bundle.sh
# Workspace: Azure ML and DevTest Labs
workspaces-azureml_devtestlabs-porter-build:
echo -e "\n\e[34m»»» 🧩 \e[96mBuilding azureml_devtestlabs workspace bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& cd ./workspaces/azureml_devtestlabs/ && porter build --debug
workspaces-azureml_devtestlabs-porter-install:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying azureml_devtestlabs with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/azureml_devtestlabs/.env \
&& cd ./workspaces/azureml_devtestlabs/ && porter install --allow-docker-host-access --param porter_driver="docker" -p ./parameters.json --cred ./azure.json --debug
workspaces-azureml_devtestlabs-porter-uninstall:
echo -e "\n\e[34m»»» 🧩 \e[96mUninstalling Base Workspace with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/azureml_devtestlabs/.env \
&& cd ./workspaces/azureml_devtestlabs/ && porter uninstall --allow-docker-host-access -p ./parameters.json --cred ./azure.json --debug
workspaces-azureml_devtestlabs-porter-publish:
echo -e "\n\e[34m»»» 🧩 \e[96mPublishing azureml_devtestlabs workspace bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& cd ./workspaces/azureml_devtestlabs/ && ../../devops/scripts/publish_bundle.sh
# Service: Azure ML
services-azureml-tf-deploy:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying Azure ML Service with Terraform\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& . ./devops/scripts/load_env.sh ./workspaces/services/azureml/terraform/.env \
&& cd ./workspaces/services/azureml/terraform/ && ./deploy.sh
services-azureml-tf-destroy:
echo -e "\n\e[34m»»» 🧩 \e[96mDestroying Azure ML Service\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& . ./devops/scripts/load_env.sh ./workspaces/services/azureml/terraform/.env \
&& cd ./workspaces/services/azureml/terraform/ && ./destroy.sh
services-azureml-porter-build:
echo -e "\n\e[34m»»» 🧩 \e[Building Azure ML Servicee bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& cd ./workspaces/services/azureml/ && porter build --debug
services-azureml-porter-install:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying Azure ML Service with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/services/azureml/.env \
&& cd ./workspaces/services/azureml/ && porter install -p ./parameters.json --cred ./azure.json --debug
services-azureml-porter-uninstall:
echo -e "\n\e[34m»»» 🧩 \e[96mUninstalling Azure ML Service with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/services/azureml/.env \
&& cd ./workspaces/services/azureml/ && porter uninstall -p ./parameters.json --cred ./azure.json --debug
services-azureml-porter-publish:
echo -e "\n\e[34m»»» 🧩 \e[96mPublishing Azure ML Service bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& cd ./workspaces/services/azureml/ && ../../../devops/scripts/publish_bundle.sh
# Service: DevTest Labs
services-devtestlabs-tf-deploy:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying DevTest Labs with Terraform\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& . ./devops/scripts/load_env.sh ./workspaces/services/devtestlabs/terraform/.env \
&& cd ./workspaces/services/devtestlabs/terraform/ && ./deploy.sh
services-devtestlabs-tf-destroy:
echo -e "\n\e[34m»»» 🧩 \e[96mDestroying DevTest Labs Service\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/terraform/.env \
&& . ./devops/scripts/load_env.sh ./workspaces/services/devtestlabs/terraform/.env \
&& cd ./workspaces/services/devtestlabs/terraform/ && ./destroy.sh
services-devtestlabs-porter-build:
echo -e "\n\e[34m»»» 🧩 \e[96mBuilding DevTest Labs Service bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& cd ./workspaces/services/devtestlabs/ && porter build --debug
services-devtestlabs-porter-install:
echo -e "\n\e[34m»»» 🧩 \e[96mDeploying DevTest Labs Service with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/services/devtestlabs/.env \
&& cd ./workspaces/services/devtestlabs/ && porter install -p ./parameters.json --cred ./azure.json --debug
services-devtestlabs-porter-uninstall:
echo -e "\n\e[34m»»» 🧩 \e[96mUninstalling DevTest Labs Service with Porter\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./workspaces/services/devtestlabs/.env \
&& cd ./workspaces/services/devtestlabs/ && porter uninstall -p ./parameters.json --cred ./azure.json --debug
services-devtestlabs-porter-publish:
echo -e "\n\e[34m»»» 🧩 \e[96mPublishing DevTest Labs Service bundle\e[0m..." \
&& . ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./devops/terraform/.env \
&& cd ./workspaces/services/devtestlabs/ && ../../../devops/scripts/publish_bundle.sh
porter-publish:
echo -e "\n\e[34m»»» 🧩 \e[96mPublishing ${DIR} bundle\e[0m..." \
&& ./devops/scripts/check_dependencies.sh porter \
&& . ./devops/scripts/load_env.sh ./devops/.env \
&& . ./devops/scripts/load_env.sh ./templates/core/.env \
&& . ./devops/scripts/load_env.sh ${DIR}/.env \
&& az acr login --name $${ACR_NAME} \
&& cd ${DIR} \
&& porter publish --registry "$${ACR_NAME}.azurecr.io" --debug

11
devops/.env.sample Normal file
Просмотреть файл

@ -0,0 +1,11 @@
# Used by backend state
MGMT_STORAGE_ACCOUNT_NAME=__CHANGE_ME__
MGMT_RESOURCE_GROUP_NAME=__CHANGE_ME__
TERRAFORM_STATE_CONTAINER_NAME=tfstate
LOCATION=__CHANGE_ME__
IMAGE_TAG=__CHANGE_ME__
ACR_NAME=_CHANGEME_
ARM_TENANT_ID=_CHANGEME_
ARM_SUBSCRIPTION_ID=_CHANGEME_
ARM_CLIENT_ID=_CHANGEME_
ARM_CLIENT_SECRET=_CHANGEME_

Просмотреть файл

@ -1,8 +0,0 @@
#!/bin/bash
set -e
if [ "$1" == "api" ]; then
docker build -t "${TF_VAR_acr_name}.azurecr.io/microsoft/azuretre/management-api:${TF_VAR_image_tag}" ./management_api_app/
elif [ "$1" == "cnab" ]; then
docker build -t "${TF_VAR_acr_name}.azurecr.io/microsoft/azuretre/cnab-aci:${TF_VAR_image_tag}" ./CNAB_container
fi

Просмотреть файл

@ -7,28 +7,37 @@ echo -e "╚══════════════════════
echo -e "\n\e[34m»»» ✅ \e[96mChecking pre-reqs\e[0m..."
echo -e "\n\e[96mChecking for Azure CLI\e[0m..."
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Azure CLI is not installed! 😥 Please go to http://aka.ms/cli to set it up"
exit
fi
docker version > /dev/null 2>&1
if [ $? -ne 0 ] && [[ "$1" != *"nodocker"* ]]; then
if [[ "$1" != *"nodocker"* ]]; then
echo -e "\n\e[96mChecking for Docker\e[0m..."
docker version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Docker is not installed! 😥 Please go to https://docs.docker.com/engine/install/ to set it up"
exit
fi
fi
/opt/certbot/bin/certbot --version > /dev/null 2>&1
if [ $? -ne 0 ] && [[ "$1" == *"certbot"* ]]; then
if [[ "$1" == *"certbot"* ]]; then
echo -e "\n\e[96mChecking for Certbot\e[0m..."
/opt/certbot/bin/certbot --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Certbot is not installed! 😥 Please go to https://certbot.eff.org/lets-encrypt/pip-other to set it up"
exit
fi
fi
porter --version > /dev/null 2>&1
if [ $? -ne 0 ] && [[ "$1" == *"porter"* ]]; then
if [[ "$1" == *"porter"* ]]; then
echo -e "\n\e[96mChecking for porter\e[0m..."
porter --version > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo -e "\e[31m»»» ⚠️ Porter is not installed! 😥 Please go to https://porter.sh/install/ to set it up"
exit
fi
fi
export SUB_NAME=$(az account show --query name -o tsv)

Просмотреть файл

@ -0,0 +1,11 @@
#!/bin/bash
set -e
if [ ! -f $1 ]; then
if [ -z $USE_ENV_VARS_NOT_FILES ]; then
echo -e "\e[31m»»» 💥 Unable to find $1 file, please create file and try again!"
#exit
fi
else
export $(egrep -v '^#' $1 | sed 's/.*/TF_VAR_\L&/' | xargs)
fi

Просмотреть файл

@ -1,5 +0,0 @@
#!/bin/bash
set -e
az acr login --name $TF_VAR_acr_name
porter publish --registry "$TF_VAR_acr_name.azurecr.io" --debug

Просмотреть файл

@ -1,10 +0,0 @@
#!/bin/bash
set -e
az acr login --name $TF_VAR_acr_name
if [ "$1" == "api" ]; then
docker push "$TF_VAR_acr_name.azurecr.io/microsoft/azuretre/management-api":$TF_VAR_image_tag
elif [ "$1" == "cnab" ]; then
docker push "$TF_VAR_acr_name.azurecr.io/microsoft/azuretre/cnab-aci":$TF_VAR_image_tag
fi

Просмотреть файл

@ -1,7 +0,0 @@
# Used by backend state
TF_VAR_state_storage=__CHANGE_ME__
TF_VAR_mgmt_res_group=__CHANGE_ME__
TF_VAR_state_container=tfstate
TF_VAR_location=__CHANGE_ME__
TF_VAR_image_tag=__CHANGE_ME__
TF_VAR_acr_name=__CHANGE_ME__

Просмотреть файл

@ -3,26 +3,27 @@ set -e
# Baseline Azure resources
echo -e "\n\e[34m»»» 🤖 \e[96mCreating resource group and storage account\e[0m..."
az group create --resource-group $TF_VAR_mgmt_res_group --location $TF_VAR_location -o table
az storage account create --resource-group $TF_VAR_mgmt_res_group \
--name $TF_VAR_state_storage --location $TF_VAR_location \
az group create --resource-group $MGMT_RESOURCE_GROUP_NAME --location $LOCATION -o table
az storage account create --resource-group $MGMT_RESOURCE_GROUP_NAME \
--name $MGMT_STORAGE_ACCOUNT_NAME --location $LOCATION \
--kind StorageV2 --sku Standard_LRS -o table
# Blob container
SA_KEY=$(az storage account keys list --account-name $TF_VAR_state_storage --query "[0].value" -o tsv)
az storage container create --account-name $TF_VAR_state_storage --name $TF_VAR_state_container --account-key $SA_KEY -o table
SA_KEY=$(az storage account keys list --account-name $MGMT_STORAGE_ACCOUNT_NAME --query "[0].value" -o tsv)
az storage container create --account-name $MGMT_STORAGE_ACCOUNT_NAME --name $TERRAFORM_STATE_CONTAINER_NAME --account-key $SA_KEY -o table
cat > bootstrap_backend.tf <<BOOTSTRAP_BACKEND
terraform {
backend "azurerm" {
resource_group_name = "$TF_VAR_mgmt_res_group"
storage_account_name = "$TF_VAR_state_storage"
container_name = "$TF_VAR_state_container"
resource_group_name = "$TF_VAR_mgmt_resource_group_name"
storage_account_name = "$TF_VAR_mgmt_storage_account_name"
container_name = "$TF_VAR_terraform_state_container_name"
key = "bootstrap.tfstate"
}
}
BOOTSTRAP_BACKEND
# Set up Terraform
echo -e "\n\e[34m»»» ✨ \e[96mTerraform init\e[0m..."
terraform init -input=false -backend=true -reconfigure
@ -30,8 +31,8 @@ terraform init -input=false -backend=true -reconfigure
# Import the storage account & res group into state
echo -e "\n\e[34m»»» 📤 \e[96mImporting resources to state\e[0m..."
{
terraform import azurerm_resource_group.mgmt "/subscriptions/$SUB_ID/resourceGroups/$TF_VAR_mgmt_res_group"
terraform import azurerm_storage_account.state_storage "/subscriptions/$SUB_ID/resourceGroups/$TF_VAR_mgmt_res_group/providers/Microsoft.Storage/storageAccounts/$TF_VAR_state_storage"
terraform import azurerm_resource_group.mgmt "/subscriptions/$SUB_ID/resourceGroups/$MGMT_RESOURCE_GROUP_NAME"
terraform import azurerm_storage_account.state_storage "/subscriptions/$SUB_ID/resourceGroups/$MGMT_RESOURCE_GROUP_NAME/providers/Microsoft.Storage/storageAccounts/$MGMT_STORAGE_ACCOUNT_NAME"
} || {
echo "State already imported"
}

Просмотреть файл

@ -8,14 +8,14 @@ data "azurerm_client_config" "current" {}
# Core management resources
#
resource "azurerm_resource_group" "mgmt" {
name = var.mgmt_res_group
name = var.mgmt_resource_group_name
location = var.location
}
# Holds Terraform shared state (already exists, created by bootstrap.sh)
resource "azurerm_storage_account" "state_storage" {
name = var.state_storage
name = var.mgmt_storage_account_name
resource_group_name = azurerm_resource_group.mgmt.name
location = azurerm_resource_group.mgmt.location
account_tier = "Standard"

Просмотреть файл

@ -1,9 +1,9 @@
variable "state_storage" {
variable "mgmt_storage_account_name" {
type = string
description = "Storage account created by bootstrap to hold all Terraform state"
}
variable "mgmt_res_group" {
variable "mgmt_resource_group_name" {
type = string
description = "Shared management resource group"
}

Просмотреть файл

@ -34,9 +34,9 @@ You will also need to create the following secrets:
- `TRE_ID`
- `ACR_NAME`
- `MGMT_RESOURCE_GROUP`
- `STATE_STORAGE_ACCOUNT_NAME`
- `TF_STATE_CONTAINER`
- `MGMT_RESOURCE_GROUP_NAME`
- `MGMT_STORAGE_ACCOUNT_NAME`
- `TERRAFORM_STATE_CONTAINER_NAME`
- `LOCATION`
- `ADDRESS_SPACE`

Просмотреть файл

@ -45,14 +45,14 @@ Before running any of the scripts, the configuration variables need to be set. T
Note. `.tfvars` file is not used, this is intentional. The `.env` file format is easier to parse, meaning we can use the values for bash scripts and other purposes
Copy [/devops/terraform/.env.sample](../devops/terraform/.env.sample) to `/devops/terraform/.env` and set values for all variables:
Copy [/devops/.env.sample](../devops/.env.sample) to `/devops/.env` and set values for all variables:
- `TF_VAR_state_storage` - The name of the storage account to hold Terraform state.
- `TF_VAR_mgmt_res_group` - The shared resource group for all management resources, including the storage account.
- `TF_VAR_state_container` - Name of the blob container to hold Terraform state (default: `tfstate`).
- `TF_VAR_location` - Azure region to deploy all resources into.
- `TF_VAR_image_tag` - Default tag for docker images that will be pushed to the container registry and deployed with the Azure TRE.
- `TF_VAR_acr_name` - Globally unique name for the ACR that will be create to store deployment images.
- `MGMT_STORAGE_ACCOUNT_NAME` - The name of the storage account to hold terraform state and other deployment artifacts.
- `MGMT_RESOURCE_GROUP_NAME` - The shared resource group for all management resources, including the storage account.
- `TERRAFORM_STATE_CONTAINER_NAME` - Name of the blob container to hold Terraform state (default: `tfstate`).
- `LOCATION` - Azure region to deploy all resources into.
- `IMAGE_TAG` - Default tag for docker images that will be pushed to the container registry and deployed with the Azure TRE.
- `ACR_NAME` - Globally unique name for the ACR that will be create to store deployment images.
### Bootstrap of back-end state
@ -91,10 +91,10 @@ make push-cnab-image
### Configuring variables
Copy [/templates/core/terraform/.env.sample](../templates/core/terraform/.env.sample) to `/templates/core/terraform/.env` and set values for all variables:
Copy [/templates/core/.env.sample](../templates/core/.env.sample) to `/templates/core/.env` and set values for all variables:
- `TF_VAR_address_space` - Address space for the Azure TRE core virtual network
- `TF_VAR_tre_id` - Globally unique identifier, `tre_id` can be found in the resource names of the Azure TRE instance; for example, a `tre_id` of `mytre-dev-3142` will result in a resource group name for Azure TRE instance of `rg-mytre-dev-3142`. This must be less than 12 characters (Alphanumeric, underscore, and hyphen allowed).
- `ADDRESS_SPACE` - Address space for the Azure TRE core virtual network
- `TRE_ID` - Globally unique identifier, `TRE_ID` can be found in the resource names of the Azure TRE instance; for example, a `TRE_ID` of `mytre-dev-3142` will result in a resource group name for Azure TRE instance of `rg-mytre-dev-3142`. This must be less than 12 characters (Alphanumeric, underscore, and hyphen allowed).
### Deploy

Просмотреть файл

@ -0,0 +1,4 @@
# Used for TRE deployment
ADDRESS_SPACE="10.1.0.0/16"
TRE_ID=__CHANGE_ME__
MANAGEMENT_API_IMAGE_TAG=dev

Просмотреть файл

@ -1,3 +0,0 @@
# Used for TRE deployment
TF_VAR_address_space="10.1.0.0/16"
TF_VAR_tre_id=__CHANGE_ME__

Просмотреть файл

@ -1,19 +1,18 @@
cat >core_backend.tf <<TRE_BACKEND
terraform {
backend "azurerm" {
resource_group_name = "$TF_VAR_mgmt_res_group"
storage_account_name = "$TF_VAR_state_storage"
container_name = "$TF_VAR_state_container"
key = "$TF_VAR_tre_id"
resource_group_name = "$TF_VAR_mgmt_resource_group_name"
storage_account_name = "$TF_VAR_mgmt_storage_account_name"
container_name = "$TF_VAR_terraform_state_container_name"
key = "$TRE_ID"
}
}
TRE_BACKEND
export TF_VAR_docker_registry_server="$TF_VAR_acr_name.azurecr.io"
export TF_VAR_docker_registry_username=$TF_VAR_acr_name
export TF_VAR_docker_registry_password=$(az acr credential show --name ${TF_VAR_acr_name} --query passwords[0].value -o tsv | sed 's/"//g')
export TF_VAR_management_api_image_tag=$TF_VAR_image_tag
export TF_VAR_docker_registry_server="$ACR_NAME.azurecr.io"
export TF_VAR_docker_registry_username=$ACR_NAME
export TF_VAR_docker_registry_password=$(az acr credential show --name ${ACR_NAME} --query passwords[0].value -o tsv | sed 's/"//g')
export TF_VAR_management_api_image_tag=$IMAGE_TAG
terraform init -input=false -backend=true -reconfigure
terraform plan

Просмотреть файл

@ -1,6 +1,6 @@
export TF_VAR_docker_registry_server="$TF_VAR_acr_name.azurecr.io"
export TF_VAR_docker_registry_username=$TF_VAR_acr_name
export TF_VAR_docker_registry_password=$(az acr credential show --name ${TF_VAR_acr_name} --query passwords[0].value -o tsv | sed 's/"//g')
export TF_VAR_management_api_image_tag=$TF_VAR_image_tag
export TF_VAR_docker_registry_server="$ACR_NAME.azurecr.io"
export TF_VAR_docker_registry_username=$ACR_NAME
export TF_VAR_docker_registry_password=$(az acr credential show --name ${ACR_NAME} --query passwords[0].value -o tsv | sed 's/"//g')
export TF_VAR_management_api_image_tag=$IMAGE_TAG
terraform destroy -auto-approve

Просмотреть файл

@ -2,11 +2,3 @@ TRE_ID="mytre-dev"
WORKSPACE_ID="006"
ADDRESS_SPACE="10.2.6.0/24"
LOCATION=westeurope
ACR_NAME=_CHANGEME_
ARM_TENANT_ID=_CHANGEME_
ARM_SUBSCRIPTION_ID=_CHANGEME_
ARM_CLIENT_ID=_CHANGEME_
ARM_CLIENT_SECRET=_CHANGEME_
TF_VAR_tfstate_resource_group_name=_CHANGEME_
TF_VAR_tfstate_storage_account_name=_CHANGEME_
TF_VAR_tfstate_container_name=_CHANGEME_

Просмотреть файл

@ -37,19 +37,19 @@
{
"name": "tfstate_container_name",
"source": {
"env": "TF_VAR_tfstate_container_name"
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "TF_VAR_tfstate_resource_group_name"
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "TF_VAR_tfstate_storage_account_name"
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]

Просмотреть файл

@ -19,19 +19,19 @@
{
"name": "tfstate_container_name",
"source": {
"env": "TF_VAR_tfstate_container_name"
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "TF_VAR_tfstate_resource_group_name"
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "TF_VAR_tfstate_storage_account_name"
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]

Просмотреть файл

@ -19,19 +19,19 @@
{
"name": "tfstate_container_name",
"source": {
"env": "TF_VAR_tfstate_container_name"
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "TF_VAR_tfstate_resource_group_name"
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "TF_VAR_tfstate_storage_account_name"
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]

Просмотреть файл

@ -31,19 +31,19 @@
{
"name": "tfstate_container_name",
"source": {
"env": "TF_VAR_tfstate_container_name"
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "TF_VAR_tfstate_resource_group_name"
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "TF_VAR_tfstate_storage_account_name"
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]

Просмотреть файл

@ -34,18 +34,18 @@ parameters:
type: string
description: "Name of the azure container registry"
- name: tfstate_resource_group_name
env: TF_VAR_tfstate_resource_group_name
type: string
description: "Resource group containing the Terraform state storage account"
env: MGMT_RESOURCE_GROUP_NAME
- name: tfstate_storage_account_name
env: TF_VAR_tfstate_storage_account_name
type: string
description: "The name of the Terraform state storage account"
env: MGMT_STORAGE_ACCOUNT_NAME
- name: tfstate_container_name
env: TF_VAR_tfstate_container_name
type: string
default: "tfstate"
description: "The name of the Terraform state storage container"
env: TERRAFORM_STATE_CONTAINER_NAME
- name: porter_driver
default: "azure"
type: string

Просмотреть файл

@ -26,25 +26,25 @@ Service Tags:
- A deployed TRE instance
- A Vanilla Workspace Bundle published
`make workspaces-vanilla-porter-build`
`make workspaces-vanilla-porter-publish`
`make porter-build DIR=./workspaces/vanilla`
`make porter-publish DIR=./workspaces/vanilla`
- A Azure ML Service bundle published
`make services-azureml-porter-build`
`make services-azureml-porter-publish`
`make porter-build DIR=./workspaces/services/azureml`
`make porter-publish DIR=./workspaces/services/azureml`
- A DevTest Labs Service bundle published
`make services-devtestlabs-porter-build`
`make services-devtestlabs-porter-publish`
`make porter-build DIR=./workspaces/services/devtestlabs`
`make porter-publish DIR=./workspaces/services/devtestlabs`
- CNAB image built (contains azure driver)
`make build-cnab-image`
- A Azure ML DevTest Labs Workspace bundle built
`make services-devtestlabs-porter-build`
`make porter-build DIR=./workspaces/azureml-devtestlabs`
## To deploy
- Once prerequisites are installed, create a copy of `workspaces/azureml_devtestlabs/.env.sample` called `.env` in the `workspaces/azureml_devtestlabs/` directory. Update the environment variable values to match your installation.
- Run: `make workspaces-azureml_devtestlabs-porter-install`
- Run: `make porter-install DIR=./workspaces/azureml-devtestlabs`

@ -1 +0,0 @@
Subproject commit 4a54228678e20b8cb1c54c01cf88b0526253bccd

Просмотреть файл

@ -1,9 +1,2 @@
TRE_ID=__CHANGE_ME__
WORKSPACE_ID=__CHANGE_ME__
ARM_TENANT_ID=_CHANGEME_
ARM_SUBSCRIPTION_ID=_CHANGEME_
ARM_CLIENT_ID=_CHANGEME_
ARM_CLIENT_SECRET=_CHANGEME_
TF_VAR_tfstate_resource_group_name=_CHANGEME_
TF_VAR_tfstate_storage_account_name=_CHANGEME_
TF_VAR_tfstate_container_name=_CHANGEME_

Просмотреть файл

@ -19,19 +19,19 @@
{
"name": "tfstate_container_name",
"source": {
"env": "TF_VAR_tfstate_container_name"
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "TF_VAR_tfstate_resource_group_name"
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "TF_VAR_tfstate_storage_account_name"
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]

Просмотреть файл

@ -19,15 +19,13 @@ parameters:
- name: tre_id
type: string
- name: tfstate_resource_group_name
env: TF_VAR_tfstate_resource_group_name
type: string
description: "Resource group containing the Terraform state storage account"
- name: tfstate_storage_account_name
env: TF_VAR_tfstate_storage_account_name
type: string
description: "The name of the Terraform state storage account"
- name: tfstate_container_name
env: TF_VAR_tfstate_container_name
env: tfstate_container_name
type: string
default: "tfstate"
description: "The name of the Terraform state storage container"

Просмотреть файл

@ -1 +0,0 @@
TF_VAR_workspace_id="0001"

Просмотреть файл

@ -1,10 +1,10 @@
cat > service_backend.tf <<TRE_BACKEND
terraform {
backend "azurerm" {
resource_group_name = "$TF_VAR_mgmt_res_group"
storage_account_name = "$TF_VAR_state_storage"
container_name = "$TF_VAR_state_container"
key = "${TF_VAR_tre_id}${TF_VAR_workspace_id}azureml"
resource_group_name = "$TF_VAR_mgmt_resource_group_name"
storage_account_name = "$TF_VAR_mgmt_storage_account_name"
container_name = "$TF_VAR_terraform_state_container_name"
key = "${TRE_ID}${WORKSPACE_ID}azureml"
}
}
TRE_BACKEND

Просмотреть файл

@ -1,9 +1,2 @@
TRE_ID=__CHANGE_ME__
WORKSPACE_ID=__CHANGE_ME__
ARM_TENANT_ID=_CHANGEME_
ARM_SUBSCRIPTION_ID=_CHANGEME_
ARM_CLIENT_ID=_CHANGEME_
ARM_CLIENT_SECRET=_CHANGEME_
TF_VAR_tfstate_resource_group_name=_CHANGEME_
TF_VAR_tfstate_storage_account_name=_CHANGEME_
TF_VAR_tfstate_container_name=_CHANGEME_

Просмотреть файл

@ -19,19 +19,19 @@
{
"name": "tfstate_container_name",
"source": {
"env": "TF_VAR_tfstate_container_name"
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "TF_VAR_tfstate_resource_group_name"
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "TF_VAR_tfstate_storage_account_name"
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]

Просмотреть файл

@ -19,15 +19,13 @@ parameters:
- name: tre_id
type: string
- name: tfstate_resource_group_name
env: TF_VAR_tfstate_resource_group_name
type: string
description: "Resource group containing the Terraform state storage account"
- name: tfstate_storage_account_name
env: TF_VAR_tfstate_storage_account_name
type: string
description: "The name of the Terraform state storage account"
- name: tfstate_container_name
env: TF_VAR_tfstate_container_name
env: tfstate_container_name
type: string
default: "tfstate"
description: "The name of the Terraform state storage container"

Просмотреть файл

@ -1 +0,0 @@
TF_VAR_workspace_id="0001"

Просмотреть файл

@ -1,10 +1,10 @@
cat > service_backend.tf <<TRE_BACKEND
terraform {
backend "azurerm" {
resource_group_name = "$TF_VAR_mgmt_res_group"
storage_account_name = "$TF_VAR_state_storage"
container_name = "$TF_VAR_state_container"
key = "${TF_VAR_tre_id}-ws-${TF_VAR_workspace_id}-svc-virtual-desktop-dev-test-lab"
resource_group_name = "$TF_VAR_mgmt_resource_group_name"
storage_account_name = "$TF_VAR_mgmt_storage_account_name"
container_name = "$TF_VAR_terraform_state_container_name"
key = "${TRE_ID}-ws-${WORKSPACE_ID}-svc-virtual-desktop-dev-test-lab"
}
}
TRE_BACKEND

Просмотреть файл

@ -1,11 +1,4 @@
ARM_TENANT_ID=_CHANGEME_
ARM_SUBSCRIPTION_ID=_CHANGEME_
ARM_CLIENT_ID=_CHANGEME_
ARM_CLIENT_SECRET=_CHANGEME_
tre_id="mytre-dev-3142"
workspace_id="0a9e"
address_space="10.2.6.0/24"
azure_location=westeurope
TF_VAR_tfstate_resource_group_name=_CHANGEME_
TF_VAR_tfstate_storage_account_name=_CHANGEME_
TF_VAR_tfstate_container_name=_CHANGEME_
TRE_ID="mytre-dev-3142"
WORKSPACE_ID="0a9e"
ADDRESS_SPACE="10.2.6.0/24"
AZURE_LOCATION=westeurope

Просмотреть файл

@ -25,11 +25,11 @@
**Option 1:** Using the Makefile:
```cmd
make workspaces-vanilla-porter-build
make porter-build DIR=./workspaces/vanilla
```
```cmd
make workspaces-vanilla-porter-install
make porter-install DIR=./workspaces/vanilla
```
**Option 2:** Using Porter commands:

Просмотреть файл

@ -31,19 +31,19 @@
{
"name": "tfstate_container_name",
"source": {
"env": "TF_VAR_tfstate_container_name"
"env": "TERRAFORM_STATE_CONTAINER_NAME"
}
},
{
"name": "tfstate_resource_group_name",
"source": {
"env": "TF_VAR_tfstate_resource_group_name"
"env": "MGMT_RESOURCE_GROUP_NAME"
}
},
{
"name": "tfstate_storage_account_name",
"source": {
"env": "TF_VAR_tfstate_storage_account_name"
"env": "MGMT_STORAGE_ACCOUNT_NAME"
}
}
]

Просмотреть файл

@ -39,6 +39,10 @@ parameters:
type: string
default: "tfstate"
description: "The name of the Terraform state storage container"
- name: porter_driver
default: "azure"
type: string
description: "The porter driver - azure or docker"
mixins:
- exec

Просмотреть файл

@ -1,7 +0,0 @@
TF_VAR_workspace_id="0001"
TF_VAR_address_space="10.2.1.0/24"
TF_VAR_location=westeurope
TF_VAR_azure_tenant_id=__CHANGE_ME__
TF_VAR_azure_subscription_id=__CHANGE_ME__
TF_VAR_azure_client_id=__CHANGE_ME__
TF_VAR_azure_client_secret=__CHANGE_ME__

Просмотреть файл

@ -1,10 +1,10 @@
cat > workspace_backend.tf <<TRE_BACKEND
terraform {
backend "azurerm" {
resource_group_name = "$TF_VAR_mgmt_res_group"
storage_account_name = "$TF_VAR_state_storage"
container_name = "$TF_VAR_state_container"
key = "$TF_VAR_tre_id$TF_VAR_workspace_id"
resource_group_name = "$TF_VAR_mgmt_resource_group_name"
storage_account_name = "$TF_VAR_mgmt_storage_account_name"
container_name = "$TF_VAR_terraform_state_container_name"
key = "$TRE_ID$WORKSPACE_ID"
}
}
TRE_BACKEND