updating terraform

This commit is contained in:
comerford0
2025-10-02 09:17:15 +00:00
parent dfcbe54ebe
commit c12311ab9f
2 changed files with 30 additions and 1 deletions
+7 -1
View File
@@ -28,6 +28,12 @@ data "azurerm_ssh_public_key" "kp" {
resource_group_name = "terraform" resource_group_name = "terraform"
} }
data "azurerm_ssh_public_key" "sd" {
name = "sbcomsam-d-01"
resource_group_name = "terraform"
}
module "compute" { module "compute" {
source = "../../modules/compute" source = "../../modules/compute"
resource_group_name = "terraform" resource_group_name = "terraform"
@@ -35,5 +41,5 @@ module "compute" {
subnet_id = module.network.subnet_ids["public"] subnet_id = module.network.subnet_ids["public"]
vm_size = "Standard_B1s" vm_size = "Standard_B1s"
admin_username = "azureuser" admin_username = "azureuser"
ssh_public_key = data.azurerm_ssh_public_key.kp.public_key ssh_public_key = data.azurerm_ssh_public_key.sd.public_key
} }
+23
View File
@@ -11,6 +11,11 @@ resource "azurerm_network_interface" "nic" {
} }
} }
resource "azurerm_network_interface_security_group_association" "example" {
network_interface_id = azurerm_network_interface.nic.id
network_security_group_id = azurerm_network_security_group.vm_nsg.id
}
resource "azurerm_public_ip" "vm_public" { resource "azurerm_public_ip" "vm_public" {
name = "example-pip" name = "example-pip"
location = var.location location = var.location
@@ -18,6 +23,24 @@ resource "azurerm_public_ip" "vm_public" {
allocation_method = "Static" allocation_method = "Static"
} }
resource "azurerm_network_security_group" "vm_nsg" {
name = "vm-nsg"
resource_group_name = var.resource_group_name
location = var.location
security_rule {
name = "SSH"
priority = 1001
direction = "Inbound"
access = "Allow"
protocol = "Tcp"
source_port_range = "*"
destination_port_range = "22"
source_address_prefix = "81.78.69.107"
destination_address_prefix = "*"
}
}
resource "azurerm_linux_virtual_machine" "vm" { resource "azurerm_linux_virtual_machine" "vm" {
name = "example-vm" name = "example-vm"
resource_group_name = var.resource_group_name resource_group_name = var.resource_group_name