Updating
This commit is contained in:
47
infrastructure/app_config.tf
Normal file
47
infrastructure/app_config.tf
Normal file
@@ -0,0 +1,47 @@
|
||||
data "azurerm_client_config" "current" {}
|
||||
|
||||
data "azurerm_user_assigned_identity" "user_assigned_identity" {
|
||||
name = "noahspanflyingdevuser"
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
}
|
||||
|
||||
resource "azurerm_app_configuration" "app_configuration" {
|
||||
name = "noahspan-appconfig"
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
location = azurerm_resource_group.resource_group.location
|
||||
|
||||
identity {
|
||||
type = "UserAssigned"
|
||||
identity_ids = [
|
||||
data.azurerm_user_assigned_identity.user_assigned_identity.id
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
resource "azurerm_role_assignment" "role_assignment" {
|
||||
scope = azurerm_app_configuration.app_configuration.id
|
||||
role_definition_name = "App Configuration Data Owner"
|
||||
principal_id = data.azurerm_client_config.current.object_id
|
||||
}
|
||||
|
||||
# resource "azurerm_app_configuration_feature" "flying-pilots" {
|
||||
# configuration_store_id = azurerm_app_configuration.app_configuration.id
|
||||
# description = "Feature flag for pilots page in flying app"
|
||||
# name = "flying-pilots"
|
||||
# label = "flying-pilots-label"
|
||||
# enabled = false
|
||||
|
||||
# depends_on = [ azurerm_role_assignment.role_assignment ]
|
||||
# }
|
||||
|
||||
# resource "azurerm_app_configuration_feature" "flying-logbook" {
|
||||
# configuration_store_id = azurerm_app_configuration.app_configuration.id
|
||||
# description = "Feature flag for logbook page in flying app"
|
||||
# name = "flying-logbook"
|
||||
# label = "flying-logbook-label"
|
||||
# enabled = false
|
||||
|
||||
# depends_on = [ azurerm_role_assignment.role_assignment ]
|
||||
# }
|
||||
0
infrastructure/container_apps.tf
Normal file
0
infrastructure/container_apps.tf
Normal file
@@ -1,5 +1,49 @@
|
||||
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"
|
||||
}
|
||||
# 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"
|
||||
# }
|
||||
|
||||
resource "azurerm_dns_zone" "dns_zone" {
|
||||
name = var.DOMAIN_NAME
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
}
|
||||
|
||||
resource "azurerm_dns_txt_record" "dns_txt_record" {
|
||||
name = var.WEBSITE_NAME == var.DOMAIN_NAME ? "@" : split(".", var.WEBSITE_NAME)[0]
|
||||
zone_name = azurerm_dns_zone.dns_zone.name
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
ttl = 14400
|
||||
record {
|
||||
value = azurerm_static_web_app_custom_domain.static_web_app_custom_domain.validation_token == "" ? "validated" : azurerm_static_web_app_custom_domain.static_web_app_custom_domain.validation_token
|
||||
}
|
||||
|
||||
# email
|
||||
record {
|
||||
value = var.EMAIL_TXT_VALUE == "" ? "validated" : var.EMAIL_TXT_VALUE
|
||||
}
|
||||
|
||||
record {
|
||||
value = var.EMAIL_SPF_VALUE == "" ? "validated" : var.EMAIL_SPF_VALUE
|
||||
}
|
||||
}
|
||||
|
||||
# email
|
||||
|
||||
resource "azurerm_dns_mx_record" "dns_mx_record" {
|
||||
name = "@"
|
||||
zone_name = azurerm_dns_zone.dns_zone.name
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
ttl = 14400
|
||||
|
||||
record {
|
||||
preference = 10
|
||||
exchange = "mx01.mail.icloud.com."
|
||||
}
|
||||
|
||||
record {
|
||||
preference = 10
|
||||
exchange = "mx02.mail.icloud.com."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,45 @@
|
||||
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
|
||||
# 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
|
||||
# }
|
||||
|
||||
resource "azurerm_static_web_app" "static_web_app" {
|
||||
name = var.STATIC_WEB_APP_NAME
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
location = var.REGION
|
||||
}
|
||||
|
||||
resource "azurerm_static_web_app_custom_domain" "static_web_app_custom_domain" {
|
||||
static_web_app_id = azurerm_static_web_app.static_web_app.id
|
||||
domain_name = var.WEBSITE_NAME
|
||||
validation_type = "dns-txt-token"
|
||||
}
|
||||
|
||||
resource "azurerm_dns_a_record" "dns_a_record" {
|
||||
name = var.WEBSITE_NAME == var.DOMAIN_NAME ? "@" : split(".", var.WEBSITE_NAME)[0]
|
||||
zone_name = azurerm_dns_zone.dns_zone.name
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
ttl = 14400
|
||||
target_resource_id = azurerm_static_web_app.static_web_app.id
|
||||
}
|
||||
|
||||
resource "azurerm_dns_cname_record" "dns_cname_record" {
|
||||
name = "www"
|
||||
zone_name = azurerm_dns_zone.dns_zone.name
|
||||
resource_group_name = azurerm_resource_group.resource_group.name
|
||||
ttl = 14400
|
||||
record = azurerm_static_web_app.static_web_app.default_host_name
|
||||
}
|
||||
|
||||
resource "azurerm_static_web_app_custom_domain" "static_web_app_custom_domain_www" {
|
||||
static_web_app_id = azurerm_static_web_app.static_web_app.id
|
||||
domain_name = "www.${var.DOMAIN_NAME}"
|
||||
validation_type = "cname-delegation"
|
||||
|
||||
depends_on = [ azurerm_dns_cname_record.dns_cname_record ]
|
||||
}
|
||||
@@ -1,12 +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" "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"
|
||||
}
|
||||
# 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"
|
||||
# }
|
||||
@@ -1,13 +1,17 @@
|
||||
output "api_key" {
|
||||
value = module.static_web_app.api_key
|
||||
value = azurerm_static_web_app.static_web_app.api_key
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
output "default_host_name" {
|
||||
value = module.static_web_app.default_host_name
|
||||
}
|
||||
# output "default_host_name" {
|
||||
# value = azurerm_static_web_app.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
|
||||
# output "validation_token" {
|
||||
# value = azurerm_static_web_app_custom_domain.static_web_app_custom_domain_txt.validation_token
|
||||
# sensitive = false
|
||||
# }
|
||||
|
||||
output "name_servers" {
|
||||
value = azurerm_dns_zone.dns_zone.name_servers
|
||||
}
|
||||
@@ -1,3 +1,11 @@
|
||||
variable "EMAIL_TXT_VALUE" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "EMAIL_SPF_VALUE" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "REGION" {
|
||||
type = string
|
||||
}
|
||||
@@ -18,6 +26,6 @@ variable "DOMAIN_NAME" {
|
||||
type = string
|
||||
}
|
||||
|
||||
variable "SUBDOMAIN_NAME" {
|
||||
variable "WEBSITE_NAME" {
|
||||
type = string
|
||||
}
|
||||
Reference in New Issue
Block a user