Skip to content

Commit

Permalink
feat: added replica_count and replicas_mode functionality (#88)
Browse files Browse the repository at this point in the history
* added replica_count and replicas_mode functionality

* readme generated

* fmt

* changed default value for replica_count to null
  • Loading branch information
rs1986x authored Jun 28, 2022
1 parent 1582f4c commit 3fcdba5
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ module "memorystore" {
| memory\_size\_gb | Redis memory size in GiB. Defaulted to 1 GiB | `number` | `1` | no |
| name | The ID of the instance or a fully qualified identifier for the instance. | `string` | n/a | yes |
| project | The ID of the project in which the resource belongs to. | `string` | n/a | yes |
| read\_replicas\_mode | Read replicas mode. https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#readreplicasmode | `string` | `"READ_REPLICAS_DISABLED"` | no |
| redis\_configs | The Redis configuration parameters. See [more details](https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Instance.FIELDS.redis_configs) | `map(any)` | `{}` | no |
| redis\_version | The version of Redis software. | `string` | `null` | no |
| region | The GCP region to use. | `string` | `null` | no |
| replica\_count | The number of replicas. can | `number` | `null` | no |
| reserved\_ip\_range | The CIDR range of internal addresses that are reserved for this instance. | `string` | `null` | no |
| tier | The service tier of the instance. https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#Tier | `string` | `"STANDARD_HA"` | no |
| transit\_encryption\_mode | The TLS mode of the Redis instance, If not provided, TLS is enabled for the instance. | `string` | `"SERVER_AUTHENTICATION"` | no |
Expand Down
12 changes: 7 additions & 5 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,13 @@
resource "google_redis_instance" "default" {
depends_on = [module.enable_apis]

project = var.project
name = var.name
tier = var.tier
memory_size_gb = var.memory_size_gb
connect_mode = var.connect_mode
project = var.project
name = var.name
tier = var.tier
replica_count = var.tier == "STANDARD_HA" ? var.replica_count : null
read_replicas_mode = var.tier == "STANDARD_HA" ? var.read_replicas_mode : null
memory_size_gb = var.memory_size_gb
connect_mode = var.connect_mode

region = var.region
location_id = var.location_id
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ variable "memory_size_gb" {
default = 1
}

variable "replica_count" {
description = "The number of replicas. can"
type = number
default = null
}

variable "read_replicas_mode" {
description = "Read replicas mode. https://cloud.google.com/memorystore/docs/redis/reference/rest/v1/projects.locations.instances#readreplicasmode "
type = string
default = "READ_REPLICAS_DISABLED"
}

variable "location_id" {
description = "The zone where the instance will be provisioned. If not provided, the service will choose a zone for the instance. For STANDARD_HA tier, instances will be created across two zones for protection against zonal failures. If [alternativeLocationId] is also provided, it must be different from [locationId]."
type = string
Expand Down

0 comments on commit 3fcdba5

Please sign in to comment.