-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathc2-azfunction.tf
More file actions
60 lines (50 loc) · 1.75 KB
/
c2-azfunction.tf
File metadata and controls
60 lines (50 loc) · 1.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
resource "azurerm_storage_account" "sa" {
name = var.storage_name
resource_group_name = azurerm_resource_group.ingesoft5-rg.name
location = azurerm_resource_group.ingesoft5-rg.location
account_tier = "Standard"
account_replication_type = "LRS"
}
resource "azurerm_service_plan" "sp" {
name = var.plan_name
resource_group_name = azurerm_resource_group.ingesoft5-rg.name
location = azurerm_resource_group.ingesoft5-rg.location
os_type = "Windows"
sku_name = "Y1"
}
resource "azurerm_windows_function_app" "wfa" {
name = var.wfa_name
resource_group_name = azurerm_resource_group.ingesoft5-rg.name
location = azurerm_resource_group.ingesoft5-rg.location
storage_account_name = azurerm_storage_account.sa.name
storage_account_access_key = azurerm_storage_account.sa.primary_access_key
service_plan_id = azurerm_service_plan.sp.id
app_settings = {
"AzureWebJobsServiceBus" = azurerm_servicebus_namespace.ingesoft5-servicebus.default_primary_connection_string
}
site_config {
application_stack {
node_version = "~18"
}
}
}
resource "azurerm_function_app_function" "servicebus_trigger" {
name = var.name_function
function_app_id = azurerm_windows_function_app.wfa.id
language = "Javascript"
file {
name = "index.js"
content = file("code/index.js")
}
config_json = jsonencode({
"bindings" : [
{
"type" : "serviceBusTrigger",
"direction" : "in",
"name" : "queueItem",
"queueName" : azurerm_servicebus_queue.ingesoft5-servicebus-queue.name,
"connection" : "AzureWebJobsServiceBus"
}
]
})
}