1+ # Resource Group
2+ resource "azurerm_resource_group" "rg" {
3+ name = var. resource_group_name
4+ location = var. location
5+
6+ # Output the resource group name
7+ provisioner "local-exec" {
8+ command = " echo Resource Group: ${ self . name } "
9+ }
10+ }
11+
12+ # Storage Account
13+ resource "azurerm_storage_account" "storage" {
14+ name = var. storage_account_name
15+ resource_group_name = azurerm_resource_group. rg . name
16+ location = azurerm_resource_group. rg . location
17+ account_tier = " Standard"
18+ account_replication_type = " LRS"
19+
20+ depends_on = [azurerm_resource_group . rg ]
21+
22+ # Output the storage account name
23+ provisioner "local-exec" {
24+ command = " echo Storage Account: ${ self . name } "
25+ }
26+ }
27+
28+ # Blob Container for Input Files
29+ resource "azurerm_storage_container" "input_container" {
30+ name = " input"
31+ storage_account_name = azurerm_storage_account. storage . name
32+ container_access_type = " private"
33+
34+ depends_on = [azurerm_storage_account . storage ]
35+
36+ # Output the container name
37+ provisioner "local-exec" {
38+ command = " echo Input Container: ${ self . name } "
39+ }
40+ }
41+
42+ # Blob Container for Output Files
43+ resource "azurerm_storage_container" "output_container" {
44+ name = " output"
45+ storage_account_name = azurerm_storage_account. storage . name
46+ container_access_type = " private"
47+
48+ depends_on = [azurerm_storage_account . storage ]
49+
50+ # Output the container name
51+ provisioner "local-exec" {
52+ command = " echo Output Container: ${ self . name } "
53+ }
54+ }
55+
56+ # Azure Function App
57+ resource "azurerm_function_app" "function_app" {
58+ name = var. function_app_name
59+ location = azurerm_resource_group. rg . location
60+ resource_group_name = azurerm_resource_group. rg . name
61+ storage_account_name = azurerm_storage_account. storage . name
62+ storage_account_access_key = azurerm_storage_account. storage . primary_access_key
63+ app_service_plan_id = azurerm_service_plan. asp . id
64+ os_type = " linux"
65+ runtime_stack = " python"
66+
67+ depends_on = [azurerm_service_plan . asp ]
68+
69+ # Output the function app name
70+ provisioner "local-exec" {
71+ command = " echo Function App: ${ self . name } "
72+ }
73+ }
74+
75+ # Service Plan
76+ resource "azurerm_service_plan" "asp" {
77+ name = var. app_service_plan_name
78+ location = azurerm_resource_group. rg . location
79+ resource_group_name = azurerm_resource_group. rg . name
80+ os_type = " Linux"
81+ sku_name = " Y1" # Consumption plan
82+
83+ depends_on = [azurerm_resource_group . rg ]
84+
85+ # Output the service plan name
86+ provisioner "local-exec" {
87+ command = " echo Service Plan: ${ self . name } "
88+ }
89+ }
90+
91+ # Application Insights
92+ resource "azurerm_application_insights" "appinsights" {
93+ name = var. app_insights_name
94+ location = azurerm_resource_group. rg . location
95+ resource_group_name = azurerm_resource_group. rg . name
96+ application_type = " web"
97+
98+ depends_on = [azurerm_resource_group . rg ]
99+
100+ # Output the application insights name
101+ provisioner "local-exec" {
102+ command = " echo Application Insights: ${ self . name } "
103+ }
104+ }
105+
106+ # Log Analytics Workspace
107+ resource "azurerm_log_analytics_workspace" "loganalytics" {
108+ name = var. log_analytics_workspace_name
109+ location = azurerm_resource_group. rg . location
110+ resource_group_name = azurerm_resource_group. rg . name
111+ sku = " PerGB2018"
112+
113+ depends_on = [azurerm_resource_group . rg ]
114+
115+ # Output the log analytics workspace name
116+ provisioner "local-exec" {
117+ command = " echo Log Analytics Workspace: ${ self . name } "
118+ }
119+ }
120+
121+ # Key Vault
122+ resource "azurerm_key_vault" "keyvault" {
123+ name = var. key_vault_name
124+ location = azurerm_resource_group. rg . location
125+ resource_group_name = azurerm_resource_group. rg . name
126+ tenant_id = var. tenant_id
127+ sku_name = " standard"
128+
129+ depends_on = [azurerm_resource_group . rg ]
130+
131+ # Output the key vault name
132+ provisioner "local-exec" {
133+ command = " echo Key Vault: ${ self . name } "
134+ }
135+ }
0 commit comments