Commit a4120679 authored by Abhishek Chowdhry's avatar Abhishek Chowdhry
Browse files

Adding new ZoneRedundant Redis Instance

parent 3580ef4b
Pipeline #47237 passed with stages
in 1 minute and 4 seconds
......@@ -26,6 +26,7 @@ resource "azurerm_redis_cache" "arc" {
shard_count = var.premium_tier_config.cache_shard_count
minimum_tls_version = var.minimum_tls_version
tags = var.resource_tags
zones = var.zones
redis_configuration {
maxmemory_reserved = var.memory_features.maxmemory_reserved
......
......@@ -79,6 +79,13 @@ variable "premium_tier_config" {
}
}
variable "zones" {
description = "A list of a one or more Availability Zones, where the Redis Cache should be allocated."
type = list(number)
default = [1]
}
variable "resource_tags" {
description = "Map of tags to apply to taggable resources in this module. By default the taggable resources are tagged with the name defined above and this map is merged in"
type = map(string)
......
......@@ -36,7 +36,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.41.0"
version = "=2.64.0"
}
azuread = {
source = "hashicorp/azuread"
......
......@@ -42,7 +42,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.41.0"
version = "=2.64.0"
}
azuread = {
source = "hashicorp/azuread"
......
......@@ -22,7 +22,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.41.0"
version = "=2.64.0"
}
random = {
source = "hashicorp/random"
......
......@@ -30,7 +30,7 @@ terraform {
required_providers {
azurerm = {
source = "hashicorp/azurerm"
version = "=2.41.0"
version = "=2.64.0"
}
azuread = {
source = "hashicorp/azuread"
......@@ -112,6 +112,7 @@ locals {
storage_name = "${replace(local.base_name_21, "-", "")}config"
redis_cache_name = "${local.base_name}-cache"
redis_queue_name = "${local.base_name}-queue"
postgresql_name = "${local.base_name}-pg"
vnet_name = "${local.base_name_60}-vnet"
......@@ -467,6 +468,30 @@ resource "azurerm_role_assignment" "redis_cache" {
scope = module.redis_cache.id
}
module "redis_queue" {
source = "../../../modules/providers/azure/redis-cache"
name = local.redis_queue_name
resource_group_name = azurerm_resource_group.main.name
capacity = var.redis_capacity
sku_name = var.redis_queue_sku_name
zones = var.redis_queue_zones
memory_features = var.redis_config_memory
premium_tier_config = var.redis_config_schedule
resource_tags = var.resource_tags
}
// Add Contributor Role Access
resource "azurerm_role_assignment" "redis_queue" {
count = length(local.rbac_principals)
role_definition_name = local.role
principal_id = local.rbac_principals[count.index]
scope = module.redis_queue.id
}
#-------------------------------
# CosmosDB
......
......@@ -153,8 +153,11 @@ resource "azurerm_key_vault_secret" "postgres_password" {
# Azure Redis Cache
#-------------------------------
locals {
redis_hostname = "redis-hostname"
redis_password_name = "redis-password"
redis_hostname = "redis-hostname"
redis_password_name = "redis-password"
redis_queue_hostname = "redis-queue-hostname"
redis_queue_password_name = "redis-queue-password"
}
resource "azurerm_key_vault_secret" "redis_host" {
......@@ -169,6 +172,18 @@ resource "azurerm_key_vault_secret" "redis_password" {
key_vault_id = data.terraform_remote_state.central_resources.outputs.keyvault_id
}
resource "azurerm_key_vault_secret" "redis_queue_host" {
name = local.redis_queue_hostname
value = module.redis_queue.hostname
key_vault_id = data.terraform_remote_state.central_resources.outputs.keyvault_id
}
resource "azurerm_key_vault_secret" "redis_queue_password" {
name = local.redis_queue_password_name
value = module.redis_queue.primary_access_key
key_vault_id = data.terraform_remote_state.central_resources.outputs.keyvault_id
}
#-------------------------------
# CosmosDB
#-------------------------------
......
......@@ -49,7 +49,7 @@ func TestTemplate(t *testing.T) {
TfOptions: tfOptions,
Workspace: workspace,
PlanAssertions: nil,
ExpectedResourceCount: 107,
ExpectedResourceCount: 113,
ExpectedResourceAttributeValues: resourceDescription,
}
......
......@@ -137,6 +137,18 @@ variable "redis_capacity" {
default = 1
}
variable "redis_queue_sku_name" {
description = "The Azure Cache for Redis pricing tier. Possible values are Basic, Standard and Premium. Azure currently charges by the minute for all pricing tiers."
type = string
default = "Premium"
}
variable "redis_queue_zones" {
description = "A list of a one or more Availability Zones, where the Redis Cache should be allocated."
type = list(number)
default = [1, 2]
}
variable "postgres_databases" {
description = "The list of names of the PostgreSQL Database, which needs to be a valid PostgreSQL identifier. Changing this forces a new resource to be created."
default = [
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment