First commit
This commit is contained in:
21
infrastructure/.terraform.lock.hcl
generated
Normal file
21
infrastructure/.terraform.lock.hcl
generated
Normal 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.0"
|
||||
hashes = [
|
||||
"h1:SSBkZNrevDxOI6j9tVel7/BKX/5xaMYUqx4qhLvrjS4=",
|
||||
"zh:01aa74b1e13c797b20407c37c683b945ffb24462bb39cdaddcf5b3297272c85a",
|
||||
"zh:42c3a69ece44ed6dbd5145dadbdbde9a2e99c3dc0b5a0b28544fd68e796a755d",
|
||||
"zh:48102182e71a10f8337828239d770953fb54e95c4f617a5a327316ba7d9c9aa5",
|
||||
"zh:4c086420f1acc033b5901dc266721a38f43cbab43dedae149df3ccd8d1a3615d",
|
||||
"zh:634e3d701798d699f502c86d1ee591778fa0a46be81a220bd849c0389cd742f1",
|
||||
"zh:6aa0c6cb606dcd8efe90fb9fb872aa5406119264ce2819d8daf35c813e6ba2f7",
|
||||
"zh:8604d0a159b1905d7a92448d5e2e1ec0b3275b9b2d8f7986f4a566f570a6f90c",
|
||||
"zh:912ddd9a43cbb168a58f1af625a8fe111e505c059442ad6126905449e5013877",
|
||||
"zh:9ed54f1e7ae7881611ae659bfbd11db878adc77aa848b920cc0d76a1ab41a2ac",
|
||||
"zh:b507020a566bdbc0dfe868103664361e8ee5549de6edceb7f5d6837dcd8af5a3",
|
||||
"zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c",
|
||||
"zh:f7fc6699a0359183911448bf9736777cd6d8ce91fd20d682cf635fa58e2905dd",
|
||||
]
|
||||
}
|
||||
5
infrastructure/dns.tf
Normal file
5
infrastructure/dns.tf
Normal file
@@ -0,0 +1,5 @@
|
||||
resource "azurerm_static_web_app_custom_domain" "static_web_app_custom_domain_txt" {
|
||||
static_web_app_id = module.static_web_app.id
|
||||
domain_name = var.DOMAIN_NAME
|
||||
validation_type = "dns-txt-token"
|
||||
}
|
||||
9
infrastructure/main.tf
Normal file
9
infrastructure/main.tf
Normal file
@@ -0,0 +1,9 @@
|
||||
module "static_web_app" {
|
||||
source = "./modules/static_web_app"
|
||||
region = var.REGION
|
||||
resource_group_name = 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
|
||||
}
|
||||
12
infrastructure/modules/static_web_app/main.tf
Normal file
12
infrastructure/modules/static_web_app/main.tf
Normal file
@@ -0,0 +1,12 @@
|
||||
resource "azurerm_static_web_app" "static_web_app" {
|
||||
name = var.static_web_app_name
|
||||
resource_group_name = var.resource_group_name
|
||||
location = var.region
|
||||
}
|
||||
|
||||
resource "azurerm_static_web_app_custom_domain" "static_web_app_custom_domain" {
|
||||
count = var.custom_domain_name_count
|
||||
static_web_app_id = azurerm_static_web_app.static_web_app.id
|
||||
domain_name = "${var.subdomain_name}.${var.domain_name}"
|
||||
validation_type = "cname-delegation"
|
||||
}
|
||||
11
infrastructure/modules/static_web_app/outputs.tf
Normal file
11
infrastructure/modules/static_web_app/outputs.tf
Normal file
@@ -0,0 +1,11 @@
|
||||
output "id" {
|
||||
value = azurerm_static_web_app.static_web_app.id
|
||||
}
|
||||
|
||||
output "api_key" {
|
||||
value = azurerm_static_web_app.static_web_app.api_key
|
||||
}
|
||||
|
||||
output "default_host_name" {
|
||||
value = azurerm_static_web_app.static_web_app.default_host_name
|
||||
}
|
||||
24
infrastructure/modules/static_web_app/variables.tf
Normal file
24
infrastructure/modules/static_web_app/variables.tf
Normal file
@@ -0,0 +1,24 @@
|
||||
variable "region" {
|
||||
|
||||
}
|
||||
|
||||
variable "resource_group_name" {
|
||||
|
||||
}
|
||||
|
||||
variable "static_web_app_name" {
|
||||
|
||||
}
|
||||
|
||||
variable "custom_domain_name_count" {
|
||||
|
||||
}
|
||||
|
||||
variable "domain_name" {
|
||||
|
||||
}
|
||||
|
||||
variable "subdomain_name" {
|
||||
|
||||
}
|
||||
|
||||
13
infrastructure/outputs.tf
Normal file
13
infrastructure/outputs.tf
Normal file
@@ -0,0 +1,13 @@
|
||||
output "api_key" {
|
||||
value = module.static_web_app.api_key
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
output "default_host_name" {
|
||||
value = module.static_web_app.default_host_name
|
||||
}
|
||||
|
||||
output "validation_token" {
|
||||
value = azurerm_static_web_app_custom_domain.static_web_app_custom_domain_txt.validation_token
|
||||
sensitive = true
|
||||
}
|
||||
3
infrastructure/providers.tf
Normal file
3
infrastructure/providers.tf
Normal file
@@ -0,0 +1,3 @@
|
||||
provider "azurerm" {
|
||||
features {}
|
||||
}
|
||||
4
infrastructure/resource_group.tf
Normal file
4
infrastructure/resource_group.tf
Normal file
@@ -0,0 +1,4 @@
|
||||
resource "azurerm_resource_group" "resource_group" {
|
||||
name = var.RESOURCE_GROUP_NAME
|
||||
location = var.REGION
|
||||
}
|
||||
18
infrastructure/terraform.tf
Normal file
18
infrastructure/terraform.tf
Normal 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-"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
infrastructure/variables.tf
Normal file
23
infrastructure/variables.tf
Normal file
@@ -0,0 +1,23 @@
|
||||
variable "REGION" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "RESOURCE_GROUP_NAME" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "STATIC_WEB_APP_NAME" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "CUSTOM_DOMAIN_NAME_COUNT" {
|
||||
type = number
|
||||
}
|
||||
|
||||
variable "DOMAIN_NAME" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "SUBDOMAIN_NAME" {
|
||||
type = string
|
||||
}
|
||||
Reference in New Issue
Block a user