@@ -8,31 +8,31 @@ resource "azurerm_resource_group" "rg" {
88}
99
1010# Create virtual network
11- resource "azurerm_virtual_network" "myterraformnetwork " {
11+ resource "azurerm_virtual_network" "my_terraform_network " {
1212 name = " myVnet"
1313 address_space = [" 10.0.0.0/16" ]
1414 location = azurerm_resource_group. rg . location
1515 resource_group_name = azurerm_resource_group. rg . name
1616}
1717
1818# Create subnet
19- resource "azurerm_subnet" "myterraformsubnet " {
19+ resource "azurerm_subnet" "my_terraform_subnet " {
2020 name = " mySubnet"
2121 resource_group_name = azurerm_resource_group. rg . name
22- virtual_network_name = azurerm_virtual_network. myterraformnetwork . name
22+ virtual_network_name = azurerm_virtual_network. my_terraform_network . name
2323 address_prefixes = [" 10.0.1.0/24" ]
2424}
2525
2626# Create public IPs
27- resource "azurerm_public_ip" "myterraformpublicip " {
27+ resource "azurerm_public_ip" "my_terraform_public_ip " {
2828 name = " myPublicIP"
2929 location = azurerm_resource_group. rg . location
3030 resource_group_name = azurerm_resource_group. rg . name
3131 allocation_method = " Dynamic"
3232}
3333
3434# Create Network Security Group and rule
35- resource "azurerm_network_security_group" "myterraformnsg " {
35+ resource "azurerm_network_security_group" "my_terraform_nsg " {
3636 name = " myNetworkSecurityGroup"
3737 location = azurerm_resource_group. rg . location
3838 resource_group_name = azurerm_resource_group. rg . name
@@ -51,27 +51,27 @@ resource "azurerm_network_security_group" "myterraformnsg" {
5151}
5252
5353# Create network interface
54- resource "azurerm_network_interface" "myterraformnic " {
54+ resource "azurerm_network_interface" "my_terraform_nic " {
5555 name = " myNIC"
5656 location = azurerm_resource_group. rg . location
5757 resource_group_name = azurerm_resource_group. rg . name
5858
5959 ip_configuration {
60- name = " myNicConfiguration "
61- subnet_id = azurerm_subnet. myterraformsubnet . id
60+ name = " my_nic_configuration "
61+ subnet_id = azurerm_subnet. my_terraform_subnet . id
6262 private_ip_address_allocation = " Dynamic"
63- public_ip_address_id = azurerm_public_ip. myterraformpublicip . id
63+ public_ip_address_id = azurerm_public_ip. my_terraform_public_ip . id
6464 }
6565}
6666
6767# Connect the security group to the network interface
6868resource "azurerm_network_interface_security_group_association" "example" {
69- network_interface_id = azurerm_network_interface. myterraformnic . id
70- network_security_group_id = azurerm_network_security_group. myterraformnsg . id
69+ network_interface_id = azurerm_network_interface. my_terraform_nic . id
70+ network_security_group_id = azurerm_network_security_group. my_terraform_nsg . id
7171}
7272
7373# Generate random text for a unique storage account name
74- resource "random_id" "randomId " {
74+ resource "random_id" "random_id " {
7575 keepers = {
7676 # Generate a new ID only when a new resource group is defined
7777 resource_group = azurerm_resource_group.rg.name
@@ -81,8 +81,8 @@ resource "random_id" "randomId" {
8181}
8282
8383# Create storage account for boot diagnostics
84- resource "azurerm_storage_account" "mystorageaccount " {
85- name = " diag${ random_id . randomId . hex } "
84+ resource "azurerm_storage_account" "my_storage_account " {
85+ name = " diag${ random_id . random_id . hex } "
8686 location = azurerm_resource_group. rg . location
8787 resource_group_name = azurerm_resource_group. rg . name
8888 account_tier = " Standard"
@@ -96,11 +96,11 @@ resource "tls_private_key" "example_ssh" {
9696}
9797
9898# Create virtual machine
99- resource "azurerm_linux_virtual_machine" "myterraformvm " {
99+ resource "azurerm_linux_virtual_machine" "my_terraform_vm " {
100100 name = " myVM"
101101 location = azurerm_resource_group. rg . location
102102 resource_group_name = azurerm_resource_group. rg . name
103- network_interface_ids = [azurerm_network_interface . myterraformnic . id ]
103+ network_interface_ids = [azurerm_network_interface . my_terraform_nic . id ]
104104 size = " Standard_DS1_v2"
105105
106106 os_disk {
@@ -126,6 +126,6 @@ resource "azurerm_linux_virtual_machine" "myterraformvm" {
126126 }
127127
128128 boot_diagnostics {
129- storage_account_uri = azurerm_storage_account. mystorageaccount . primary_blob_endpoint
129+ storage_account_uri = azurerm_storage_account. my_storage_account . primary_blob_endpoint
130130 }
131131}
0 commit comments