From bd16d8c6a3d60bb4eff59007166b5f5d3655ed90 Mon Sep 17 00:00:00 2001 From: John Knutson Date: Fri, 23 Jun 2023 21:45:25 +0000 Subject: [PATCH] add basic tf --- .gitignore | 2 ++ terraform/.terraform.lock.hcl | 41 +++++++++++++++++++++++++++++++++++ terraform/main.tf | 13 +++++++++++ terraform/providers.tf | 28 ++++++++++++++++++++++++ terraform/variables.tf | 12 ++++++++++ 5 files changed, 96 insertions(+) create mode 100644 terraform/.terraform.lock.hcl create mode 100644 terraform/main.tf create mode 100644 terraform/providers.tf create mode 100644 terraform/variables.tf diff --git a/.gitignore b/.gitignore index f0d935e4..239d8f4c 100644 --- a/.gitignore +++ b/.gitignore @@ -271,3 +271,5 @@ src/adminTools/adminBlazorWebsite/src/appsettings.Development.json #Igniore VSCode User Setting **/.vscode/settings.json + +terraform/.terraform diff --git a/terraform/.terraform.lock.hcl b/terraform/.terraform.lock.hcl new file mode 100644 index 00000000..c1648203 --- /dev/null +++ b/terraform/.terraform.lock.hcl @@ -0,0 +1,41 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/hashicorp/azurerm" { + version = "2.99.0" + constraints = "~> 2.0" + hashes = [ + "h1:FXBB5TkvZpZA+ZRtofPvp5IHZpz4Atw7w9J8GDgMhvk=", + "zh:08d81e72e97351538ab4d15548942217bf0c4d3b79ad3f4c95d8f07f902d2fa6", + "zh:11fdfa4f42d6b6f01371f336fea56f28a1db9e7b490c5ca0b352f6bbca5a27f1", + "zh:12376e2c4b56b76098d5d713d1a4e07e748a926c4d165f0bd6f52157b1f7a7e9", + "zh:31f1cb5b88ed1307625050e3ee7dd9948773f522a3f3bf179195d607de843ea3", + "zh:767971161405d38412662a73ea40a422125cdc214c72fbc569bcfbea6e66c366", + "zh:973c402c3728b68c980ea537319b703c009b902a981b0067fbc64e04a90e434c", + "zh:9ec62a4f82ec1e92bceeff80dd8783f61de0a94665c133f7c7a7a68bda9cdbd6", + "zh:bbb3b7e1229c531c4634338e4fc81b28bce58312eb843a931a4420abe42d5b7e", + "zh:cbbe02cd410d21476b3a081b5fa74b4f1b3d9d79b00214009028d60e859c19a3", + "zh:cc00ecc7617a55543b60a0da1196ea92df48c399bcadbedf04c783e3d47c6e08", + "zh:eecb9fd0e7509c7fd4763e546ef0933f125770cbab2b46152416e23d5ec9dd53", + ] +} + +provider "registry.terraform.io/hashicorp/random" { + version = "3.5.1" + constraints = ">= 3.4.0" + hashes = [ + "h1:VSnd9ZIPyfKHOObuQCaKfnjIHRtR7qTw19Rz8tJxm+k=", + "zh:04e3fbd610cb52c1017d282531364b9c53ef72b6bc533acb2a90671957324a64", + "zh:119197103301ebaf7efb91df8f0b6e0dd31e6ff943d231af35ee1831c599188d", + "zh:4d2b219d09abf3b1bb4df93d399ed156cadd61f44ad3baf5cf2954df2fba0831", + "zh:6130bdde527587bbe2dcaa7150363e96dbc5250ea20154176d82bc69df5d4ce3", + "zh:6cc326cd4000f724d3086ee05587e7710f032f94fc9af35e96a386a1c6f2214f", + "zh:78d5eefdd9e494defcb3c68d282b8f96630502cac21d1ea161f53cfe9bb483b3", + "zh:b6d88e1d28cf2dfa24e9fdcc3efc77adcdc1c3c3b5c7ce503a423efbdd6de57b", + "zh:ba74c592622ecbcef9dc2a4d81ed321c4e44cddf7da799faa324da9bf52a22b2", + "zh:c7c5cde98fe4ef1143bd1b3ec5dc04baf0d4cc3ca2c5c7d40d17c0e9b2076865", + "zh:dac4bad52c940cd0dfc27893507c1e92393846b024c5a9db159a93c534a3da03", + "zh:de8febe2a2acd9ac454b844a4106ed295ae9520ef54dc8ed2faf29f12716b602", + "zh:eab0d0495e7e711cca367f7d4df6e322e6c562fc52151ec931176115b83ed014", + ] +} diff --git a/terraform/main.tf b/terraform/main.tf new file mode 100644 index 00000000..afb1720a --- /dev/null +++ b/terraform/main.tf @@ -0,0 +1,13 @@ +resource "azurerm_resource_group" "az_url_shortener" { + location = var.location + name = var.app_name +} + +resource "azurerm_static_site" "tiny_blazor_admin" { + name = var.app_name + resource_group_name = azurerm_resource_group.az_url_shortener.name + location = azurerm_resource_group.az_url_shortener.location + sku_tier = "Standard" + sku_size = "Standard" +} + diff --git a/terraform/providers.tf b/terraform/providers.tf new file mode 100644 index 00000000..d6ac502c --- /dev/null +++ b/terraform/providers.tf @@ -0,0 +1,28 @@ +terraform { + required_version = ">=0.12" + + required_providers { + azurerm = { + source = "hashicorp/azurerm" + version = "~>2.0" + } + random = { + source = "hashicorp/random" + version = ">= 3.4.0" + } + # tls = { + # source = "hashicorp/tls" + # version = "~>4.0" + # } + } + backend "azurerm" { + resource_group_name = "tfstate" + storage_account_name = "tfstate28423" + container_name = "tfstate" + key = "AzUrlShortener.tfstate" + } +} + +provider "azurerm" { + features {} +} diff --git a/terraform/variables.tf b/terraform/variables.tf new file mode 100644 index 00000000..6871bd68 --- /dev/null +++ b/terraform/variables.tf @@ -0,0 +1,12 @@ +variable "location" { + default = "centralus" + description = "Azure Region (eastus, centralus, etc.)" + type = string +} + +variable "app_name" { + default = "AzUrlShortener" + description = "Application Name" + type = string +} +