Skip to content

Commit 1ac34c4

Browse files
authored
Merge pull request #107774 from TomArcherMsft/terraform-github-issue-50217
Terraform - GitHub Issue 50217
2 parents 67aa905 + d0a742c commit 1ac34c4

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

articles/terraform/terraform-create-complete-vm.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ title: Quickstart - Use Terraform to create a complete Linux VM in Azure
33
description: In this quickstart, you use Terraform to create and manage a complete Linux virtual machine environment in Azure
44
keywords: azure devops terraform linux vm virtual machine
55
ms.topic: quickstart
6-
ms.date: 03/09/2020
6+
ms.date: 03/15/2020
77
---
88

99
# Quickstart: Create a complete Linux virtual machine infrastructure in Azure with Terraform
@@ -22,15 +22,15 @@ Terraform allows you to define and create complete infrastructure deployments in
2222

2323
Let's go through each section of a Terraform template. You can also see the full version of the [Terraform template](#complete-terraform-script) that you can copy and paste.
2424

25-
The `provider` section tells Terraform to use an Azure provider. To get values for *subscription_id*, *client_id*, *client_secret*, and *tenant_id*, see [Install and configure Terraform](terraform-install-configure.md).
25+
The `provider` section tells Terraform to use an Azure provider. To get values for `subscription_id`, `client_id`, `client_secret`, and `tenant_id`, see [Install and configure Terraform](terraform-install-configure.md).
2626

2727
> [!TIP]
2828
> If you create environment variables for the values or are using the [Azure Cloud Shell Bash experience](/azure/cloud-shell/overview) , you don't need to include the variable declarations in this section.
2929
3030
```hcl
3131
provider "azurerm" {
3232
# The "feature" block is required for AzureRM provider 2.x.
33-
# If you are using version 1.x, the "features" block is not allowed.
33+
# If you're using version 1.x, the "features" block is not allowed.
3434
version = "~>2.0"
3535
features {}
3636
@@ -54,10 +54,10 @@ resource "azurerm_resource_group" "myterraformgroup" {
5454
}
5555
```
5656

57-
In additional sections, you reference the resource group with *${azurerm_resource_group.myterraformgroup.name}*.
57+
In additional sections, you reference the resource group with `${azurerm_resource_group.myterraformgroup.name}`.
5858

5959
## Create virtual network
60-
The following section creates a virtual network named *myVnet* in the *10.0.0.0/16* address space:
60+
The following section creates a virtual network named `myVnet` in the `10.0.0.0/16` address space:
6161

6262
```hcl
6363
resource "azurerm_virtual_network" "myterraformnetwork" {
@@ -72,7 +72,7 @@ resource "azurerm_virtual_network" "myterraformnetwork" {
7272
}
7373
```
7474

75-
The following section creates a subnet named *mySubnet* in the *myVnet* virtual network:
75+
The following section creates a subnet named `mySubnet` in the `myVnet` virtual network:
7676

7777
```hcl
7878
resource "azurerm_subnet" "myterraformsubnet" {
@@ -85,7 +85,7 @@ resource "azurerm_subnet" "myterraformsubnet" {
8585

8686

8787
## Create public IP address
88-
To access resources across the Internet, create and assign a public IP address to your VM. The following section creates a public IP address named *myPublicIP*:
88+
To access resources across the Internet, create and assign a public IP address to your VM. The following section creates a public IP address named `myPublicIP`:
8989

9090
```hcl
9191
resource "azurerm_public_ip" "myterraformpublicip" {
@@ -102,7 +102,7 @@ resource "azurerm_public_ip" "myterraformpublicip" {
102102

103103

104104
## Create Network Security Group
105-
Network Security Groups control the flow of network traffic in and out of your VM. The following section creates a network security group named *myNetworkSecurityGroup* and defines a rule to allow SSH traffic on TCP port 22:
105+
Network Security Groups control the flow of network traffic in and out of your VM. The following section creates a network security group named `myNetworkSecurityGroup` and defines a rule to allow SSH traffic on TCP port 22:
106106

107107
```hcl
108108
resource "azurerm_network_security_group" "myterraformnsg" {
@@ -130,7 +130,7 @@ resource "azurerm_network_security_group" "myterraformnsg" {
130130

131131

132132
## Create virtual network interface card
133-
A virtual network interface card (NIC) connects your VM to a given virtual network, public IP address, and network security group. The following section in a Terraform template creates a virtual NIC named *myNIC* connected to the virtual networking resources you have created:
133+
A virtual network interface card (NIC) connects your VM to a given virtual network, public IP address, and network security group. The following section in a Terraform template creates a virtual NIC named `myNIC` connected to the virtual networking resources you've created:
134134

135135
```hcl
136136
resource "azurerm_network_interface" "myterraformnic" {
@@ -191,9 +191,9 @@ resource "azurerm_storage_account" "mystorageaccount" {
191191

192192
## Create virtual machine
193193

194-
The final step is to create a VM and use all the resources created. The following section creates a VM named *myVM* and attaches the virtual NIC named *myNIC*. The latest *Ubuntu 16.04-LTS* image is used, and a user named *azureuser* is created with password authentication disabled.
194+
The final step is to create a VM and use all the resources created. The following section creates a VM named `myVM` and attaches the virtual NIC named `myNIC`. The latest `Ubuntu 16.04-LTS` image is used, and a user named `azureuser` is created with password authentication disabled.
195195

196-
SSH key data is provided in the *ssh_keys* section. Provide a valid public SSH key in the *key_data* field.
196+
SSH key data is provided in the `ssh_keys` section. Provide a public SSH key in the `key_data` field.
197197

198198
```hcl
199199
resource "azurerm_linux_virtual_machine" "myterraformvm" {
@@ -209,7 +209,7 @@ resource "azurerm_linux_virtual_machine" "myterraformvm" {
209209
storage_account_type = "Premium_LRS"
210210
}
211211
212-
storage_image_reference {
212+
source_image_reference {
213213
publisher = "Canonical"
214214
offer = "UbuntuServer"
215215
sku = "16.04.0-LTS"
@@ -237,13 +237,13 @@ resource "azurerm_linux_virtual_machine" "myterraformvm" {
237237

238238
## Complete Terraform script
239239

240-
To bring all these sections together and see Terraform in action, create a file called *terraform_azure.tf* and paste the following content:
240+
To bring all these sections together and see Terraform in action, create a file called `terraform_azure.tf` and paste the following content:
241241

242242
```hcl
243243
# Configure the Microsoft Azure Provider
244244
provider "azurerm" {
245245
# The "feature" block is required for AzureRM provider 2.x.
246-
# If you are using version 1.x, the "features" block is not allowed.
246+
# If you're using version 1.x, the "features" block is not allowed.
247247
version = "~>2.0"
248248
features {}
249249
@@ -413,7 +413,7 @@ With your Terraform template created, the first step is to initialize Terraform.
413413
terraform init
414414
```
415415

416-
The next step is to have Terraform review and validate the template. This step compares the requested resources to the state information saved by Terraform and then outputs the planned execution. Resources are *not* created in Azure.
416+
The next step is to have Terraform review and validate the template. This step compares the requested resources to the state information saved by Terraform and then outputs the planned execution. The Azure resources aren't created at this point.
417417

418418
```bash
419419
terraform plan
@@ -448,7 +448,7 @@ Note: You didn't specify an "-out" parameter to save this plan, so when
448448
Plan: 7 to add, 0 to change, 0 to destroy.
449449
```
450450

451-
If everything looks correct and you are ready to build the infrastructure in Azure, apply the template in Terraform:
451+
If everything looks correct and you're ready to build the infrastructure in Azure, apply the template in Terraform:
452452

453453
```bash
454454
terraform apply

0 commit comments

Comments
 (0)