test: 🚦 Added some of my own tweaks to build knowledge
This commit is contained in:
@@ -1,8 +0,0 @@
|
||||
terraform {
|
||||
backend "azurerm" {
|
||||
resource_group_name = "terraform"
|
||||
storage_account_name = "tfstoracccom"
|
||||
container_name = "tfstate"
|
||||
key = "dev.terraform.tfstate"
|
||||
}
|
||||
}
|
||||
|
||||
+30
-21
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user