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" }