Open camlow325 opened 3 years ago
Hello, any estimated time line for fixing this bug? I am trying to provision multi region elasticache cluster and currently blocked by this. Any work arounds available? Thank you
Also running into this. Enabling TF_LOG_PROVIDER=TRACE
, can see details about the failing API request
2021-10-11T16:50:13.435Z [INFO] plugin.terraform-provider-aws_v3.62.0_x5: 2021/10/11 16:50:13 [DEBUG] [aws-sdk-go] DEBUG: Response elasticache/DecreaseReplicaCount Details:
---[ RESPONSE ]--------------------------------------
HTTP/1.1 400 Bad Request
Connection: close
Content-Length: 346
Content-Type: text/xml
Date: Mon, 11 Oct 2021 16:50:13 GMT
X-Amzn-Requestid: 1cd55712-c258-4aec-bf68-e4cdf8fffcd8
-----------------------------------------------------: timestamp=2021-10-11T16:50:13.435Z
2021-10-11T16:50:13.435Z [INFO] plugin.terraform-provider-aws_v3.62.0_x5: 2021/10/11 16:50:13 [DEBUG] [aws-sdk-go] <ErrorResponse xmlns="http://elasticache.amazonaws.com/doc/2015-02-02/">
<Error>
<Type>Sender</Type>
<Code>InvalidParameterValue</Code>
<Message>Must have at least 1 replica when cluster mode is disabled with auto failover enabled.</Message>
</Error>
<RequestId>1cd55712-c258-4aec-bf68-e4cdf8fffcd8</RequestId>
</ErrorResponse>: timestamp=2021-10-11T16:50:13.435Z
Based on @camlow325's observations, my hunch is that if the order of operations between elasticache/DecreaseReplicaCount
and elasticache/ModifyReplicationGroup
need to be swapped.
I believe the change would be localized to this method
when I tested the upgrade scenario, 1 -> 2 multi az is enabled but failover is greyed out in the console and not enabled.
@magenx I've seen this behavior as well in the console. If both are false, then you have to select failover first then multi az. Surprised that it seems to be a single modification operation with respect to the console, but the same action from the API doesn't create the same result.
I'm hitting this bug in the opposite way (trying to set automatic_failover_enabled
to true
).
no updates on this?
Community Note
Terraform CLI and Terraform AWS Provider Version
Affected Resource(s)
Terraform Configuration Files
Initial config:
Config for second apply, attempting to change
number_cache_clusters
from2
to1
andautomatic_failover_enabled
fromtrue
tofalse
:Debug Output
Panic Output
Expected Behavior
Apply should be successful, with the replication group now having
1
cache cluster andautomatic_failover_enabled
beingfalse
.Actual Behavior
Terraform plan appears to show that the apply would change both attributes:
Terraform apply fails, however, with the following error:
To try to apply these changes individually instead, change the
number_cache_clusters
attribute back to2
, leaving theautomatic_failover_enabled
attribute set tofalse
.Terraform plan appears to show that the apply would change both attributes:
Terraform apply appears to be successful:
The AWS Console, however, shows that the
failover
setting has not changed:A repeated plan also shows that the current value for
automatic_failover_enabled
is stilltrue
(unchanged from the previous apply).From the AWS Console, I am able to change
Auto-failover
fromenabled
todisabled
. I then tried to apply the "config for second apply" from above again. The plan shows that both attributes would change:The subsequent apply is successful.
In this case, the AWS console shows that
Number of nodes
has been reduced from2
to1
. Ultimately, then, Terraform can be used to reduce the number of cache clusters from2
to1
, but this involves first disabling automatic failover outside of Terraform.Steps to Reproduce
Apply the "initial config" above.
Apply the "config for second apply" above.
Important Factoids
References