7-flying-infrastructure - adding terraform #8

Merged
noahspannbauer merged 1 commits from feature/7-flying-infrastructure into main 2024-05-21 17:05:36 -04:00
9 changed files with 101 additions and 0 deletions

4
infrastructure/.gitignore vendored Normal file
View File

@@ -0,0 +1,4 @@
# Terraform
.terraform/*
*.tfstate
*.tfstate.*

21
infrastructure/.terraform.lock.hcl generated Normal file
View File

@@ -0,0 +1,21 @@
# This file is maintained automatically by "terraform init".
# Manual edits may be lost in future updates.
provider "registry.terraform.io/hashicorp/azurerm" {
version = "3.104.2"
hashes = [
"h1:1J+ajk1s1qfjViKYSOYDb8HLOh2RIn/TAK/2s3orPuE=",
"zh:05b4a3572ce2b881fef5ec64756b060e8ce6c24c260182acf4adec38a6b29204",
"zh:0d5118f6ad64278a52b720cdbf1a6b7ab7ea1ad5bd3d9607cb558d8d25280906",
"zh:2196f49d73bf862a046b24e143f5d658bbb01bfb4e8582a88eb3907ff4f69730",
"zh:285c1a65bf3b70859110c2bbafefa4483d450840282a57f349b81b17367bbb26",
"zh:2efbd00970952761d60043c41e983dc6930678ef179de2b27ed00437fa711703",
"zh:6b7e26e6ba3a639e2a26b2e64f4629e28a44a9572f4203c30cb1c611f37ddb21",
"zh:8149b7aada49cac3ef49d7595d2fc2e3a573f4c01d272a6a4111efa089f2e44f",
"zh:9674f741d7be268778a0f0a59174130800f8977747ef16a1dd6446031c7ae8d4",
"zh:aed0e78df3c5de8eaa8c8cacb4e3c48ec26683f2e35dd42eabc1242592fad247",
"zh:c0c97188d9a5a26c5ce2dbcc1c6b31fb73469bb2e422e64a1dda25c9355c341c",
"zh:e883eca472593e34f2f93282973c148114eab19fceb8348fc82e91293b247118",
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
]
}

9
infrastructure/main.tf Normal file
View File

@@ -0,0 +1,9 @@
module "static_web_app" {
source = "github.com/noahspannbauer/noahspan-root/infrastructure/modules/static_web_app"
region = var.REGION
resource_group_name = data.azurerm_resource_group.resource_group.name
static_web_app_name = var.STATIC_WEB_APP_NAME
custom_domain_name_count = var.CUSTOM_DOMAIN_NAME_COUNT
domain_name = var.DOMAIN_NAME
subdomain_name = var.SUBDOMAIN_NAME
}

View File

@@ -0,0 +1,8 @@
output "api_key" {
value = module.static_web_app.api_key
sensitive = true
}
output "default_host_name" {
value = module.static_web_app.default_host_name
}

View File

@@ -0,0 +1,3 @@
provider "azurerm" {
features {}
}

View File

@@ -0,0 +1,3 @@
data "azurerm_resource_group" "resource_group" {
name = var.RESOURCE_GROUP_NAME
}

View File

@@ -0,0 +1,7 @@
resource "azurerm_storage_account" "storage_account" {
name = var.STORAGE_ACCOUNT_NAME
resource_group_name = data.azurerm_resource_group.resource_group.name
location = data.azurerm_resource_group.resource_group.location
account_tier = "Standard"
account_replication_type = "GRS"
}

View File

@@ -0,0 +1,18 @@
terraform {
required_version = ">= 1.1.0"
required_providers {
azurerm = {
source = "hashicorp/azurerm"
}
}
backend "remote" {
hostname = "app.terraform.io"
organization = "noahspan"
workspaces {
prefix = "noahspan-"
}
}
}

View File

@@ -0,0 +1,28 @@
variable "REGION" {
type = string
}
variable "RESOURCE_GROUP_NAME" {
type = string
}
variable "STATIC_WEB_APP_NAME" {
type = string
}
variable "DOMAIN_NAME" {
type = string
}
variable "SUBDOMAIN_NAME" {
type = string
}
variable "CUSTOM_DOMAIN_NAME_COUNT" {
type = number
}
variable "STORAGE_ACCOUNT_NAME" {
type = string
}