Automating Redis Cluster Creation

25 views
Skip to first unread message

Navneet Singh

unread,
Oct 26, 2018, 11:06:57 AM10/26/18
to Terraform
Hi,

I have created a terraform config which creates AWS instances and installs redis on it & then configures a new redis cluster on these instances.

I have used null_resource which gets triggered when all the redis nodes are up & ready.

But when the command "sudo redis-cli --cluster create" gets triggered, it asks for an input, but I am unable to do so. Is there a way using which I can give an input to the terraform while its getting executed.

Any help is appreciated. Thanks in Advance. 

Ryan Hartkopf

unread,
Oct 27, 2018, 12:51:01 PM10/27/18
to Terraform
Hi Navneet,

I'm not aware of a method to pass input to stdin. However I'm sure there is a way to make that command work without requiring input. Check out this create-cluster script from Redis: http://download.redis.io/redis-stable/utils/create-cluster/create-cluster

It is using the command `redis-cli --cluster create $HOSTS --cluster-replicas $REPLICAS` to create the cluster. Adding those options with the correct values may allow the command to run unattended.

Navneet Singh

unread,
Oct 28, 2018, 1:30:38 AM10/28/18
to terrafo...@googlegroups.com
Hi Ryan,

I am using a similar command but this command seeks an input as a ‘yes’, to proceed with the cluster creation.

I missed updating the thread, that I was able to solve the issue by changing the command to.

echo yes | redis-cli --cluster create $HOSTS --cluster-replicas $REPLICAS

Regards,
Nav

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/hashicorp/terraform/issues
IRC: #terraform-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Terraform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to terraform-too...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/terraform-tool/f7ed8472-6173-4cc9-be89-705dd4cfceac%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Sent from Gmail Mobile
Reply all
Reply to author
Forward
0 new messages