Skip to content

Commit b5fa9e1

Browse files
authored
Merge pull request #5 from data-platform-hq/add-user-assigned-identity
feat: add UserAssigned identity
2 parents 30292c0 + bb8db81 commit b5fa9e1

File tree

4 files changed

+45
-3
lines changed

4 files changed

+45
-3
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,10 @@ No modules.
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 |
3939
| <a name="input_env"></a> [env](#input\_env) | Environment | `string` | n/a | yes |
40+
| <a name="input_identity_ids"></a> [identity\_ids](#input\_identity\_ids) | List of user assigned identity IDs | `list(string)` | `null` | no |
4041
| <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 |
41-
| <a name="input_java_version"></a> [java\_version](#input\_java\_version) | Java version | `string` | `"8"` | no |
4242
| <a name="input_location"></a> [location](#input\_location) | Location | `string` | n/a | yes |
43+
| <a name="input_logs"></a> [logs](#input\_logs) | Logs configuration | <pre>object({<br> detailed_error_messages = bool<br> failed_request_tracing = bool<br> http_logs = object({<br> file_system = object({<br> retention_in_days = number<br> retention_in_mb = number<br> })<br> })<br> })</pre> | <pre>{<br> "detailed_error_messages": false,<br> "failed_request_tracing": false,<br> "http_logs": {<br> "file_system": {<br> "retention_in_days": 7,<br> "retention_in_mb": 35<br> }<br> }<br>}</pre> | no |
4344
| <a name="input_name"></a> [name](#input\_name) | Function index/name (like 007) | `string` | n/a | yes |
4445
| <a name="input_project"></a> [project](#input\_project) | Project name | `string` | n/a | yes |
4546
| <a name="input_resource_group"></a> [resource\_group](#input\_resource\_group) | Resource group name | `string` | n/a | yes |

main.tf

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ resource "azurerm_linux_web_app" "this" {
4343
app_settings = merge(local.app_settings, var.app_settings)
4444

4545
identity {
46-
type = "SystemAssigned"
46+
type = var.identity_ids == null ? "SystemAssigned" : "SystemAssigned, UserAssigned"
47+
identity_ids = var.identity_ids
4748
}
4849
site_config {
4950
always_on = true
@@ -66,6 +67,16 @@ resource "azurerm_linux_web_app" "this" {
6667
ruby_version = local.application_stack["ruby_version"]
6768
}
6869
}
70+
logs {
71+
detailed_error_messages = var.logs.detailed_error_messages
72+
failed_request_tracing = var.logs.failed_request_tracing
73+
http_logs {
74+
file_system {
75+
retention_in_days = var.logs.http_logs.file_system.retention_in_days
76+
retention_in_mb = var.logs.http_logs.file_system.retention_in_mb
77+
}
78+
}
79+
}
6980
lifecycle {
7081
ignore_changes = [
7182
tags["hidden-link: /app-insights-conn-string"],

outputs.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ output "id" {
44
}
55

66
output "identity" {
7-
value = azurerm_linux_web_app.this.identity.*
7+
value = azurerm_linux_web_app.this.identity[*]
88
description = "Function app Managed Identity"
99
}

variables.tf

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,33 @@ variable "application_stack" {
9696
}
9797
description = "Application stack configuration, run `az webapp list-runtimes --os-type linux` to get the list of supported stacks"
9898
}
99+
100+
variable "identity_ids" {
101+
type = list(string)
102+
description = "List of user assigned identity IDs"
103+
default = null
104+
}
105+
106+
variable "logs" {
107+
type = object({
108+
detailed_error_messages = bool
109+
failed_request_tracing = bool
110+
http_logs = object({
111+
file_system = object({
112+
retention_in_days = number
113+
retention_in_mb = number
114+
})
115+
})
116+
})
117+
default = {
118+
detailed_error_messages = false
119+
failed_request_tracing = false
120+
http_logs = {
121+
file_system = {
122+
retention_in_days = 7
123+
retention_in_mb = 35
124+
}
125+
}
126+
}
127+
description = "Logs configuration"
128+
}

0 commit comments

Comments
 (0)