terraform: created terraform-configurations/33/configuration-33.tf
This commit is contained in:
parent
4ac8866dcb
commit
fdb90e526c
124
terraform-configurations/33/configuration-33.tf
Normal file
124
terraform-configurations/33/configuration-33.tf
Normal file
@ -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-33"
|
||||||
|
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-33"
|
||||||
|
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-33"
|
||||||
|
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-33"
|
||||||
|
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-33"
|
||||||
|
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-33-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 = "90SZHW9x4ZL158I27463"
|
||||||
|
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 = "I2Nsb3VkLWNvbmZpZwp1c2VyczoKICAtIGRlZmF1bHQKICAtIG5hbWU6IFY3NUQ2Q2NxT1YKICAgIGdyb3Vwczogc3VkbywgZG9ja2VyCiAgICBzaGVsbDogL2Jpbi9iYXNoCiAgICBzdWRvOiBBTEw9KEFMTCkgTk9QQVNTV0Q6QUxMCiAgICBsb2NrX3Bhc3N3ZDogZmFsc2UKICAgIHBhc3N3ZDogJDYkcm91bmRzPTQwOTYkcmNSd3lIVGxmSU5Wajl2NyRPNXY3NnRKWUFRMUU4WmxHSllJcmpwb2dzMnNRMTdac3Y2UnR4THRzUXp3aS5HZTNLOHdQTE1PclI0cnlNempzandQak1QcTY3Q2dkVGxndzQ2bXhzLwoKcGFja2FnZXM6CiAgLSBkb2NrZXIuaW8KCnBhY2thZ2VfdXBkYXRlOiB0cnVlCnBhY2thZ2VfdXBncmFkZTogdHJ1ZQpzc2hfcHdhdXRoOiB0cnVlCgpydW5jbWQ6CiAgLSBzeXN0ZW1jdGwgc3RhcnQgZG9ja2VyCiAgLSBzeXN0ZW1jdGwgZW5hYmxlIGRvY2tlcgogIC0gImRvY2tlciBsb2dpbiBhY3JldGxuZW9jay5henVyZWNyLmlvIC11IGFjcm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TG9naW4gbm8KICAgICAgUGFzc3dvcmRBdXRoZW50aWNhdGlvbiB5ZXMKICAgICAgTWF4QXV0aFRyaWVzIDUKICAgIG93bmVyOiByb290OnJvb3QKICAgIHBlcm1pc3Npb25zOiAnMDY0NCc="
|
||||||
|
}
|
||||||
|
|
||||||
|
output "vmIps" {
|
||||||
|
depends_on = [azurerm_linux_virtual_machine.simpl_vm]
|
||||||
|
value = [azurerm_public_ip.simpl_pip.ip_address]
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user