Skip to content

Latest commit

 

History

History

arm_deployments

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

ARM Deployment Example

This example uses terraform on Azure to perform a couple of deployments using ARM templaytes.

Status

Ready for use

Prerequisites

To run this tutorial, you must have ensured the following...

  • You have access to a Azure account as an admin or owner

This was tested using Terraform version v0.15.2 and Azure versions...

  • "azure-cli": "2.23.0",
  • "azure-cli-core": "2.23.0",
  • "azure-cli-telemetry": "1.0.6"

Useful Commands

The following are useful commands to use when looking at this

    az init
    az account list
    az account set --subscription <id>
    az account list-locations --query [].name
    az account list --query "[].{name:name,isDefault:isDefault}"
    az config set defaults.location=uksouth defaults.group=<rgName>
    az config set extension.use_dynamic_install=yes_without_prompt
    az configure -l true
    cat ~/.azure/config
    az provider list --output table
    az provider list \
        --query "[].{Provider:namespace, Status:registrationState}" \
        --out table | sort -u
    az deployment sub list
    az deployment group list -g <rgName>
    az group export -g <rgName>

Usage

The following instructions show how to deploy it.

(terraform init && terraform plan && terraform apply -auto-approve)

You can just deploy a specific template by doing something like...

    (az group delete -n testdemo -y || true) && \
        (az group delete -n NetworkWatcherRG -y || true) && \
        terraform destroy -auto-approve && \
        (terraform apply -target \
            module.arm_deployments3t.azurerm_resource_group_template_deployment.armDeployment \
            -auto-approve || true) &&  \
    (az group delete -n testdemo -y || true) && \
    (az group delete -n NetworkWatcherRG -y || true) && \
    terraform destroy -auto-approve

Running the Sample in Azure Cloud Shell

To run the example in Cloud Shell, press the button below.

Run in Azure Shell

If you use this method, you will need to manually clone this git repo as Azure does not do it for you.

git clone https://github.com/tpayne/terraform-examples.git samples/Azure/templates/

Clean Up

To clean up do...

terraform destroy -auto-approve

Notes

Issues

  • This example is is only intended as a sample on how to create a system. You will need to configure it as needed
  • This example only demos how to sub-contract/modularise some of the template functionality - mostly the DB items. It does not similarly split up the frontend or backend components. This is left as an exercise for someone as and when
  • Ideally, the common resources used by frontend, backend and db layer should be modularised as common templates, but this is not done for this example

Liability Warning

The contents of this repository (documents and examples) are provided “as-is” with no warrantee implied or otherwise about the accuracy or functionality of the examples.

You use them at your own risk. If anything results to your machine or environment or anything else as a result of ignoring this warning, then the fault is yours only and has nothing to do with me.