hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.83k stars 9.17k forks source link

aws_mq_broker Using auto_minor_version_upgrade causes engine_version drift #14705

Open dekimsey opened 4 years ago

dekimsey commented 4 years ago

Community Note

Description

When using the auto_minor_version_upgrade, the engine_version parameter can drift (become out of date). This causes spurious plans where terraform wants to downgrade the engine. I propose when auto_minor_version_upgrade is set, the engine version be compared as a glob on the minor version.

Thus eliminating plan reports like such:

  # aws_mq_broker.amq must be replaced
-/+ resource "aws_mq_broker" "amq" {
        auto_minor_version_upgrade = true
      ~ engine_version             = "5.15.12" -> "5.15.10" # forces replacement
}

Perhaps instead, a new minimum_engine_version parameter should be set. Thus allowing AWS automatic upgrades to happen gracefully and not have terraform attempt to downgrade.

New or Affected Resource(s)

Potential Terraform Configuration

resource "aws_mq_broker" "amq" {
  broker_name         = "amq"
  engine_type         = "ActiveMQ"
  minimum_engine_version      = "5.15.10"
  auto_minor_version_upgrade = true

Alternatively, re-interpret the existing parameter as a minimum if auto_minor_version_upgrade is set.

resource "aws_mq_broker" "amq" {
  broker_name         = "amq"
  engine_type         = "ActiveMQ"
  engine_version      = "5.15.10"  # minimum since auto_minor_version_upgrade is set
  auto_minor_version_upgrade = true

References

jchristner-trustwave commented 4 years ago

Alternatively, it could be handled like the engine_version parameter in aws_db_instance where if auto_minor_version_upgrade is set, you can just provide a prefix of the version so "5.5" would work for all "5.5.x" versions.

wernerb commented 3 years ago

This is still a problem. Can this be flagged as a bug? Currently auto_minor_version is not usable due to this problem

Samridhigupta786 commented 2 years ago

This bug still exist. Do we have any timeline about when is this gonna resolve?

dmitriyklyuzov commented 1 year ago

This is still an issue as of June 2023

FreTimmerman commented 2 weeks ago

am i right that this has been fixed as of closing of https://github.com/hashicorp/terraform-provider-aws/issues/38930 ?