Skip to content

Commit 7f0f0df

Browse files
Merge pull request #8 from Indu-Sah-Foundation/test
fixed circular dependency
2 parents ec20b64 + b765425 commit 7f0f0df

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

main.tf

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,7 @@ resource "azurerm_linux_web_app" "backend" {
3535
go_version = "1.21"
3636
}
3737
cors {
38-
allowed_origins = [
39-
"https://${azurerm_static_site.frontend.default_host_name}"
40-
]
41-
support_credentials = true
38+
allowed_origins = ["*"]
4239
}
4340
}
4441

@@ -54,8 +51,10 @@ resource "azurerm_static_site" "frontend" {
5451
location = var.location
5552
sku_tier = "Free"
5653
sku_size = "Free"
54+
}
5755

58-
app_settings = {
59-
"REACT_APP_API_URL" = "https://${azurerm_linux_web_app.backend.default_hostname}"
60-
}
56+
resource "azurerm_static_site_custom_domain" "frontend_env" {
57+
static_site_id = azurerm_static_site.frontend.id
58+
domain_name = azurerm_static_site.frontend.default_host_name
59+
validation_type = "cname-delegation"
6160
}

outputs.tf

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@ output "backend_url" {
88
description = "Go API URL"
99
}
1010

11+
output "backend_api_url_for_react" {
12+
value = "https://${azurerm_linux_web_app.backend.default_hostname}"
13+
description = "Use this URL in your React app as REACT_APP_API_URL"
14+
}
15+
1116
output "static_web_app_name" {
1217
value = azurerm_static_site.frontend.name
1318
description = "For deployment token"
@@ -16,4 +21,4 @@ output "static_web_app_name" {
1621
output "app_service_name" {
1722
value = azurerm_linux_web_app.backend.name
1823
description = "For publish profile"
19-
}
24+
}

0 commit comments

Comments
 (0)