TerraformでElastiCacheを更新しようとしたら反映されなかった話

terraformのelasticache_replication_groupでElastiCacheのリソースを管理していたのですが、設定更新のterraform applyを実行すると以下のようなログが出ました。

aws_ssm_parameter.cache_host: Refreshing state... [id=ponpon-cache-host]
aws_elasticache_replication_group.this: Modifying... [id=ponpon]
aws_elasticache_replication_group.this: Still modifying... [id=ponpon, 10s elapsed]
aws_elasticache_replication_group.this: Still modifying... [id=ponpon, 20s elapsed]
aws_elasticache_replication_group.this: Still modifying... [id=ponpon, 30s elapsed]
aws_elasticache_replication_group.this: Still modifying... [id=ponpon, 40s elapsed]
aws_elasticache_replication_group.this: Still modifying... [id=ponpon, 50s elapsed]
aws_elasticache_replication_group.this: Still modifying... [id=ponpon, 1m0s elapsed]
aws_elasticache_replication_group.this: Modifications complete after 1m2s [id=ponpon]

Apply complete! Resources: 0 added, 1 changed, 0 destroyed.

 

いつものApply Complete!が表示されています。
しかしElastiCacheのコンソールを見に行ってみると、何も更新されていませんでした

原因

apply_immediatelyを指定し忘れていました。

apply_immediatelyはデフォルトではfalseですが、このままだと指定した設定更新タイミング (maintenance_window) まで反映が保留されます。
ただちに更新したい場合はapply_immediately=trueを追加しましょう。

補足

resource: aws_db_instance でも同様の設定があり、挙動も同様です。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA


This site uses Akismet to reduce spam. Learn how your comment data is processed.