test: 🚦 Added some of my own tweaks to build knowledge

This commit is contained in:
2025-11-08 10:55:22 +00:00
parent 6c6eb8e161
commit 56ea4c6178
8 changed files with 36 additions and 32 deletions
+4 -1
View File
@@ -6,4 +6,7 @@
# Local configs
terraform.tfvars
*.override.tf
*.override.tf
.env
secrets.sh
-8
View File
@@ -1,8 +0,0 @@
terraform {
backend "azurerm" {
resource_group_name = "terraform"
storage_account_name = "tfstoracccom"
container_name = "tfstate"
key = "dev.terraform.tfstate"
}
}
+30 -21
View File
@@ -2,35 +2,32 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "4.46.0"
version = "4.52.0"
}
}
}
provider "azurerm" {
features{}
subscription_id = "4b2d6154-f4c5-4854-be82-12dfc82d4d23"
subscription_id = "0c8b6184-985d-4f31-b57e-c91f921241bd"
}
module "network" {
source = "../../modules/network"
vnet_name = "dev-vnet"
resource_group_name = "terraform"
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"
resource "azurerm_resource_group" "rg" {
name = "terraform_demo"
location = "uksouth"
}
data "azurerm_ssh_public_key" "kp" {
name = "terraform-kp"
resource_group_name = "terraform"
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"
}
data "azurerm_ssh_public_key" "sd" {
name = "sbcomsam-d-01"
resource_group_name = "terraform"
resource "azurerm_storage_container" "terraform_state" {
name = "terraform-state"
storage_account_id = azurerm_storage_account.storage.id
}
data "http" "my_ip" {
@@ -39,15 +36,27 @@ data "http" "my_ip" {
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"
resource_group_name = "terraform_demo"
location = "UK South"
subnet_id = module.network.subnet_ids["public"]
vm_size = "Standard_B1s"
admin_username = "azureuser"
ssh_public_key = data.azurerm_ssh_public_key.sd.public_key
admin_username = "demo"
ssh_public_key = local.ssh_public_key
ex_ip = local.my_ip
}
}
View File
View File
View File
View File
+2 -2
View File
@@ -59,9 +59,9 @@ resource "azurerm_linux_virtual_machine" "vm" {
storage_account_type = "Standard_LRS"
}
source_image_reference {
offer = "ubuntu-24_04-lts"
publisher = "Canonical"
offer = "0001-com-ubuntu-server-jammy"
sku = "22_04-lts-gen2"
sku = "server"
version = "latest"
}
}