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

[azurerm_redis_cache] Backup settings don't seem to be enabled #2634

Closed
TheFlyingArcher opened this issue Jan 9, 2019 · 5 comments
Closed

Comments

@TheFlyingArcher
Copy link

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform (and AzureRM Provider) Version

bcline2@LAMU02WX315HTD6:~/src/terraform/ccoe/azure_redis_cache/examples/redis_cache_with_backup$ terraform -v
Terraform v0.11.10
+ provider.azurerm v1.20.0
+ provider.null v1.0.0
+ provider.random v2.0.0

Your version of Terraform is out of date! The latest version
is 0.11.11. You can update by downloading from www.terraform.io/downloads.html

Affected Resource(s)

  • azurerm_redis_cache

Terraform Configuration Files

Calling module

module "clustered_redis_examples" {
  source                          = "../../modules/premium_redis"
  name                            = "clustered-redis"
  namespace                       = "${module.generate-random-name.name}"
  resource_group_name             = "${module.create-resource-group.name}"
  location                        = "westus"
  cache_size                      = "1"
  pricing_family                  = "P"
  sku_name                        = "Premium"
  backup_enabled                  = "true"
  shard_count                     = "1"
  backup_frequency                = "30"
  backup_snapshot_count           = "1"
  backup_storage_account_name     = "${module.redis_backup_storage.name}"
  backup_storage_account_endpoint = "${module.redis_backup_storage.primary_blob_endpoint}"
  backup_storage_account_key      = "${module.redis_backup_storage.primary_access_key}"
}

Definition

resource "azurerm_redis_cache" "premium_redis_cache_with_backup" {
  count               = "${var.backup_enabled == "true" ? 1 : 0}"
  name                = "${module.namespace.name}"
  location            = "${var.location}"
  resource_group_name = "${var.resource_group_name}"
  capacity            = "${var.cache_size}"
  family              = "${local.redis_family}"
  sku_name            = "${local.redis_sku}"
  enable_non_ssl_port = false
  shard_count         = "${var.shard_count}"

  redis_configuration {
    maxmemory_reserved = "${var.maxmemory_reserved}"
    maxmemory_delta    = "${var.maxmemory_delta}"
    maxmemory_policy   = "${var.maxmemory_policy}"

    rdb_backup_enabled            = true
    rdb_backup_frequency          = "${var.backup_frequency}"
    rdb_backup_max_snapshot_count = "${var.backup_snapshot_count}"
    rdb_storage_connection_string = "DefaultEndpointsProtocol=https;BlobEndpoint=${var.backup_storage_account_endpoint};AccountName=${var.backup_storage_account_name};AccountKey=${var.backup_storage_account_key}"
  }
}

Debug Output

If you need this, contact me as it contains sensitive items not wanting exposed publically

Expected Behavior

Based on what I understand, when I go to Azure portal, Redis data persistance should be enabled. I see the the values being set when I view the output from the plan generated

  + module.clustered_redis_examples.azurerm_redis_cache.premium_redis_cache_with_backup
      id:                                                  <computed>
      capacity:                                            "1"
      enable_non_ssl_port:                                 "false"
      family:                                              "P"
      hostname:                                            <computed>
      location:                                            "westus"
      name:                                                "${module.namespace.name}"
      port:                                                <computed>
      primary_access_key:                                  <computed>
      private_static_ip_address:                           <computed>
      redis_configuration.#:                               "1"
      redis_configuration.0.maxclients:                    <computed>
      redis_configuration.0.maxmemory_delta:               "200"
      redis_configuration.0.maxmemory_policy:              "volatile-lru"
      redis_configuration.0.maxmemory_reserved:            "200"
      redis_configuration.0.rdb_backup_enabled:            "true"
      redis_configuration.0.rdb_backup_frequency:          "30"
      redis_configuration.0.rdb_backup_max_snapshot_count: "1"
      redis_configuration.0.rdb_storage_connection_string: <sensitive>
      resource_group_name:                                 "${var.resource_group_name}"
      secondary_access_key:                                <computed>
      shard_count:                                         "1"
      sku_name:                                            "Premium"
      ssl_port:                                            <computed>
      tags.%:                                              <computed>

Actual Behavior

When I go to the Azure portal for my redis cache, the redis data persistance is turned off.
screen shot 2019-01-09 at 10 35 48 am

Steps to Reproduce

Simply perform the three-step terraform process of

  1. terraform init
  2. terraform plan
  3. terraform apply [--auto-approve]

References

@Dmitry1987
Copy link

for me the 'rdb_backup_max_snapshot_count' doesn't work, fails if I set it different from 1.
Any other number fails with

Error: Error issuing create request for Redis Cache redis-db-testing (resource group xxxxx): redis.Client#Create: Failure sending request: StatusCode=400 -- Original Error: Code="InvalidRequestBody" Message="The value of the parameter 'rdb-backup-max-snapshot-count' is invalid.\r\nRequestID=xxxxxxxxxx"

@AndresFPineros
Copy link

Any update on this? Should we even use this attribute?

@neil-yechenwei
Copy link
Contributor

neil-yechenwei commented Jul 21, 2020

Thanks for opening this issue. After tested with below tfconfig and latest azurerm, seems I cannot repro this issue anymore. Could you have a try below tfconfig to check whether this issue still exists?

provider "azurerm" {
  features {}
}

resource "azurerm_resource_group" "test" {
  name     = "acctestRG-redisc-test10"
  location = "eastus2"
}

resource "azurerm_storage_account" "test" {
  name                     = "satest10neil"
  resource_group_name      = azurerm_resource_group.test.name
  location                 = azurerm_resource_group.test.location
  account_tier             = "Standard"
  account_replication_type = "GRS"

  tags = {
    environment = "staging"
  }
}

resource "azurerm_redis_cache" "test" {
  name                = "acctestRedis-test10"
  location            = azurerm_resource_group.test.location
  resource_group_name = azurerm_resource_group.test.name
  capacity            = 3
  family              = "P"
  sku_name            = "Premium"
  enable_non_ssl_port = false

  redis_configuration {
    rdb_backup_enabled            = true
    rdb_backup_frequency          = 60
    rdb_backup_max_snapshot_count = 1
    rdb_storage_connection_string = "DefaultEndpointsProtocol=https;BlobEndpoint=${azurerm_storage_account.test.primary_blob_endpoint};AccountName=${azurerm_storage_account.test.name};AccountKey=${azurerm_storage_account.test.primary_access_key}"
  }
}

image

@tombuildsstuff
Copy link
Contributor

👋

Since we've not heard back here I'm going to close this issue for the moment - but please let us know if the solution proposed above doesn't work and we'll take another look.

Thanks!

@ghost
Copy link

ghost commented Sep 14, 2020

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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks!

@ghost ghost locked and limited conversation to collaborators Sep 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants