50 lines
1.3 KiB
Terraform
50 lines
1.3 KiB
Terraform
terraform {
|
|
required_providers {
|
|
azurerm = {
|
|
source = "hashicorp/azurerm"
|
|
version = "4.52.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "azurerm" {
|
|
features{}
|
|
subscription_id = "0c8b6184-985d-4f31-b57e-c91f921241bd"
|
|
# JP Personal sub
|
|
}
|
|
|
|
# Remote state backend for prod environment
|
|
terraform {
|
|
backend "azurerm" {
|
|
resource_group_name = "the_data_sandbox"
|
|
storage_account_name = "datasandboxstore"
|
|
container_name = "terraform-state"
|
|
key = "prod.tfstate"
|
|
}
|
|
}
|
|
|
|
module "network" {
|
|
source = "../../modules/network"
|
|
vnet_name = "prod-vnet"
|
|
resource_group_name = "the_data_sandbox_prod"
|
|
location = "uksouth"
|
|
address_space = ["10.1.0.0/16"]
|
|
subnets = { public = "10.1.1.0/24", private = "10.1.2.0/24" }
|
|
environment = "prod"
|
|
project = "TheDataSandBox"
|
|
}
|
|
|
|
module "compute" {
|
|
source = "../../modules/compute"
|
|
resource_group_name = "the_data_sandbox_prod"
|
|
location = "uksouth"
|
|
subnet_id = module.network.subnet_ids["public"]
|
|
vm_size = "Standard_D2s_v3"
|
|
admin_username = "demo"
|
|
ssh_public_key = file("~/.ssh/id_rsa.pub")
|
|
ex_ip = chomp(data.http.my_ip.response_body)
|
|
}
|
|
|
|
data "http" "my_ip" {
|
|
url = "https://checkip.amazonaws.com/"
|
|
} |