No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Latest commit 031f02d Aug 7, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
appinsights Adding release for tags Jul 25, 2018
scripts Update err handling Jul 30, 2018
sql Fix RG name prefix Jul 25, 2018
state Finalize webapp settings Jul 20, 2018
webapp Adding release for tags Jul 25, 2018
.gitignore initial commit Jul 18, 2018 Fixing url Aug 7, 2018
global.tfvars Adding UAT Jul 20, 2018
release.tfvars Remove release from release.tfvars Jul 25, 2018

Demo Repo for Terraform and VSTS

This demo repo is the source code for my blogpost Terraform all the Things with VSTS.

Working with the Repo

In order to work with this repo, clone it and then do the following:

  1. Create the backend storage account.
    1. Open state\ and comment out the backend block.
    2. Update the variables in (or you can override them on the command line).
    3. Run terraform apply. This creates a storage account and outputs the access_key.
    4. Uncomment the backend block in the file, using values you supplied for the terraform apply command.
    5. Run terraform init, and enter yes to copy your local state.
  2. Add backend.tfvars and secrets.tfvars to the root folder (these are ignored in the .gitignore file). Format of these files is listed below. Copy the access_key output from the state terraform apply command into the backend.tfvars file.
  3. Enter secrets for the database passwords into secrets.tfvars.
  4. For each stack (folder):
    1. Create a workspace (environment). terraform workspace new dev to create a dev workspace. If it already exists, then just select it using terraform workspace select dev.
    2. Run terraform init - this should sync to the backend state.
    3. Run terraform apply
  5. release.tfvars is a template file for variables during release. If you add additional variables, remember to add the tokenized values in this file. For more info, see the blog post.

Secrets Files


access_key = "long_key_from_azure_storage_acc"


secrets = {
  dev = {
    sql_admin_password = "ThisIsASuperL0ngP@sswordThatShouldBeSecure1"

  uat = {
    sql_admin_password = "ThisIsASuperL0ngUATP@sswordThatShouldBeSecure1"