Skip to content

Commit 45d4b47

Browse files
committed
2 storage accounts - 1 for runtime + 1 for storage pds
1 parent dbeafc9 commit 45d4b47

File tree

3 files changed

+37
-14
lines changed

3 files changed

+37
-14
lines changed

terraform-infrastructure/main.tf

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ resource "azurerm_resource_group" "rg" {
88
command = "echo Resource Group: ${self.name}"
99
}
1010
}
11+
1112
# Storage Account
1213
resource "azurerm_storage_account" "storage" {
1314
name = var.storage_account_name
@@ -52,14 +53,30 @@ resource "azurerm_storage_container" "output_container" {
5253
}
5354
}
5455

56+
# Storage Account
57+
resource "azurerm_storage_account" "runtime" {
58+
name = var.storage_account_name_runtime
59+
resource_group_name = azurerm_resource_group.rg.name
60+
location = azurerm_resource_group.rg.location
61+
account_tier = "Standard"
62+
account_replication_type = "LRS"
63+
64+
depends_on = [azurerm_resource_group.rg]
65+
66+
# Output the storage account name
67+
provisioner "local-exec" {
68+
command = "echo Storage Account: ${self.name}"
69+
}
70+
}
71+
5572
# Linux Function App
5673
resource "azurerm_linux_function_app" "function_app" {
5774
name = var.function_app_name
5875
location = azurerm_resource_group.rg.location
5976
resource_group_name = azurerm_resource_group.rg.name
6077
service_plan_id = azurerm_service_plan.asp.id
61-
storage_account_name = azurerm_storage_account.storage.name
62-
storage_account_access_key = azurerm_storage_account.storage.primary_access_key
78+
storage_account_name = azurerm_storage_account.runtime.name
79+
storage_account_access_key = azurerm_storage_account.runtime.primary_access_key
6380

6481
identity {
6582
type = "SystemAssigned"
@@ -78,27 +95,27 @@ resource "azurerm_linux_function_app" "function_app" {
7895

7996
# Assign Storage Blob Data Contributor role
8097
resource "azurerm_role_assignment" "blob_data_contributor" {
81-
scope = azurerm_storage_account.storage.id
98+
scope = azurerm_storage_account.runtime.id
8299
role_definition_name = "Storage Blob Data Contributor"
83100
principal_id = azurerm_linux_function_app.function_app.identity[0].principal_id
84101

85102

86103
depends_on = [
87104
azurerm_linux_function_app.function_app,
88-
azurerm_storage_account.storage
105+
azurerm_storage_account.runtime
89106
]
90107

91108
}
92109

93110
# Assign Storage File Data SMB Share Contributor role
94111
resource "azurerm_role_assignment" "file_data_smb_share_contributor" {
95-
scope = azurerm_storage_account.storage.id
112+
scope = azurerm_storage_account.runtime.id
96113
role_definition_name = "Storage File Data SMB Share Contributor"
97114
principal_id = azurerm_linux_function_app.function_app.identity[0].principal_id
98115

99116
depends_on = [
100117
azurerm_linux_function_app.function_app,
101-
azurerm_storage_account.storage
118+
azurerm_storage_account.runtime
102119
]
103120
}
104121

terraform-infrastructure/terraform.tfvars

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,19 @@ subscription_id = "" # "your-subscription_id"
33
resource_group_name = "RG-PDFs-Processing-DocIntelligence" # "your-resource-group-name"
44
location = "West US" # "your-location"
55
# Storage Account
6-
storage_account_name = "storageaccountbrownpdf" # "your-storage-account-name"
6+
storage_account_name = "storageaccountbrownpdfx3" # "your-storage-account-name"
7+
storage_account_name_runtime = "runtimestoragebrownx3" # "your-runtime-storage-account-name"
78
# Function App
8-
function_app_name = "fapdfbrown" # "your-function-app-name"
9+
function_app_name = "fapdfbrownx3" # "your-function-app-name"
910
# App Service Plan
10-
app_service_plan_name = "asppdfbrown" # "your-app-service-plan-name"
11+
app_service_plan_name = "asppdfbrownx3" # "your-app-service-plan-name"
1112
# Application Insights
12-
app_insights_name = "apppdfbrown" # "your-app-insights-name"
13+
app_insights_name = "apppdfbrownx3" # "your-app-insights-name"
1314
# Log Analytics Workspace
14-
log_analytics_workspace_name = "logwspdfbrown" # "your-log-analytics-workspace-name"
15+
log_analytics_workspace_name = "logwspdfbrownx3" # "your-log-analytics-workspace-name"
1516
# Key Vault
16-
key_vault_name = "kvpdfrbrown" # "your-key-vault-name"
17+
key_vault_name = "kvpdfrbrownx3" # "your-key-vault-name"
1718
# CosmosDB
18-
cosmosdb_account_name = "cosmospdfbrown" # "your-cosmosdb-account-name"
19+
cosmosdb_account_name = "cosmospdfbrownx3" # "your-cosmosdb-account-name"
1920
# Form Recognizer -> Document Intelligence
20-
form_recognizer_name = "docintelligenceacct01" # "your-document-intelligence-name"
21+
form_recognizer_name = "docintelligenceacct01x3" # "your-document-intelligence-name"

terraform-infrastructure/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ variable "storage_account_name" {
1919
type = string
2020
}
2121

22+
variable "storage_account_name_runtime" {
23+
description = "The name of the storage account runtime (Function App Storage)"
24+
type = string
25+
}
26+
2227
variable "function_app_name" {
2328
description = "The name of the Linux Function App."
2429
type = string

0 commit comments

Comments
 (0)