How migrate aws_elasticache_cluster to preferred_availability_zones without resource recreation

I can not migrate to AWS provider 2.x as Terraform want recreate aws_elasticache_cluster resources if I change “availability_zones” (REMOVED param) to “preferred_availability_zones”

How I can migrate to new param without destroying existed resources?


resource "aws_elasticache_cluster" "ecache_cluster" {
   ...
   az_mode = "single-az"
   preferred_availability_zones = ["${var.availability_zones[0]}"]
}

change to

resource "aws_elasticache_cluster" "ecache_cluster" {
   ...
   az_mode = "single-az"
   preferred_availability_zones = ["${var.availability_zones[0]}"]
}

results:

(forces new resource)

-/+ module.ecache.aws_elasticache_cluster.ecache_cluster (new resource required)
      id:                                            "stg01-ecache" => <computed> (forces new resource)
      apply_immediately:                             "true" => "true"
      availability_zone:                             "us-west-2a" => "us-west-2a"
      availability_zones.#:                          "1" => "0" (forces new resource)
      availability_zones.2487133097:                 "us-west-2a" => "" (forces new resource)
1 Like

Hi,

this still seems to be a problem and there’s no answer here nor Github. In github there’s a workaround provided from another user, but that’s it. What’s the expected way to migrate without destroying existing resources?