From df7a8439f5e51da0fbc6e786b859df073a1151b1 Mon Sep 17 00:00:00 2001 From: Ash Davies <3853061+DrizzlyOwl@users.noreply.github.com> Date: Thu, 16 Jan 2025 12:08:04 +0000 Subject: [PATCH] Deploy Redis Cache --- terraform/README.md | 2 ++ terraform/container-apps-hosting.tf | 3 +++ terraform/locals.tf | 2 ++ terraform/variables.tf | 11 +++++++++++ 4 files changed, 18 insertions(+) diff --git a/terraform/README.md b/terraform/README.md index 90f8fde70..e28bc8a8f 100644 --- a/terraform/README.md +++ b/terraform/README.md @@ -190,6 +190,7 @@ No resources. | [enable\_health\_insights\_api](#input\_enable\_health\_insights\_api) | Deploys a Function App that exposes the last 3 HTTP Web Tests via an API endpoint. 'enable\_app\_insights\_integration' and 'enable\_monitoring' must be set to 'true'. | `bool` | `false` | no | | [enable\_logstash\_consumer](#input\_enable\_logstash\_consumer) | Create an Event Hub consumer group for Logstash | `bool` | `false` | no | | [enable\_monitoring](#input\_enable\_monitoring) | Create an App Insights instance and notification group for the Container App | `bool` | n/a | yes | +| [enable\_redis\_cache](#input\_enable\_redis\_cache) | Set to true to create an Azure Redis Cache, with a private endpoint within the virtual network | `bool` | n/a | yes | | [environment](#input\_environment) | Environment name. Will be used along with `project_name` as a prefix for all resources. | `string` | n/a | yes | | [eventhub\_export\_log\_analytics\_table\_names](#input\_eventhub\_export\_log\_analytics\_table\_names) | List of Log Analytics table names that you want to export to Event Hub. See https://learn.microsoft.com/en-gb/azure/azure-monitor/logs/logs-data-export?tabs=portal#supported-tables for a list of supported tables | `list(string)` | `[]` | no | | [existing\_logic\_app\_workflow](#input\_existing\_logic\_app\_workflow) | Name, and Resource Group of an existing Logic App Workflow. Leave empty to create a new Resource |
object({
name : string
resource_group_name : string
})
|
{
"name": "",
"resource_group_name": ""
}
| no | @@ -202,6 +203,7 @@ No resources. | [monitor\_email\_receivers](#input\_monitor\_email\_receivers) | A list of email addresses that should be notified by monitoring alerts | `list(string)` | n/a | yes | | [monitor\_endpoint\_healthcheck](#input\_monitor\_endpoint\_healthcheck) | Specify a route that should be monitored for a 200 OK status | `string` | n/a | yes | | [project\_name](#input\_project\_name) | Project name. Will be used along with `environment` as a prefix for all resources. | `string` | n/a | yes | +| [redis\_cache\_sku](#input\_redis\_cache\_sku) | Redis Cache SKU | `string` | `"Basic"` | no | | [registry\_admin\_enabled](#input\_registry\_admin\_enabled) | Do you want to enable access key based authentication for your Container Registry? | `bool` | `true` | no | | [registry\_managed\_identity\_assign\_role](#input\_registry\_managed\_identity\_assign\_role) | Assign the 'AcrPull' Role to the Container App User-Assigned Managed Identity. Note: If you do not have 'Microsoft.Authorization/roleAssignments/write' permission, you will need to manually assign the 'AcrPull' Role to the identity | `bool` | `false` | no | | [registry\_server](#input\_registry\_server) | Container registry server | `string` | `""` | no | diff --git a/terraform/container-apps-hosting.tf b/terraform/container-apps-hosting.tf index 99ad9906f..596eccdf0 100644 --- a/terraform/container-apps-hosting.tf +++ b/terraform/container-apps-hosting.tf @@ -36,6 +36,9 @@ module "azure_container_apps_hosting" { health_insights_api_ipv4_allow_list = local.health_insights_api_ipv4_allow_list enable_container_app_file_share = local.enable_container_app_file_share + enable_redis_cache = local.enable_redis_cache + redis_cache_sku = local.redis_cache_sku + enable_cdn_frontdoor = local.enable_cdn_frontdoor cdn_frontdoor_forwarding_protocol = local.cdn_frontdoor_forwarding_protocol cdn_frontdoor_origin_host_header_override = local.cdn_frontdoor_origin_host_header_override diff --git a/terraform/locals.tf b/terraform/locals.tf index b06200fc0..48297ddc4 100644 --- a/terraform/locals.tf +++ b/terraform/locals.tf @@ -16,6 +16,8 @@ locals { container_max_replicas = var.container_max_replicas container_scale_http_concurrency = var.container_scale_http_concurrency container_port = var.container_port + enable_redis_cache = var.enable_redis_cache + redis_cache_sku = var.redis_cache_sku enable_event_hub = var.enable_event_hub enable_logstash_consumer = var.enable_logstash_consumer eventhub_export_log_analytics_table_names = var.eventhub_export_log_analytics_table_names diff --git a/terraform/variables.tf b/terraform/variables.tf index d9c0beffa..d129e29b5 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -389,3 +389,14 @@ variable "container_port" { type = number default = 8080 } + +variable "enable_redis_cache" { + description = "Set to true to create an Azure Redis Cache, with a private endpoint within the virtual network" + type = bool +} + +variable "redis_cache_sku" { + description = "Redis Cache SKU" + type = string + default = "Basic" +}