Skip to content

Commit 481ed89

Browse files
authored
Merge pull request #6 from data-platform-hq/add-storage-mapping
feat: add BYOS support
2 parents d9b464c + 7234e6d commit 481ed89

File tree

3 files changed

+44
-3
lines changed

3 files changed

+44
-3
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ No modules.
3636
| <a name="input_app_settings"></a> [app\_settings](#input\_app\_settings) | Application setting | `map(string)` | `{}` | no |
3737
| <a name="input_application_stack"></a> [application\_stack](#input\_application\_stack) | Application stack configuration, run `az webapp list-runtimes --os-type linux` to get the list of supported stacks | `map(string)` | <pre>{<br> "java_server": "JAVA",<br> "java_server_version": 11,<br> "java_version": "java11"<br>}</pre> | no |
3838
| <a name="input_application_type"></a> [application\_type](#input\_application\_type) | Application type (java, python, etc) | `string` | `"java"` | no |
39+
| <a name="input_enable_appinsights"></a> [enable\_appinsights](#input\_enable\_appinsights) | Enable application insights | `bool` | `true` | no |
3940
| <a name="input_env"></a> [env](#input\_env) | Environment | `string` | n/a | yes |
4041
| <a name="input_identity_ids"></a> [identity\_ids](#input\_identity\_ids) | List of user assigned identity IDs | `list(string)` | `null` | no |
4142
| <a name="input_ip_restriction"></a> [ip\_restriction](#input\_ip\_restriction) | Firewall settings for the function app | <pre>list(object({<br> name = string<br> ip_address = string<br> service_tag = string<br> virtual_network_subnet_id = string<br> priority = string<br> action = string<br> headers = list(object({<br> x_azure_fdid = list(string)<br> x_fd_health_probe = list(string)<br> x_forwarded_for = list(string)<br> x_forwarded_host = list(string)<br> }))<br> }))</pre> | <pre>[<br> {<br> "action": "Allow",<br> "headers": null,<br> "ip_address": null,<br> "name": "allow_azure",<br> "priority": "100",<br> "service_tag": "AzureCloud",<br> "virtual_network_subnet_id": null<br> }<br>]</pre> | no |
@@ -45,9 +46,11 @@ No modules.
4546
| <a name="input_project"></a> [project](#input\_project) | Project name | `string` | n/a | yes |
4647
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | Resource group name | `string` | n/a | yes |
4748
| <a name="input_service_plan_id"></a> [service\_plan\_id](#input\_service\_plan\_id) | App Service plan ID | `string` | n/a | yes |
49+
| <a name="input_storage_account"></a> [storage\_account](#input\_storage\_account) | BYOS storage mount configuration | <pre>list(object({<br> access_key = string<br> account_name = string<br> name = string<br> share_name = string<br> type = string<br> mount_path = string<br> }))</pre> | `[]` | no |
4850
| <a name="input_subnet_id"></a> [subnet\_id](#input\_subnet\_id) | Subnet ID for the function app | `string` | `null` | no |
4951
| <a name="input_tags"></a> [tags](#input\_tags) | Tags | `map(string)` | n/a | yes |
5052
| <a name="input_use_private_net"></a> [use\_private\_net](#input\_use\_private\_net) | Use private network injection | `bool` | `false` | no |
53+
| <a name="input_websockets_enabled"></a> [websockets\_enabled](#input\_websockets\_enabled) | Enable websockets | `bool` | `false` | no |
5154

5255
## Outputs
5356

main.tf

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
resource "azurerm_application_insights" "this" {
2-
name = "fn-${var.project}-${var.env}-${var.location}-${var.name}"
2+
count = var.enable_appinsights ? 1 : 0
3+
name = "web-${var.project}-${var.env}-${var.location}-${var.name}"
34
location = var.location
45
resource_group_name = var.resource_group
56
application_type = var.application_type
@@ -14,7 +15,7 @@ locals {
1415
LOG4J_FORMAT_MSG_NO_LOOKUPS = "true"
1516
WEBSITE_USE_PLACEHOLDER = "0"
1617
AZURE_LOG_LEVEL = "info"
17-
APPINSIGHTS_INSTRUMENTATIONKEY = azurerm_application_insights.this.instrumentation_key
18+
APPINSIGHTS_INSTRUMENTATIONKEY = var.enable_appinsights ? azurerm_application_insights.this[0].instrumentation_key : ""
1819
}
1920
application_stack_struct = {
2021
docker_image = null
@@ -50,7 +51,7 @@ resource "azurerm_linux_web_app" "this" {
5051
always_on = true
5152
ftps_state = "Disabled"
5253
http2_enabled = true
53-
websockets_enabled = false
54+
websockets_enabled = var.websockets_enabled
5455
use_32_bit_worker = false
5556
ip_restriction = var.ip_restriction
5657
scm_ip_restriction = var.ip_restriction
@@ -77,6 +78,18 @@ resource "azurerm_linux_web_app" "this" {
7778
}
7879
}
7980
}
81+
dynamic "storage_account" {
82+
for_each = var.storage_account
83+
content {
84+
access_key = storage_account.value.access_key
85+
account_name = storage_account.value.account_name
86+
name = storage_account.value.name
87+
share_name = storage_account.value.share_name
88+
type = storage_account.value.type
89+
mount_path = storage_account.value.mount_path
90+
}
91+
}
92+
8093
lifecycle {
8194
ignore_changes = [
8295
tags["hidden-link: /app-insights-conn-string"],

variables.tf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,3 +126,28 @@ variable "logs" {
126126
}
127127
description = "Logs configuration"
128128
}
129+
130+
variable "storage_account" {
131+
type = list(object({
132+
access_key = string
133+
account_name = string
134+
name = string
135+
share_name = string
136+
type = string
137+
mount_path = string
138+
}))
139+
default = []
140+
description = "BYOS storage mount configuration"
141+
}
142+
143+
variable "websockets_enabled" {
144+
type = bool
145+
description = "Enable websockets"
146+
default = false
147+
}
148+
149+
variable "enable_appinsights" {
150+
type = bool
151+
description = "Enable application insights"
152+
default = true
153+
}

0 commit comments

Comments
 (0)