Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RDP Backup on Redis Cache is enable by default in Standard SKU #21967

Closed
1 task done
fredsonlm opened this issue May 30, 2023 · 5 comments · Fixed by #22309
Closed
1 task done

RDP Backup on Redis Cache is enable by default in Standard SKU #21967

fredsonlm opened this issue May 30, 2023 · 5 comments · Fixed by #22309

Comments

@fredsonlm
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Community Note

Every changes on redis_cache using Terraform is forcing enable "rdp backup" on redis cache in everyone sku. This change to enable rdp backup is set like false as to force the solve issues, but this error still persistining.

Terraform Version

1.0.0

AzureRM Provider Version

3.58.0

Affected Resource(s)/Data Source(s)

azurerm_redis_cache

Terraform Configuration Files

resource "azurerm_redis_cache" "redisCachePrimary" {
  name                = join("-", [ var.redis_cache_name_primary, var.environment ] )
  location            = var.location_primary
  resource_group_name = var.redis_resource_group_name
  capacity            = var.redis_capacity
  family              = var.redis_family
  sku_name            = var.redis_sku_name
  enable_non_ssl_port = var.redis_enable_non_ssl_port

  redis_configuration{
    maxmemory_policy = var.redis_cfg_maxmemory_policy
    maxmemory_reserved = var.redis_cfg_maxmemory_reserved
    maxmemory_delta = var.redis_cfg_maxmemory_delta
  }
}


resource "azurerm_redis_cache" "redisCacheSecondary" {
  count               = var.environment == ["prod","prd"] ? 1 : 0
  name                = var.redis_cache_name_secondary 
  location            = var.location_secondary
  resource_group_name = var.redis_resource_group_name
  capacity            = var.redis_capacity 
  family              = var.redis_family 
  sku_name            = var.redis_sku_name
  enable_non_ssl_port =  var.redis_enable_non_ssl_port
  

  redis_configuration {
    maxmemory_policy   = var.redis_cfg_maxmemory_policy
    maxmemory_reserved = var.redis_cfg_maxmemory_reserved
    maxmemory_delta    = var.redis_cfg_maxmemory_delta
    rdb_backup_enabled = var.environment == "prod" && var.redis_sku_name == "Premium" ? true : false
    rdb_storage_connection_string = []
  }

#  lifecycle {
    ignore_changes = [
      redis_configuration.0.rdb_storage_connection_string,
      redis_configuration.0.aof_storage_connection_string_0,
    ]
  }

}

resource "azurerm_redis_linked_server" "replication-link" {
  count                       = var.environment == "prod" && var.redis_sku_name== "Premium" ? 1 : 0
  target_redis_cache_name     = azurerm_redis_cache.redisCachePrimary.name
  resource_group_name         = azurerm_redis_cache.redisCachePrimary.resource_group_name
  linked_redis_cache_id       = azurerm_redis_cache.redisCacheSecondary[0].id
  linked_redis_cache_location = azurerm_redis_cache.redisCacheSecondary[0].location
  #linked_redis_cache_id       = azurerm_redis_cache.redisCacheSecondary.id
  #linked_redis_cache_location = azurerm_redis_cache.redisCacheSecondary.location
  server_role                 = "Secondary"
  depends_on                  = [ azurerm_redis_cache.redisCacheSecondary ]
}

Debug Output/Panic Output

module.redis.azurerm_redis_cache.redisCachePrimary: Modifying... [id=/subscriptions/xxxxxxxxxxxxxxxxxxx/resourceGroups/XXXXXXXXXX/providers/Microsoft.Cache/redis/redis-instance-primary-stg]
╷
│ Error: updating Redi (Subscription: "xxxxxxxxxxxxxxxxxxx"
│ Resource Group Name: "XXXXXXXXXX"
│ Redis Name: "redis-instance-primary-stg"): unexpected status 400 with error: BadRequest: Feature properties.redisConfiguration.rdb-backup-enabled requires a Premium sku to be set.
│ RequestID=80e25fdd-5b3c-40df-84b4-8af698fde869
│ 
│   with module.redis.azurerm_redis_cache.redisCachePrimary,
│   on .terraform/modules/redis/modules/azure-redis-cache/main.tf line 1, in resource "azurerm_redis_cache" "redisCachePrimary":
│    1: resource "azurerm_redis_cache" "redisCachePrimary" {
│

Expected Behaviour

Terraform will perform the following actions:

module.redis.azurerm_redis_cache.redisCachePrimary will be updated in-place

~ resource "azurerm_redis_cache" "redisCachePrimary" {
id = "/subscriptions/xxxxxxxxxxxxxxxxxxx/resourceGroups/XXXXXXXXXX/providers/Microsoft.Cache/redis/redis-instance-primary-stg"
name = "redis-instance-primary-stg"
tags = {}
# (21 unchanged attributes hidden)

  ~ redis_configuration {
      ~ maxmemory_delta                 = 125 -> 247
      ~ maxmemory_reserved              = 125 -> 247
        # (8 unchanged attributes hidden)
    }
}

Plan: 0 to add, 1 to change, 0 to destroy.

Actual Behaviour

module.redis.azurerm_redis_cache.redisCachePrimary: Modifying... [id=/subscriptions/xxxxxxxxxxxxxxxxxxx/resourceGroups/XXXXXXXXXX/providers/Microsoft.Cache/redis/redis-instance-primary-stg]

│ Error: updating Redi (Subscription: "xxxxxxxxxxxxxxxxxxx"
│ Resource Group Name: "XXXXXXXXXX"
│ Redis Name: "redis-instance-primary-stg"): unexpected status 400 with error: BadRequest: Feature properties.redisConfiguration.rdb-backup-enabled requires a Premium sku to be set.
│ RequestID=80e25fdd-5b3c-40df-84b4-8af698fde869

│ with module.redis.azurerm_redis_cache.redisCachePrimary,
│ on .terraform/modules/redis/modules/azure-redis-cache/main.tf line 1, in resource "azurerm_redis_cache" "redisCachePrimary":
│ 1: resource "azurerm_redis_cache" "redisCachePrimary" {

Steps to Reproduce

terraform apply

Important Factoids

No response

References

No response

@buzztaiki
Copy link

buzztaiki commented May 31, 2023

I also reproduced this problem with the following simple tf file:

Steps to Reproduce

  1. apply following configuration file:
provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "test-21967"
  location = "japaneast"
}

resource "azurerm_redis_cache" "test" {
  name                = "test-21967"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
  capacity            = 2
  family              = "C"
  sku_name            = "Basic"

  redis_configuration {
    maxmemory_policy = "volatile-lru"
  }
}
  1. update configuration file as following:
--- main.tf.1	2023-05-31 13:57:53.114561425 +0900
+++ main.tf	2023-05-31 13:58:02.148012167 +0900
@@ -16,7 +16,7 @@
   sku_name            = "Basic"
 
   redis_configuration {
-    maxmemory_policy = "volatile-lru"
+    maxmemory_policy = "allkeys-lru"
   }
 }
  1. apply
azurerm_redis_cache.test: Modifying... [id=/subscriptions/98226a10-ca02-48f3-b8d4-d4e717c6d323/resourceGroups/test-21967/providers/Microsoft.Cache/redis/test-21967]
╷
│ Error: updating Redi (Subscription: "98226a10-ca02-48f3-b8d4-d4e717c6d323"
│ Resource Group Name: "test-21967"
│ Redis Name: "test-21967"): unexpected status 400 with error: BadRequest: Feature properties.redisConfiguration.rdb-backup-enabled requires a Premium sku to be set.
│ RequestID=c19dd177-74be-42f3-a5ff-9f65988ca612
│
│   with azurerm_redis_cache.test,
│   on main.tf line 10, in resource "azurerm_redis_cache" "test":
│   10: resource "azurerm_redis_cache" "test" {
│
╵

@xuzhang3
Copy link
Contributor

xuzhang3 commented May 31, 2023

It looks

v, valExists := d.GetOkExists("redis_configuration.0.rdb_backup_enabled")

will always get a value of type bool and passed to service every time.

@em-le-ts
Copy link

em-le-ts commented Jun 25, 2023

any update sir @xuzhang3 ?

@xuzhang3
Copy link
Contributor

@em-le-ts #22309 will fix this issue.

Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.