From b2b2ad94b73099dfb5a3f043d1f00445cc45b008 Mon Sep 17 00:00:00 2001 From: Sam Date: Fri, 26 Sep 2025 12:38:12 +0000 Subject: [PATCH] Phase1-2 --- environments/dev/main.tf | 9 ++++++--- modules/compute/main.tf | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/environments/dev/main.tf b/environments/dev/main.tf index 976d180..b5721fd 100644 --- a/environments/dev/main.tf +++ b/environments/dev/main.tf @@ -23,7 +23,11 @@ module "network" { project = "TerraformBootcamp" } -/* +data "azurerm_ssh_public_key" "kp" { + name = "terraform-kp" + resource_group_name = "terraform" +} + module "compute" { source = "../../modules/compute" resource_group_name = "terraform" @@ -31,6 +35,5 @@ module "compute" { subnet_id = module.network.subnet_ids["public"] vm_size = "Standard_B1s" admin_username = "azureuser" - ssh_public_key = "" + ssh_public_key = data.azurerm_ssh_public_key.kp.public_key } - */ \ No newline at end of file diff --git a/modules/compute/main.tf b/modules/compute/main.tf index f75d4c3..28dd35f 100644 --- a/modules/compute/main.tf +++ b/modules/compute/main.tf @@ -15,7 +15,7 @@ resource "azurerm_public_ip" "vm_public" { name = "example-pip" location = var.location resource_group_name = var.resource_group_name - allocation_method = "Dynamic" + allocation_method = "Static" } resource "azurerm_linux_virtual_machine" "vm" { @@ -35,7 +35,7 @@ resource "azurerm_linux_virtual_machine" "vm" { } source_image_reference { publisher = "Canonical" - offer = "UbuntuServer" + offer = "0001-com-ubuntu-server-jammy" sku = "22_04-lts-gen2" version = "latest" }