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

tencentcloud_redis_instance replica_zone_ids using zone name instead of zone ids #3027

Open
Khuicque opened this issue Dec 19, 2024 · 0 comments

Comments

@Khuicque
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

Description

Just want a request for either way

  1. modify resource [tencentcloud_redis_instance] to support [replica_zone_names] for example = ["ap-singapore-1","ap-singapore-2"]
  2. modify datasource [tencentcloud_redis_zone_config] to output zone id

New or Affected Resource(s)

  • resource tencentcloud_redis_instance
  • datasource tencentcloud_redis_zone_config

Potential Terraform Configuration

data "tencentcloud_redis_zone_config" "redis7_cluster_zone" {
  type_id = 18
  region  = "ap-singapore"
}

# Need to use this datasource just for get zone_id for multi az
data "tencentcloud_availability_zones_by_product" "az" {
  product = "redis"
}

resource "tencentcloud_redis_instance" "this" {
  availability_zone = data.tencentcloud_redis_zone_config.redis7_cluster_zone.list[0].zone
  type_id           = data.tencentcloud_redis_zone_config.redis7_cluster_zone.list[0].type_id

  vpc_id    = var.vpc_id
  subnet_id = var.subnet_id

  name        = var.name
  mem_size    = var.mem_size
  charge_type = var.charge_type

  redis_shard_num    = var.shard_num
  redis_replicas_num = var.replicas_num

  replica_zone_ids = [
    for i in range(var.replicas_num)
    : data.tencentcloud_availability_zones_by_product.az.zones[i % length(data.tencentcloud_availability_zones_by_product.az.zones)].id
  ]
}

References

  • #0000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant