This repository contains Terraform code for Azure - snippets, useful bits, samples, labs and more. Be warned - some of these are simply things I use in my lab and may have no real world use!
Due to the fact that some of the Terraform Projects in this Repository are unlikely to be used alone, the samples provided may also contain supporting elements. So in some cases, items like Resource Groups, VNETs, Subnets and more are deployed to support whatever is being demonstrated. !
To utilise the code you may therefore just deploy as is and see the concept being demonstrated, without needing to adapt the code or rework it. You can then take any elements you require and work them into your code, to move forward from there.
For all of the Projects the following files are provided:
- azuredeploy.tf
- variables.tf
- terraform.tfvars
- provider.tf
Note: some larger projects split out the Terraform elements into separate files for sanity reasons.
These should be placed into a directory, and then Terraform initialised and applied.
This creates a data item that gets the external IP of the machine that is running Terraform. The IP is then used to create an inbound security rule inside a Network Security Group. See: Automatic-ClientIP-NSG
This creates an Azure Key Vault using a random name like "keyvault##########", and then creates a password string, using the random_string resource, which is stored inside the KeyVault. This can then be used during the setup of VMs with Terraform . See: Azure-KeyVault-with-Secret
This code creates a simple Lab environment within a Single Azure Region. The idea here is that it allows for quick deployment of VNETs, Subnets, and a Domain Controller to simulate smaller environments or provide a quick lab for any test requirements. See: Single-Region-Azure-BaseLab
This code creates a simple Lab environment within a Single Azure Region, and also includes an Ubuntu VM with Ansible installed. The idea here is that it allows for quick deployment of VNETs, Subnets, and a Domain Controller to simulate smaller environments or provide a quick lab for any test requirements, and also to provide Ansible. See: Single-Region-Azure-BaseLab-with-Ansible
This code creates a simple Azure Environment with an Ubuntu Server VM, and uses a Custom Script Extension to install Ansible. You can then use Ansible as you require. See Ansible-Quickstart
This code creates a simple Lab environment within two Azure Regions. The idea here is that it allows for quick deployment of VNETs, Subnets, and two Domain Controllers to simulate smaller environments or provide a quick lab for any test requirements. See: Dual-Region-Azure-BaseLab