Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aws_db_instance engine_version gets updated in-place with every run #19240

Closed
Veluu opened this issue May 5, 2021 · 3 comments · Fixed by #20207
Closed

aws_db_instance engine_version gets updated in-place with every run #19240

Veluu opened this issue May 5, 2021 · 3 comments · Fixed by #20207
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Milestone

Comments

@Veluu
Copy link

Veluu commented May 5, 2021

Hello,

Whenever auto_minor_version_upgrade is disabled with every terraform apply it wants to do engine_version update in-place.

When auto_minor_version_upgrade is enabled it works as expected.

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Terraform CLI and Terraform AWS Provider Version

Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/aws v3.37.0

Affected Resource(s)

  • aws_db_instance

Terraform Configuration Files

Please include all Terraform configurations required to reproduce the bug. Bug reports without a functional reproduction may be closed without investigation.

resource "aws_db_instance" "default" {
  instance_class             = "db.t3.small"
  license_model              = "license-included"
  maintenance_window         = "sun:03:05-sun:05:00"
  engine                     = "oracle-se2"
  engine_version             = "12.1"
  name                       = "EMXPL"
  auto_minor_version_upgrade = false
  allocated_storage          = 10
  username                   = "foo"
  password                   = "foobarbaz"
  skip_final_snapshot        = true
}

Expected Behavior

Configuration has not changed therefore there should be no update in-place. As long as major version is in order (12.1 matches 12.1.x.y.z) there should not be an update.

Actual Behavior

With every run Terraform wants to update engine_version as you can see below. In reality it does nothing as anyway it stays pinned to the newest minor version that's actually available in AWS RDS.

Below there's a plan from second run (after it was first created without any problems).

aws_db_instance.default: Refreshing state... [id=terraform-20210504214948210400000001]

An execution plan has been generated and is shown below.
Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # aws_db_instance.default will be updated in-place
  ~ resource "aws_db_instance" "default" {
        address                               = "terraform-20210504214948210400000001.ck27w5szo6th.us-east-1.rds.amazonaws.com"
        allocated_storage                     = 10
        arn                                   = "arn:aws:rds:us-east-1:237839530861:db:terraform-20210504214948210400000001"
        auto_minor_version_upgrade            = false
        availability_zone                     = "us-east-1c"
        backup_retention_period               = 0
        backup_window                         = "05:57-06:27"
        ca_cert_identifier                    = "rds-ca-2019"
        character_set_name                    = "AL32UTF8"
        copy_tags_to_snapshot                 = false
        db_subnet_group_name                  = "default"
        delete_automated_backups              = true
        deletion_protection                   = false
        enabled_cloudwatch_logs_exports       = []
        endpoint                              = "terraform-20210504214948210400000001.ck27w5szo6th.us-east-1.rds.amazonaws.com:1521"
        engine                                = "oracle-se2"
      ~ engine_version                        = "12.1.0.2.v23" -> "12.1"
      	# redacted rest of the lines
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Steps to Reproduce

  1. terraform apply
  • #0000
@ghost ghost added the service/rds Issues and PRs that pertain to the rds service. label May 5, 2021
@github-actions github-actions bot added the needs-triage Waiting for first response or review from a maintainer. label May 5, 2021
@Veluu Veluu changed the title aws_db_instance engine_version gets invokes update in-place with every run aws_db_instance engine_version gets updated in-place with every run May 5, 2021
@obourdon
Copy link
Contributor

obourdon commented Jun 17, 2021

Got exactly the same issue with Postgres version specified as major (aka 12), being instantiated during first apply and stored in state file as "12.5" and following plan/apply always want to modify it.

I think that auto_minor_version_upgrade which is a AWS RDS parameter described as follows in the AWS console:

Enable auto minor version upgrade
Enabling auto minor version upgrade will automatically upgrade to new minor versions as they are released. The automatic upgrades occur during the maintenance window for the database.

should be made completely independent of the code here

However, there is a case for which I do not understand how this is really supposed to behave:

Say I specify engine=postgres AND engine_version=12.5 AND auto_minor_version_upgrade=true
what I think will eventually happen is that AWS will at some point in time automatically upgrade my RDS instance to 12.6
However, considering the code mentioned above would then compare 12.5 and 12.6 with the Golang function strings.HasPrefix which will obviously fail too ?

Anything I am missing or getting wrong here ?

@ewbankkit ewbankkit added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Aug 3, 2021
@github-actions github-actions bot added this to the v3.54.0 milestone Aug 12, 2021
@github-actions
Copy link

This functionality has been released in v3.54.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants