From 0adc1fc4b231c00df9f8d4a231ce5907c3ac37b8 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Thu, 25 Aug 2016 13:54:40 +0100 Subject: [PATCH] provider/aws: Allow `aws_rds_instance` to upgrade the major version (#8471) Fixes #8468 If a user wished to bump the `engine_version` of an RDS instance, Terraform was not sending `allow_major_version_upgrade` to the API *unless* that value also changed at the same time. This caused the following error from RDS API: ``` * aws_db_instance.bar: Error modifying DB Instance * tf-20160825101420910562798obb: InvalidParameterCombination: The * AllowMajorVersionUpgrade flag must be present when upgrading to a new * major version. status code: 400, request id: 20e36364-6ab0-11e6-b794-51f12f4135f1 ``` This change will always send the `allow_major_version_upgrade` flag to the API when the `engine_version` changes. This still relies on the user setting the correct value i.e. if they are upgrading from postgres 0.4.7 -> 9.5.2 then the config will need to set the `allow_major_version_upgrade` flag to be `true` --- builtin/providers/aws/resource_aws_db_instance.go | 1 + website/source/docs/providers/aws/r/db_instance.html.markdown | 2 ++ 2 files changed, 3 insertions(+) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index 4fe66a2b4..c2b2317f7 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -837,6 +837,7 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error if d.HasChange("engine_version") { d.SetPartial("engine_version") req.EngineVersion = aws.String(d.Get("engine_version").(string)) + req.AllowMajorVersionUpgrade = aws.Bool(d.Get("allow_major_version_upgrade").(bool)) requestUpdate = true } if d.HasChange("backup_window") { diff --git a/website/source/docs/providers/aws/r/db_instance.html.markdown b/website/source/docs/providers/aws/r/db_instance.html.markdown index 66ed8c384..65de48188 100644 --- a/website/source/docs/providers/aws/r/db_instance.html.markdown +++ b/website/source/docs/providers/aws/r/db_instance.html.markdown @@ -19,6 +19,8 @@ phase because a modification has not yet taken place. You can use the `apply_immediately` flag to instruct the service to apply the change immediately (see documentation below). +When upgrading the major version of an engine, `allow_major_version_upgrade` must be set to `true` + ~> **Note:** using `apply_immediately` can result in a brief downtime as the server reboots. See the AWS Docs on [RDS Maintenance][2] for more information.