updating terraform
This commit is contained in:
@@ -28,6 +28,12 @@ data "azurerm_ssh_public_key" "kp" {
|
||||
resource_group_name = "terraform"
|
||||
}
|
||||
|
||||
data "azurerm_ssh_public_key" "sd" {
|
||||
name = "sbcomsam-d-01"
|
||||
resource_group_name = "terraform"
|
||||
}
|
||||
|
||||
|
||||
module "compute" {
|
||||
source = "../../modules/compute"
|
||||
resource_group_name = "terraform"
|
||||
@@ -35,5 +41,5 @@ module "compute" {
|
||||
subnet_id = module.network.subnet_ids["public"]
|
||||
vm_size = "Standard_B1s"
|
||||
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
|
||||
}
|
||||
|
||||
@@ -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" {
|
||||
name = "example-pip"
|
||||
location = var.location
|
||||
@@ -18,6 +23,24 @@ resource "azurerm_public_ip" "vm_public" {
|
||||
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" {
|
||||
name = "example-vm"
|
||||
resource_group_name = var.resource_group_name
|
||||
|
||||
Reference in New Issue
Block a user