Skip to content

Commit d74d180

Browse files
authored
Merge pull request #16 from data-platform-hq/kv-permissions
feat: add kv access configuration
2 parents bf56440 + b2c1d7a commit d74d180

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ No modules.
2727
|------|------|
2828
| [azurerm_app_service_virtual_network_swift_connection.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/app_service_virtual_network_swift_connection) | resource |
2929
| [azurerm_application_insights.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/application_insights) | resource |
30+
| [azurerm_key_vault_access_policy.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/key_vault_access_policy) | resource |
3031
| [azurerm_linux_web_app.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/linux_web_app) | resource |
3132
| [azurerm_monitor_diagnostic_setting.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_diagnostic_setting) | resource |
3233
| [azurerm_monitor_diagnostic_categories.this](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/data-sources/monitor_diagnostic_categories) | data source |
@@ -46,6 +47,7 @@ No modules.
4647
| <a name="input_env"></a> [env](#input\_env) | Environment | `string` | n/a | yes |
4748
| <a name="input_identity_ids"></a> [identity\_ids](#input\_identity\_ids) | List of user assigned identity IDs | `list(string)` | `null` | no |
4849
| <a name="input_ip_restriction"></a> [ip\_restriction](#input\_ip\_restriction) | Firewall settings for the web 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 |
50+
| <a name="input_key_vault"></a> [key\_vault](#input\_key\_vault) | Configure Linux Function App to Key Vault | <pre>object({<br> id = optional(string, null)<br> key_permissions = optional(list(string), null)<br> secret_permissions = optional(list(string), ["Get", "List"])<br> storage_permissions = optional(list(string), null)<br> })</pre> | `{}` | no |
4951
| <a name="input_location"></a> [location](#input\_location) | Location | `string` | n/a | yes |
5052
| <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 |
5153
| <a name="input_name"></a> [name](#input\_name) | Web index/name (like 007) | `string` | n/a | yes |

main.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ resource "azurerm_linux_web_app" "this" {
133133
}
134134
}
135135

136+
resource "azurerm_key_vault_access_policy" "this" {
137+
count = var.key_vault.id == null ? 0 : 1
138+
key_vault_id = var.key_vault.id
139+
tenant_id = azurerm_linux_web_app.this.identity[0].tenant_id
140+
object_id = azurerm_linux_web_app.this.identity[0].principal_id
141+
key_permissions = var.key_vault.key_permissions
142+
secret_permissions = var.key_vault.secret_permissions
143+
storage_permissions = var.key_vault.storage_permissions
144+
}
145+
136146
resource "azurerm_app_service_virtual_network_swift_connection" "this" {
137147
count = var.use_private_net ? 1 : 0
138148
app_service_id = azurerm_linux_web_app.this.id

variables.tf

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,3 +204,14 @@ variable "worker_count" {
204204
description = "Number of workers"
205205
default = null
206206
}
207+
208+
variable "key_vault" {
209+
description = "Configure Linux Function App to Key Vault"
210+
type = object({
211+
id = optional(string, null)
212+
key_permissions = optional(list(string), null)
213+
secret_permissions = optional(list(string), ["Get", "List"])
214+
storage_permissions = optional(list(string), null)
215+
})
216+
default = {}
217+
}

0 commit comments

Comments
 (0)