Terraform: 101-vm-secure-password


Kiran Patnayakuni   |   Co-authors:  Anusha DokulaVeeresh Setty

Very simple deployment of a Windows VM

Description

This is a conversion of ARM template 101-vm-secure-password  from the repository azure\azure-quickstart-templates  to Terraform configuration.

This configuration allows you to deploy a simple Windows VM by retrieving the password that is stored in a Key Vault. Therefore the password is never put in plain text in the template parameter file, and it will deploy the following resources…

Note:

If the specified resource group is already exist then the script will not continue with the deployment. If you want to deploy the resources to the existing resource group, then import the resource group to state before deployment.

Syntax

# To initialize the configuration directory
PS C:\Terraform\101-vm-secure-password> terraform init 

# To check the execution plan
PS C:\Terraform\101-vm-secure-password> terraform plan

# To deploy the configuration
PS C:\Terraform\101-vm-secure-password> terraform apply

Example

# Initialize
PS C:\Terraform\101-vm-secure-password> terraform init 

# Plan
PS C:\Terraform\101-vm-secure-password> terraform plan -var="adminUsername=cloudguy" 

<--- output truncated --->

# Apply
PS C:\Terraform\101-vm-secure-password> terraform apply -var="adminUsername=cloudguy" 

Output

azurerm_resource_group.arg-01: Creating...
azurerm_resource_group.arg-01: Creation complete after 1s
azurerm_public_ip.apip-01: Creating...
azurerm_virtual_network.avn-01: Creating...

<--- output truncated --->

azurerm_virtual_machine_data_disk_attachment.adattach-01: Still creating... [1m0s elapsed]
azurerm_virtual_machine_data_disk_attachment.adattach-01: Creation complete after 1m2s 

Apply complete! Resources: 12 added, 0 changed, 0 destroyed.

Code

    View the code in GitHub  
Last modified: 10 September 2020

Share it on     |   |   |   | 
comments powered by Disqus