Caveats When Building ElastiCache Redis 6.x with Terraform
Overview
There was a certain ritual to go through when using the ElastiCache Redis 6.x line with Terraform, so here is a memo for future reference.
Problem when specifying redis engine_version = 6.x
To build ElastiCache > Redis with the 6.x line, you need to specify engine_version = "6.x" as shown below.
1 | resource "aws_elasticache_replication_group" "cache_store" { |
Then, after building it, running terraform plan produces the following change.
1 | ~ resource "aws_elasticache_replication_group" "cache_store" { |
An issue had been filed about this behavior.
https://github.com/hashicorp/terraform-provider-aws/issues/15625
As a workaround, I want to avoid adding ignore_changes = [engine_version] as much as possible.
https://github.com/hashicorp/terraform-provider-aws/issues/15625#issuecomment-727759811
For now, I handle it by specifying engine_version = "6.0.5" after creation, as shown below.
1 | resource "aws_elasticache_replication_group" "cache_store" { |
You might think, “Why not just specify engine_version = "6.0.5" at build time!” but that results in an error.
So leaving a comment at build time is kind to reviewers.
1 | resource "aws_elasticache_replication_group" "cache_store" { |
That’s all.
I hope this is helpful.
Caveats When Building ElastiCache Redis 6.x with Terraform
https://kenzo0107.github.io/en/2020/12/14/terraform-elasticache-redis-6.x/
