Skip to content

Commit 6646fae

Browse files
committed
test 5
1 parent bbf78d5 commit 6646fae

File tree

2 files changed

+22
-26
lines changed

2 files changed

+22
-26
lines changed

articles/virtual-machines/linux/terraform-create-complete-vm.md

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,17 @@ title: Use Terraform to create a complete Linux VM in Azure | Microsoft Docs
33
description: Learn how to use Terraform to create and manage a complete Linux virtual machine environment in Azure
44
services: virtual-machines-linux
55
documentationcenter: virtual-machines
6-
author: echuvyrov
6+
author: tomarchermsft
77
manager: gwallace
88
editor: na
99
tags: azure-resource-manager
10-
1110
ms.assetid:
1211
ms.service: virtual-machines-linux
13-
1412
ms.topic: article
1513
ms.tgt_pltfrm: vm-linux
1614
ms.workload: infrastructure
17-
ms.date: 09/14/2017
18-
ms.author: gwallace
15+
ms.date: 09/20/2019
16+
ms.author: tarcher
1917
---
2018

2119
# Create a complete Linux virtual machine infrastructure in Azure with Terraform
@@ -32,7 +30,7 @@ The `provider` section tells Terraform to use an Azure provider. To get values f
3230
> [!TIP]
3331
> 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.
3432
35-
```tf
33+
```hcl
3634
provider "azurerm" {
3735
subscription_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
3836
client_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
@@ -43,7 +41,7 @@ provider "azurerm" {
4341

4442
The following section creates a resource group named `myResourceGroup` in the `eastus` location:
4543

46-
```tf
44+
```hcl
4745
resource "azurerm_resource_group" "myterraformgroup" {
4846
name = "myResourceGroup"
4947
location = "eastus"
@@ -59,7 +57,7 @@ In additional sections, you reference the resource group with *${azurerm_resourc
5957
## Create virtual network
6058
The following section creates a virtual network named *myVnet* in the *10.0.0.0/16* address space:
6159

62-
```tf
60+
```hcl
6361
resource "azurerm_virtual_network" "myterraformnetwork" {
6462
name = "myVnet"
6563
address_space = ["10.0.0.0/16"]
@@ -74,7 +72,7 @@ resource "azurerm_virtual_network" "myterraformnetwork" {
7472

7573
The following section creates a subnet named *mySubnet* in the *myVnet* virtual network:
7674

77-
```tf
75+
```hcl
7876
resource "azurerm_subnet" "myterraformsubnet" {
7977
name = "mySubnet"
8078
resource_group_name = "${azurerm_resource_group.myterraformgroup.name}"
@@ -87,7 +85,7 @@ resource "azurerm_subnet" "myterraformsubnet" {
8785
## Create public IP address
8886
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*:
8987

90-
```tf
88+
```hcl
9189
resource "azurerm_public_ip" "myterraformpublicip" {
9290
name = "myPublicIP"
9391
location = "eastus"
@@ -104,7 +102,7 @@ resource "azurerm_public_ip" "myterraformpublicip" {
104102
## Create Network Security Group
105103
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:
106104

107-
```tf
105+
```hcl
108106
resource "azurerm_network_security_group" "myterraformnsg" {
109107
name = "myNetworkSecurityGroup"
110108
location = "eastus"
@@ -132,7 +130,7 @@ resource "azurerm_network_security_group" "myterraformnsg" {
132130
## Create virtual network interface card
133131
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:
134132

135-
```tf
133+
```hcl
136134
resource "azurerm_network_interface" "myterraformnic" {
137135
name = "myNIC"
138136
location = "eastus"
@@ -156,7 +154,7 @@ resource "azurerm_network_interface" "myterraformnic" {
156154
## Create storage account for diagnostics
157155
To store boot diagnostics for a VM, you need a storage account. These boot diagnostics can help you troubleshoot problems and monitor the status of your VM. The storage account you create is only to store the boot diagnostics data. As each storage account must have a unique name, the following section generates some random text:
158156

159-
```tf
157+
```hcl
160158
resource "random_id" "randomId" {
161159
keepers = {
162160
# Generate a new ID only when a new resource group is defined
@@ -169,7 +167,7 @@ resource "random_id" "randomId" {
169167

170168
Now you can create a storage account. The following section creates a storage account, with the name based on the random text generated in the preceding step:
171169

172-
```tf
170+
```hcl
173171
resource "azurerm_storage_account" "mystorageaccount" {
174172
name = "diag${random_id.randomId.hex}"
175173
resource_group_name = "${azurerm_resource_group.myterraformgroup.name}"
@@ -190,7 +188,7 @@ The final step is to create a VM and use all the resources created. The followin
190188

191189
SSH key data is provided in the *ssh_keys* section. Provide a valid public SSH key in the *key_data* field.
192190

193-
```tf
191+
```hcl
194192
resource "azurerm_virtual_machine" "myterraformvm" {
195193
name = "myVM"
196194
location = "eastus"
@@ -240,7 +238,7 @@ resource "azurerm_virtual_machine" "myterraformvm" {
240238

241239
To bring all these sections together and see Terraform in action, create a file called *terraform_azure.tf* and paste the following content:
242240

243-
```tf
241+
```hcl
244242
# Configure the Microsoft Azure Provider
245243
provider "azurerm" {
246244
subscription_id = "xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
@@ -418,7 +416,7 @@ terraform plan
418416

419417
After you execute the previous command, you should see something like the following screen:
420418

421-
```bash
419+
```console
422420
Refreshing Terraform state in-memory prior to plan...
423421
The refreshed state will be used to calculate this plan, but will not be
424422
persisted to local or remote state storage.
@@ -453,7 +451,7 @@ terraform apply
453451

454452
Once Terraform completes, your VM infrastructure is ready. Obtain the public IP address of your VM with [az vm show](/cli/azure/vm):
455453

456-
```azurecli
454+
```azurecli-interactive
457455
az vm show --resource-group myResourceGroup --name myVM -d --query [publicIps] --o tsv
458456
```
459457

articles/virtual-machines/linux/terraform-install-configure.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ title: Install and configure Terraform to provision Azure resources | Microsoft
33
description: Learn how to install and configure Terraform to create Azure resources
44
services: virtual-machines-linux
55
documentationcenter: virtual-machines
6-
author: echuvyrov
6+
author: tomarchermsft
77
manager: gwallace
88
editor: na
99
tags: azure-resource-manager
10-
1110
ms.assetid:
1211
ms.service: virtual-machines-linux
13-
1412
ms.topic: article
1513
ms.tgt_pltfrm: vm-linux
1614
ms.workload: infrastructure
17-
ms.date: 09/17/2019
15+
ms.date: 09/20/2019
1816
ms.author: tarcher
1917
---
2018

@@ -34,7 +32,7 @@ To install Terraform, [download](https://www.terraform.io/downloads.html) the ap
3432

3533
Verify your path configuration with the `terraform` command. A list of available Terraform options is shown, as in the following example output:
3634

37-
```bash
35+
```console
3836
azureuser@Azure:~$ terraform
3937
Usage: terraform [--version] [--help] <command> [args]
4038
```
@@ -91,7 +89,7 @@ export ARM_ENVIRONMENT=public
9189

9290
Create a file `test.tf` in an empty directory and paste in the following script.
9391

94-
```tf
92+
```hcl
9593
provider "azurerm" {
9694
}
9795
resource "azurerm_resource_group" "rg" {
@@ -108,7 +106,7 @@ terraform init
108106

109107
The output is similar to the following example:
110108

111-
```bash
109+
```console
112110
* provider.azurerm: version = "~> 0.3"
113111

114112
Terraform has been successfully initialized!
@@ -122,7 +120,7 @@ terraform apply
122120

123121
The output is similar to the following example:
124122

125-
```bash
123+
```console
126124
An execution plan has been generated and is shown below.
127125
Resource actions are indicated with the following symbols:
128126
+ create

0 commit comments

Comments
 (0)