From cdb4fd70b4857d29e2b2c4c88b8881ba47dbfad3 Mon Sep 17 00:00:00 2001 From: gitops_test Date: Tue, 19 May 2026 00:52:58 +0000 Subject: [PATCH] Add Azureprueba8_20260519_005258.TF --- Azureprueba8_20260519_005258.TF | 124 ++++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 Azureprueba8_20260519_005258.TF diff --git a/Azureprueba8_20260519_005258.TF b/Azureprueba8_20260519_005258.TF new file mode 100644 index 0000000..c6edbfb --- /dev/null +++ b/Azureprueba8_20260519_005258.TF @@ -0,0 +1,124 @@ +terraform { + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~> 4.0" + } + } +} + +provider "azurerm" { + features {} + skip_provider_registration = true +} + +locals { + image_parts = split(":", "Canonical:0001-com-ubuntu-server-jammy:22_04-lts-gen2:latest") +} + +data "azurerm_resource_group" "simpl_rg" { + name = "espacios-de-datos-infraestructura" +} + +resource "azurerm_virtual_network" "simpl_vnet" { + name = "simpl-vnet-{UUID}" + address_space = ["10.0.0.0/16"] + location = data.azurerm_resource_group.simpl_rg.location + resource_group_name = data.azurerm_resource_group.simpl_rg.name +} + +resource "azurerm_subnet" "simpl_subnet" { + name = "simpl-subnet-{UUID}" + resource_group_name = data.azurerm_resource_group.simpl_rg.name + virtual_network_name = azurerm_virtual_network.simpl_vnet.name + address_prefixes = ["10.0.1.0/24"] +} + +resource "azurerm_public_ip" "simpl_pip" { + name = "simpl-pip-{UUID}" + location = data.azurerm_resource_group.simpl_rg.location + resource_group_name = data.azurerm_resource_group.simpl_rg.name + allocation_method = "Static" + sku = "Standard" +} + +resource "azurerm_network_interface" "simpl_nic" { + name = "simpl-nic-{UUID}" + location = data.azurerm_resource_group.simpl_rg.location + resource_group_name = data.azurerm_resource_group.simpl_rg.name + + ip_configuration { + name = "internal" + subnet_id = azurerm_subnet.simpl_subnet.id + private_ip_address_allocation = "Dynamic" + public_ip_address_id = azurerm_public_ip.simpl_pip.id + } +} + +resource "azurerm_network_security_group" "simpl_nsg" { + count = 1 + name = "simpl-nsg-{UUID}" + location = data.azurerm_resource_group.simpl_rg.location + resource_group_name = data.azurerm_resource_group.simpl_rg.name + + security_rule { + name = "allow-ssh" + priority = 100 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_range = "22" + source_address_prefix = "*" + destination_address_prefix = "*" + } + + security_rule { + name = "allow-app" + priority = 110 + direction = "Inbound" + access = "Allow" + protocol = "Tcp" + source_port_range = "*" + destination_port_ranges = ["8088"] + source_address_prefix = "*" + destination_address_prefix = "*" + } +} + +resource "azurerm_network_interface_security_group_association" "simpl_nic_nsg" { + count = 1 + network_interface_id = azurerm_network_interface.simpl_nic.id + network_security_group_id = azurerm_network_security_group.simpl_nsg[0].id +} + +resource "azurerm_linux_virtual_machine" "simpl_vm" { + name = "offering-enterprise-server-{UUID}-terraform" + resource_group_name = data.azurerm_resource_group.simpl_rg.name + location = data.azurerm_resource_group.simpl_rg.location + size = "Standard_D2s_v3" + admin_username = "simpluser" + admin_password = "var.simpl_admin_password" + disable_password_authentication = false + + network_interface_ids = [azurerm_network_interface.simpl_nic.id] + + os_disk { + caching = "ReadWrite" + storage_account_type = "Standard_LRS" + } + + source_image_reference { + publisher = local.image_parts[0] + offer = local.image_parts[1] + sku = local.image_parts[2] + version = local.image_parts[3] + } + + custom_data = "var.simpl_cloud_init" +} + +output "vmIps" { + depends_on = [azurerm_linux_virtual_machine.simpl_vm] + value = [azurerm_public_ip.simpl_pip.ip_address] +}