_This issue was originally opened by @tenpaiyomi as hashicorp/terraform#21893. It was migrated here as a result of the provider split. The original body of the issue is below._
0.12.2
resource "aws_db_instance" "primary" {
allocated_storage = 200
availability_zone = "us-east-1c"
allow_major_version_upgrade = true
apply_immediately = true
backup_retention_period = 30
instance_class = "db.m3.medium"
identifier = "${var.instance_name}-db"
db_subnet_group_name = "${aws_db_subnet_group.primary.name}"
engine = "postgres"
engine_version = "11.1"
multi_az = false
port = 5432
backup_window = "10:30-11:00"
maintenance_window = "Sat:11:01-Sat:11:31"
publicly_accessible = false
storage_encrypted = true
storage_type = "gp2"
vpc_security_group_ids = ["${aws_security_group.primary.id}"]
final_snapshot_identifier = "${var.instance_name}-db-final-snapshot"
skip_final_snapshot = true
snapshot_identifier = "${var.snapshot_identifier}"
lifecycle {
create_before_destroy = true
ignore_changes = ["snapshot_identifier"]
}
}
Error: error modifying DB Instance (beta-db): InvalidParameterCombination: The AllowMajorVersionUpgrade flag must be present when upgrading to a new major version.
status code: 400, request id: 8922909a-0c3d-45fe-bcc9-f329c74d99a3
For Terraform to properly pass the AllowMajorVersionUpgrade flag when restoring from a snapshot to an updated version
Terraform creates the database instance and then errors out. It also marks the instance as tained and states that it has to be replaced, which would result in a loop of the same behavior. To resolve the issue and update, I have to manually mark the resource as untained, then apply changes for it to properly perform the upgrade.
terraform applySomehow I managed to misspell tainted twice. I blame my sleep deprived state 😄 if there are any clarifications or questions about this bug, feel free to let me know and I'll assist as possible.
The fix for this has been merged and will release with version 2.18.0 of the Terraform AWS Provider likely later this week, thanks, @tenpaiyomi! 🚀
This has been released in version 2.18.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 for triage. Thanks!
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!
Most helpful comment
The fix for this has been merged and will release with version 2.18.0 of the Terraform AWS Provider likely later this week, thanks, @tenpaiyomi! 🚀