You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/terraform/terraform-create-complete-vm.md
+16-16Lines changed: 16 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@ title: Quickstart - Use Terraform to create a complete Linux VM in Azure
3
3
description: In this quickstart, you use Terraform to create and manage a complete Linux virtual machine environment in Azure
4
4
keywords: azure devops terraform linux vm virtual machine
5
5
ms.topic: quickstart
6
-
ms.date: 03/09/2020
6
+
ms.date: 03/15/2020
7
7
---
8
8
9
9
# 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
22
22
23
23
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.
24
24
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).
26
26
27
27
> [!TIP]
28
28
> 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.
29
29
30
30
```hcl
31
31
provider "azurerm" {
32
32
# 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.
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`:
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:
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:
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.
195
195
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.
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:
241
241
242
242
```hcl
243
243
# Configure the Microsoft Azure Provider
244
244
provider "azurerm" {
245
245
# 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.
247
247
version = "~>2.0"
248
248
features {}
249
249
@@ -413,7 +413,7 @@ With your Terraform template created, the first step is to initialize Terraform.
413
413
terraform init
414
414
```
415
415
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.
417
417
418
418
```bash
419
419
terraform plan
@@ -448,7 +448,7 @@ Note: You didn't specify an "-out" parameter to save this plan, so when
448
448
Plan: 7 to add, 0 to change, 0 to destroy.
449
449
```
450
450
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:
0 commit comments