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

provider/aws: native redis clustering support for elasticache #14317

Merged

Conversation

stack72
Copy link
Contributor

@stack72 stack72 commented May 9, 2017

No description provided.

Derrick Petzold and others added 3 commits May 7, 2017 22:19
Added support for provisioning a native redis cluster elasticache replication group.
A new TypeSet attribute `cluster_mode` has been added. It requires the following
fields:

  - `replicas_per_node_group` - The number of replica nodes in each node group
  - `num_node_groups` - The number of node groups for this Redis replication group

Notes:

  - `automatic_failover_enabled` must be set to true.
  - `number_cache_clusters` is now a optional and computed field. If `cluster_mode` is set
    its value will be computed as:
 	  ```num_node_groups + num_node_groups * replicas_per_node_group```

Below is a sample config:

  resource "aws_elasticache_replication_group" "bar" {
      replication_group_id = "tf-redis-cluser"
      replication_group_description = "test description"
      node_type = "cache.t2.micro"
      port = 6379
      parameter_group_name = "default.redis3.2.cluster.on"
      automatic_failover_enabled = true
      cluster_mode {
          replicas_per_node_group = 1
          num_node_groups = 2
      }
  }
We should error check up front on the use of num_cache_nodes and
cluster_mode. This allows us to write a test to make sure all works as
expected

```
% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/09 19:04:56 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError -timeout 120m
=== RUN   TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError
--- PASS: TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError (40.58s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	40.603s
```
@stack72 stack72 changed the title Dpetzold aws elasticache native redis3 cluster support provider/aws: native redis clustering support for elasticache May 9, 2017
@stack72
Copy link
Contributor Author

stack72 commented May 9, 2017

Error Condition:

% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError'
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/09 19:04:56 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError -timeout 120m
=== RUN   TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError
--- PASS: TestAccAWSElasticacheReplicationGroup_clusteringAndCacheNodesCausesError (40.58s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	40.603s

Clustering:

% make testacc TEST=./builtin/providers/aws TESTARGS='-run=TestAccAWSElasticacheReplicationGroup_native'                    ✹ ✭
==> Checking that code complies with gofmt requirements...
go generate $(go list ./... | grep -v /terraform/vendor/)
2017/05/09 19:13:20 Generated command/internal_plugin_list.go
TF_ACC=1 go test ./builtin/providers/aws -v -run=TestAccAWSElasticacheReplicationGroup_native -timeout 120m
=== RUN   TestAccAWSElasticacheReplicationGroup_nativeRedisCluster
--- PASS: TestAccAWSElasticacheReplicationGroup_nativeRedisCluster (1236.53s)
PASS
ok  	github.com/hashicorp/terraform/builtin/providers/aws	1236.556s

Copy link
Contributor

@grubernaut grubernaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor doc nits

Cluster Mode (`cluster_mode`) supports the following:

* `replicas_per_node_group` - (Required) Specify the number of replica nodes in each node group. Valid values are 0 to 5. Changing this number will force a new resource.
* `num_node_groups - (Required) Specify the number of node groups (shards) for this Redis replication group. Changing this number will force a new resource.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing end quote here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also add note that a max of 1 items for cluster_mode allowed.

@stack72 stack72 merged commit c4aaddd into master May 9, 2017
@stack72 stack72 deleted the dpetzold-aws-elasticache-native-redis3-cluster-support branch May 9, 2017 17:37
@ghost
Copy link

ghost commented Apr 12, 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 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.

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

Successfully merging this pull request may close these issues.

3 participants