From b410def811ae7cf56fc1a731a54bcd4b98f9336e Mon Sep 17 00:00:00 2001 From: Yaroslava Date: Sat, 29 Nov 2025 23:35:18 +0200 Subject: [PATCH 1/3] terraform vm --- .idea/.gitignore | 3 + .idea/devops_todolist_terraform_task.iml | 12 +++ .idea/inspectionProfiles/Project_Default.xml | 19 +++++ .../inspectionProfiles/profiles_settings.xml | 6 ++ .idea/misc.xml | 7 ++ .idea/modules.xml | 8 ++ .idea/vcs.xml | 6 ++ .terraform.lock.hcl | 40 +++++++++ backend.tf | 11 +++ main.tf | 63 +++++++++++++++ modules/compute/ main.tf | 81 +++++++++++++++++++ modules/compute/outputs.tf | 8 ++ modules/compute/variables.tf | 52 ++++++++++++ modules/network/main.tf | 57 +++++++++++++ modules/network/outputs.tf | 24 ++++++ modules/network/variables.tf | 36 +++++++++ modules/storage/main.tf | 15 ++++ modules/storage/outputs.tf | 15 ++++ modules/storage/variables.tf | 16 ++++ outputs.tf | 19 +++++ terraform.tfvars | 18 +++++ variables.tf | 72 +++++++++++++++++ 22 files changed, 588 insertions(+) create mode 100644 .idea/.gitignore create mode 100644 .idea/devops_todolist_terraform_task.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/inspectionProfiles/profiles_settings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 .terraform.lock.hcl create mode 100644 backend.tf create mode 100644 main.tf create mode 100644 modules/compute/ main.tf create mode 100644 modules/compute/outputs.tf create mode 100644 modules/compute/variables.tf create mode 100644 modules/network/main.tf create mode 100644 modules/network/outputs.tf create mode 100644 modules/network/variables.tf create mode 100644 modules/storage/main.tf create mode 100644 modules/storage/outputs.tf create mode 100644 modules/storage/variables.tf create mode 100644 outputs.tf create mode 100644 terraform.tfvars create mode 100644 variables.tf diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..eaf91e2 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,3 @@ +# Default ignored files +/shelf/ +/workspace.xml diff --git a/.idea/devops_todolist_terraform_task.iml b/.idea/devops_todolist_terraform_task.iml new file mode 100644 index 0000000..2946dc0 --- /dev/null +++ b/.idea/devops_todolist_terraform_task.iml @@ -0,0 +1,12 @@ + + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..4e58d99 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml new file mode 100644 index 0000000..105ce2d --- /dev/null +++ b/.idea/inspectionProfiles/profiles_settings.xml @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..cf5c904 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,7 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..4d150b8 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.terraform.lock.hcl b/.terraform.lock.hcl new file mode 100644 index 0000000..4d6d8b6 --- /dev/null +++ b/.terraform.lock.hcl @@ -0,0 +1,40 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/azurerm" { + version = "4.54.0" + hashes = [ + "h1:gO4ZzW7OihpUYxcarXj8rm69ya+gjRb/9/+RcoASX/k=", + "zh:0adda2cfb2ae9ec394943164cbd5ab1f1fac89a0125ad3966a97363b06b1bd11", + "zh:23dcc71a1586c2b8644476ccd3b4d4d22aa651d6ceb03d32f801bb7ecb09c84f", + "zh:4573833c692a87df167e3adf71c4291879e1a5d2e430ba5255509d3510c7a2f5", + "zh:49132e138bb28b02aa36a00fdcfcf818c4a6d150e3b5148e4d910efac5aaf1bf", + "zh:5dda12ad7f69f91847b99365f66b8dfb1d6ea913d2d06fadbabcea236cc1b346", + "zh:6e45c59dbc54c56c1255f4bb45db15a2ec75dcb2a9125adfa812a667132b332a", + "zh:76802f69f1fa8e894e9c96d6f7098698d1f9c036f30b46a40207fce5ed373ef0", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:846e7222bdeee0150830d82cd2f09619e2239347eba1d05f0409c78a684502d8", + "zh:8822918829f89354ab65b1d588d3185191bbd81e3479510dcbec801d3e3617b0", + "zh:901074c726047a141e256e3229f3e55a5dd4033fec57f889c0118b71e818331b", + "zh:a240979f94f50d2f6ceda2651e5146652468f312f03691f0949876524d160a9d", + ] +} + +provider "registry.terraform.io/hashicorp/random" { + version = "3.7.2" + hashes = [ + "h1:0hcNr59VEJbhZYwuDE/ysmyTS0evkfcLarlni+zATPM=", + "zh:14829603a32e4bc4d05062f059e545a91e27ff033756b48afbae6b3c835f508f", + "zh:1527fb07d9fea400d70e9e6eb4a2b918d5060d604749b6f1c361518e7da546dc", + "zh:1e86bcd7ebec85ba336b423ba1db046aeaa3c0e5f921039b3f1a6fc2f978feab", + "zh:24536dec8bde66753f4b4030b8f3ef43c196d69cccbea1c382d01b222478c7a3", + "zh:29f1786486759fad9b0ce4fdfbbfece9343ad47cd50119045075e05afe49d212", + "zh:4d701e978c2dd8604ba1ce962b047607701e65c078cb22e97171513e9e57491f", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:7b8434212eef0f8c83f5a90c6d76feaf850f6502b61b53c329e85b3b281cba34", + "zh:ac8a23c212258b7976e1621275e3af7099e7e4a3d4478cf8d5d2a27f3bc3e967", + "zh:b516ca74431f3df4c6cf90ddcdb4042c626e026317a33c53f0b445a3d93b720d", + "zh:dc76e4326aec2490c1600d6871a95e78f9050f9ce427c71707ea412a2f2f1a62", + "zh:eac7b63e86c749c7d48f527671c7aee5b4e26c10be6ad7232d6860167f99dbb0", + ] +} diff --git a/backend.tf b/backend.tf new file mode 100644 index 0000000..1b42df6 --- /dev/null +++ b/backend.tf @@ -0,0 +1,11 @@ +# Configuration for the Azure Remote State Backend +# This file defines where Terraform should store its state file (terraform.tfstate) + +terraform { + backend "azurerm" { + resource_group_name = "tfstate-backend-rg" + storage_account_name = "yaroslavastorageaccount" + container_name = "tfstate" + key = "terraform.tfstate" + } +} \ No newline at end of file diff --git a/main.tf b/main.tf new file mode 100644 index 0000000..d618165 --- /dev/null +++ b/main.tf @@ -0,0 +1,63 @@ +# 1. PROVIDERS AND RESOURCE GROUP +provider "azurerm" { + features {} +} + +# Resource Group +resource "azurerm_resource_group" "main" { + name = var.resource_group_name + location = var.location +} + +# Helper resource for a unique DNS label +resource "random_integer" "dns_suffix" { + min = 1000 + max = 9999 +} + +# 2. NETWORK MODULE CALL +module "network" { + source = "./modules/network" + + resource_group_name = azurerm_resource_group.main.name + location = azurerm_resource_group.main.location + virtual_network_name = var.virtual_network_name + vnet_address_prefix = var.vnet_address_prefix + subnet_name = var.subnet_name + subnet_address_prefix = var.subnet_address_prefix + network_security_group_name = var.network_security_group_name + public_ip_address_name = var.public_ip_address_name + dns_label = "${var.dns_label}-${random_integer.dns_suffix.result}" +} + +# 3. STORAGE MODULE CALL +module "storage" { + # CORRECTED path based on your file structure + source = "./modules/storage" + + resource_group_name = azurerm_resource_group.main.name + location = azurerm_resource_group.main.location + storage_account_name = var.storage_account_name + storage_container_name = var.storage_container_name +} + +# 4. COMPUTE MODULE CALL +module "compute" { + source = "./modules/compute" + + resource_group_name = azurerm_resource_group.main.name + location = azurerm_resource_group.main.location + vm_name = var.vm_name + vm_size = var.vm_size + admin_username = "azureuser" + ssh_key_public = var.ssh_key_public + + subnet_id = module.network.subnet_id + public_ip_id = module.network.public_ip_id + nsg_id = module.network.nsg_id + + storage_account_name = module.storage.storage_account_name + storage_container_name = module.storage.storage_container_name + + script_path = "${path.root}/install-app.sh" +} \ No newline at end of file diff --git a/modules/compute/ main.tf b/modules/compute/ main.tf new file mode 100644 index 0000000..0b54521 --- /dev/null +++ b/modules/compute/ main.tf @@ -0,0 +1,81 @@ +# 1. Network Interface (NIC) - name: ${var.vm_name}-nic +resource "azurerm_network_interface" "nic" { + name = "${var.vm_name}-nic" + location = var.location + resource_group_name = var.resource_group_name + + ip_configuration { + name = "ipconfig" + subnet_id = var.subnet_id + private_ip_address_allocation = "Dynamic" + public_ip_address_id = var.public_ip_id + } +} + +# Attach NSG to the NIC +resource "azurerm_network_interface_security_group_association" "nsg_attach" { + network_interface_id = azurerm_network_interface.nic.id + network_security_group_id = var.nsg_id +} + +# 2. Virtual Machine (VM) - name: matebox, size: Standard_B1s, image: Ubuntu +resource "azurerm_linux_virtual_machine" "vm" { + name = var.vm_name + location = var.location + resource_group_name = var.resource_group_name + size = var.vm_size + network_interface_ids = [azurerm_network_interface.nic.id] + + # Using Ubuntu 20.04 LTS (stable choice for extensions) + source_image_reference { + publisher = "Canonical" + offer = "0001-com-ubuntu-server-jammy" # Offer for Ubuntu 22.04 + sku = "22_04-lts" + version = "latest" + } + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + admin_username = var.admin_username + disable_password_authentication = true + + admin_ssh_key { + username = var.admin_username + public_key = var.ssh_key_public # linuxboxsshkey + } +} + +# 3. Upload install-app.sh to Storage Blob +# The CustomScript extension requires a URI to download the file. +resource "azurerm_storage_blob" "app_script" { + name = "install-app.sh" + storage_account_name = var.storage_account_name + storage_container_name = var.storage_container_name + type = "Block" + source = var.script_path # Path to local install-app.sh + content_type = "text/plain" +} + +# 4. VM Extension (CustomScript) to execute install-app.sh +resource "azurerm_virtual_machine_extension" "custom_script_deploy" { + name = "custom-script-deploy" + virtual_machine_id = azurerm_linux_virtual_machine.vm.id + publisher = "Microsoft.Azure.Extensions" + type = "CustomScript" + type_handler_version = "2.1" + auto_upgrade_minor_version = true + + # The CustomScript settings: defines the file to download and the command to run. + settings = jsonencode({ + fileUris = [ + "${azurerm_storage_blob.app_script.url}" # Direct URL to the uploaded blob + ] + commandToExecute = "chmod +x install-app.sh && ./install-app.sh" + }) + + # Ensure the blob is uploaded before the extension runs + depends_on = [azurerm_storage_blob.app_script] +} \ No newline at end of file diff --git a/modules/compute/outputs.tf b/modules/compute/outputs.tf new file mode 100644 index 0000000..0223612 --- /dev/null +++ b/modules/compute/outputs.tf @@ -0,0 +1,8 @@ +output "vm_id" { + description = "The ID of the Virtual Machine." + value = azurerm_linux_virtual_machine.vm.id +} +output "nic_id" { + description = "The ID of the Network Interface." + value = azurerm_network_interface.nic.id +} \ No newline at end of file diff --git a/modules/compute/variables.tf b/modules/compute/variables.tf new file mode 100644 index 0000000..ede0a5e --- /dev/null +++ b/modules/compute/variables.tf @@ -0,0 +1,52 @@ +variable "resource_group_name" { + description = "The name of the Azure resource group." + type = string +} +variable "location" { + description = "The Azure region for deployment." + type = string +} +variable "vm_name" { + description = "The name of the Virtual Machine (matebox)." + type = string +} +variable "vm_size" { + description = "The size of the VM (Standard_B1s)." + type = string +} +variable "admin_username" { + description = "The admin username for the VM." + type = string +} +variable "ssh_key_public" { + description = "The public SSH key content for authentication." + type = string +} + +# Inputs from the Network Module +variable "subnet_id" { + description = "The ID of the Subnet to attach the NIC to." + type = string +} +variable "public_ip_id" { + description = "The ID of the Public IP to attach to the NIC." + type = string +} +variable "nsg_id" { + description = "The ID of the NSG to attach to the NIC." + type = string +} + +# Inputs from the Storage Module (for CustomScript file transfer) +variable "storage_account_name" { + description = "The name of the Storage Account." + type = string +} +variable "storage_container_name" { + description = "The name of the Storage Container." + type = string +} +variable "script_path" { + description = "The local path to the install-app.sh script." + type = string +} \ No newline at end of file diff --git a/modules/network/main.tf b/modules/network/main.tf new file mode 100644 index 0000000..435db02 --- /dev/null +++ b/modules/network/main.tf @@ -0,0 +1,57 @@ +# 1. Virtual Network (vnet) +resource "azurerm_virtual_network" "vnet" { + name = var.virtual_network_name + location = var.location + resource_group_name = var.resource_group_name + address_space = [var.vnet_address_prefix] +} + +# 2. Subnet (default) +resource "azurerm_subnet" "subnet" { + name = var.subnet_name + resource_group_name = var.resource_group_name + virtual_network_name = azurerm_virtual_network.vnet.name + address_prefixes = [var.subnet_address_prefix] +} + +# 3. Public IP Address (linuxboxpip) +resource "azurerm_public_ip" "pip" { + name = var.public_ip_address_name + location = var.location + resource_group_name = var.resource_group_name + allocation_method = "Static" + domain_name_label = var.dns_label # matetask + random number +} + +# 4. Network Security Group (defaultnsg) +resource "azurerm_network_security_group" "nsg" { + name = var.network_security_group_name + location = var.location + resource_group_name = var.resource_group_name + + # Allow SSH (Port 22) + security_rule { + name = "SSH_Allow" + priority = 100 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "22" + source_address_prefix = "Internet" + destination_address_prefix = "*" + } + + # Allow HTTP (Port 80) for the ToDo App + security_rule { + name = "HTTP_Allow" + priority = 101 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "80" + source_address_prefix = "Internet" + destination_address_prefix = "*" + } +} \ No newline at end of file diff --git a/modules/network/outputs.tf b/modules/network/outputs.tf new file mode 100644 index 0000000..4588ee1 --- /dev/null +++ b/modules/network/outputs.tf @@ -0,0 +1,24 @@ +output "subnet_id" { + description = "The ID of the Subnet required by the compute module." + value = azurerm_subnet.subnet.id +} + +output "public_ip_id" { + description = "The ID of the Public IP address." + value = azurerm_public_ip.pip.id +} + +output "public_ip_address" { + description = "The actual Public IP address assigned." + value = azurerm_public_ip.pip.ip_address +} + +output "public_ip_fqdn" { + description = "The fully qualified domain name (FQDN)." + value = azurerm_public_ip.pip.fqdn +} + +output "nsg_id" { + description = "The ID of the Network Security Group." + value = azurerm_network_security_group.nsg.id +} \ No newline at end of file diff --git a/modules/network/variables.tf b/modules/network/variables.tf new file mode 100644 index 0000000..39729ff --- /dev/null +++ b/modules/network/variables.tf @@ -0,0 +1,36 @@ +variable "resource_group_name" { + description = "The name of the Azure resource group." + type = string +} +variable "location" { + description = "The Azure region for deployment." + type = string +} +variable "virtual_network_name" { + description = "The name of the Virtual Network (vnet)." + type = string +} +variable "vnet_address_prefix" { + description = "The address prefix for the VNet (e.g., 10.0.0.0/16)." + type = string +} +variable "subnet_name" { + description = "The name of the subnet (default)." + type = string +} +variable "subnet_address_prefix" { + description = "The address prefix for the subnet (e.g., 10.0.0.0/24)." + type = string +} +variable "network_security_group_name" { + description = "The name of the NSG (defaultnsg)." + type = string +} +variable "public_ip_address_name" { + description = "The name of the Public IP address (linuxboxpip)." + type = string +} +variable "dns_label" { + description = "The DNS label for the Public IP (matetask + random)." + type = string +} \ No newline at end of file diff --git a/modules/storage/main.tf b/modules/storage/main.tf new file mode 100644 index 0000000..f45f731 --- /dev/null +++ b/modules/storage/main.tf @@ -0,0 +1,15 @@ +# 1. Storage Account (must have a globally unique name) +resource "azurerm_storage_account" "sa" { + name = var.storage_account_name + resource_group_name = var.resource_group_name + location = var.location + account_tier = "Standard" + account_replication_type = "LRS" # Local Redundancy (Cost-effective) +} + +# 2. Storage Container (task-artifacts) +resource "azurerm_storage_container" "container" { + name = var.storage_container_name # task-artifacts + storage_account_name = azurerm_storage_account.sa.name + container_access_type = "blob" +} \ No newline at end of file diff --git a/modules/storage/outputs.tf b/modules/storage/outputs.tf new file mode 100644 index 0000000..de789a4 --- /dev/null +++ b/modules/storage/outputs.tf @@ -0,0 +1,15 @@ +output "storage_account_name" { + description = "The name of the created Storage Account." + value = azurerm_storage_account.sa.name +} + +output "storage_container_name" { + description = "The name of the storage container." + value = azurerm_storage_container.container.name +} + +output "storage_account_primary_access_key" { + description = "The primary access key for the Storage Account (required for VM Extension to access private blob)." + value = azurerm_storage_account.sa.primary_access_key + sensitive = true # Mark as sensitive, key should not be displayed in logs +} \ No newline at end of file diff --git a/modules/storage/variables.tf b/modules/storage/variables.tf new file mode 100644 index 0000000..12fd53f --- /dev/null +++ b/modules/storage/variables.tf @@ -0,0 +1,16 @@ +variable "resource_group_name" { + description = "The name of the Azure resource group." + type = string +} +variable "location" { + description = "The Azure region for deployment." + type = string +} +variable "storage_account_name" { + description = "The globally unique name for the Storage Account." + type = string +} +variable "storage_container_name" { + description = "The name for the storage container (task-artifacts)." + type = string +} \ No newline at end of file diff --git a/outputs.tf b/outputs.tf new file mode 100644 index 0000000..a52d3f7 --- /dev/null +++ b/outputs.tf @@ -0,0 +1,19 @@ +# outputs.tf (Root file) + +# Outputs the actual public IP address of the VM +output "public_ip_address" { + description = "The public IP address of the Linux VM." + value = module.network.public_ip_address +} + +# Outputs the full URL for accessing the application +output "application_url" { + description = "The fully qualified domain name (FQDN) to access the ToDo List application." + value = "http://${module.network.public_ip_fqdn}" +} + +# Outputs the SSH command for easy connection (Step 9) +output "vm_ssh_connection" { + description = "The SSH command to connect to the VM." + value = "ssh ${var.admin_username}@${module.network.public_ip_fqdn}" +} \ No newline at end of file diff --git a/terraform.tfvars b/terraform.tfvars new file mode 100644 index 0000000..4b5be26 --- /dev/null +++ b/terraform.tfvars @@ -0,0 +1,18 @@ +location = "westeurope" +resource_group_name = "mate-azure-task-12" + +virtual_network_name = "vnet" +vnet_address_prefix = "10.0.0.0/16" +subnet_name = "default" +subnet_address_prefix = "10.0.0.0/24" +network_security_group_name = "defaultnsg" +public_ip_address_name = "linuxboxpip" +dns_label = "matetask" + +vm_name = "matebox" +vm_size = "Standard_B1s" +admin_username = "azureuser" +ssh_key_public = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIdHUkSxau+yb8G5UPXkz41pfhrRFY3Sgbke/nDP/ihL yaros@DESKTOP-KS37CUL" + +storage_account_name = "matetask6storageacc12345" +storage_container_name = "task-artifacts" \ No newline at end of file diff --git a/variables.tf b/variables.tf new file mode 100644 index 0000000..038babb --- /dev/null +++ b/variables.tf @@ -0,0 +1,72 @@ +# variables.tf (Root file) + +# 1. GENERAL VARIABLES +variable "location" { + type = string + description = "Azure region for deployment (uksouth)." +} +variable "resource_group_name" { + type = string + description = "Name of the resource group (mate-azure-task-12)." +} + +# 2. NETWORK VARIABLES +variable "virtual_network_name" { + type = string + description = "Name of the Virtual Network (vnet)." +} +variable "vnet_address_prefix" { + type = string + description = "VNet address space (10.0.0.0/16)." +} +variable "subnet_name" { + type = string + description = "Name of the Subnet (default)." +} +variable "subnet_address_prefix" { + type = string + description = "Subnet address prefix (10.0.0.0/24)." +} +variable "network_security_group_name" { + type = string + description = "Name of the NSG (defaultnsg)." +} +variable "public_ip_address_name" { + type = string + description = "Name of the Public IP address (linuxboxpip)." +} +variable "dns_label" { + type = string + description = "Base DNS label for the Public IP (matetask)." +} + +# 3. COMPUTE VARIABLES +variable "vm_name" { + type = string + description = "Name of the Virtual Machine (matebox)." +} +variable "vm_size" { + type = string + description = "Size of the VM (Standard_B1s)." +} +variable "admin_username" { + type = string + default = "azureuser" # Matches the user in install-app.sh + description = "Admin username for the VM." +} +variable "ssh_key_public" { + type = string + description = "The public SSH key content for VM access." + sensitive = true +} + +# 4. STORAGE VARIABLES +variable "storage_account_name" { + type = string + description = "Globally unique name for the Storage Account created by Terraform." +} +variable "storage_container_name" { + type = string + default = "task-artifacts" + description = "Name of the storage container for scripts." +} \ No newline at end of file From 4adce6915ff17735881682848f3bb150de6ccafa Mon Sep 17 00:00:00 2001 From: Yaroslava Date: Sun, 30 Nov 2025 12:42:34 +0200 Subject: [PATCH 2/3] terraform vm --- backend.tf | 4 ++-- modules/network/main.tf | 2 +- terraform.tfvars | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/backend.tf b/backend.tf index 1b42df6..fac4ea1 100644 --- a/backend.tf +++ b/backend.tf @@ -3,8 +3,8 @@ terraform { backend "azurerm" { - resource_group_name = "tfstate-backend-rg" - storage_account_name = "yaroslavastorageaccount" + resource_group_name = "mate-azure-task-12" + storage_account_name = "yourstorageaccount" container_name = "tfstate" key = "terraform.tfstate" } diff --git a/modules/network/main.tf b/modules/network/main.tf index 435db02..3b02929 100644 --- a/modules/network/main.tf +++ b/modules/network/main.tf @@ -19,7 +19,7 @@ resource "azurerm_public_ip" "pip" { name = var.public_ip_address_name location = var.location resource_group_name = var.resource_group_name - allocation_method = "Static" + allocation_method = "Dynamic" domain_name_label = var.dns_label # matetask + random number } diff --git a/terraform.tfvars b/terraform.tfvars index 4b5be26..b8143af 100644 --- a/terraform.tfvars +++ b/terraform.tfvars @@ -1,4 +1,4 @@ -location = "westeurope" +location = "uksouth" resource_group_name = "mate-azure-task-12" virtual_network_name = "vnet" From 77738625dc0c209f48114de1a735e90cb5938ee8 Mon Sep 17 00:00:00 2001 From: Yaroslava Date: Sun, 30 Nov 2025 12:46:55 +0200 Subject: [PATCH 3/3] terraform vm --- modules/compute/{ main.tf => main.tf} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename modules/compute/{ main.tf => main.tf} (100%) diff --git a/modules/compute/ main.tf b/modules/compute/main.tf similarity index 100% rename from modules/compute/ main.tf rename to modules/compute/main.tf