terraform { required_providers { azurerm = { source = "hashicorp/azurerm" version = "4.52.0" } } } provider "azurerm" { features{} subscription_id = "0c8b6184-985d-4f31-b57e-c91f921241bd" } resource "azurerm_resource_group" "rg" { name = "terraform_demo" location = "uksouth" } resource "azurerm_storage_account" "storage" { name = "demoterraformbuildjp" resource_group_name = azurerm_resource_group.rg.name location = azurerm_resource_group.rg.location account_tier = "Standard" account_replication_type = "LRS" } resource "azurerm_storage_container" "terraform_state" { name = "terraform-state" storage_account_id = azurerm_storage_account.storage.id } data "http" "my_ip" { url = "https://checkip.amazonaws.com/" } locals { my_ip = chomp(data.http.my_ip.response_body) ssh_public_key = file("~/.ssh/id_rsa.pub") } module "network" { source = "../../modules/network" vnet_name = "dev-vnet" resource_group_name = "terraform_demo" location = "UK South" address_space = ["10.0.0.0/16"] subnets = { public = "10.0.1.0/24", private = "10.0.2.0/24" } environment = "dev" project = "TerraformBootcamp" } module "compute" { source = "../../modules/compute" resource_group_name = "terraform_demo" location = "UK South" subnet_id = module.network.subnet_ids["public"] vm_size = "Standard_B1s" admin_username = "demo" ssh_public_key = local.ssh_public_key ex_ip = local.my_ip }