This commit is contained in:
Sam
2025-09-26 12:38:12 +00:00
parent 49c0913f2b
commit b2b2ad94b7
2 changed files with 8 additions and 5 deletions
+6 -3
View File
@@ -23,7 +23,11 @@ module "network" {
project = "TerraformBootcamp" project = "TerraformBootcamp"
} }
/* data "azurerm_ssh_public_key" "kp" {
name = "terraform-kp"
resource_group_name = "terraform"
}
module "compute" { module "compute" {
source = "../../modules/compute" source = "../../modules/compute"
resource_group_name = "terraform" resource_group_name = "terraform"
@@ -31,6 +35,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 = "<your-ssh-public-key>" ssh_public_key = data.azurerm_ssh_public_key.kp.public_key
} }
*/
+2 -2
View File
@@ -15,7 +15,7 @@ resource "azurerm_public_ip" "vm_public" {
name = "example-pip" name = "example-pip"
location = var.location location = var.location
resource_group_name = var.resource_group_name resource_group_name = var.resource_group_name
allocation_method = "Dynamic" allocation_method = "Static"
} }
resource "azurerm_linux_virtual_machine" "vm" { resource "azurerm_linux_virtual_machine" "vm" {
@@ -35,7 +35,7 @@ resource "azurerm_linux_virtual_machine" "vm" {
} }
source_image_reference { source_image_reference {
publisher = "Canonical" publisher = "Canonical"
offer = "UbuntuServer" offer = "0001-com-ubuntu-server-jammy"
sku = "22_04-lts-gen2" sku = "22_04-lts-gen2"
version = "latest" version = "latest"
} }