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`
This commit is contained in:
Paul Stack 2016-08-25 13:54:40 +01:00 committed by GitHub
parent 5f567e7cd9
commit 0adc1fc4b2
2 changed files with 3 additions and 0 deletions

View File

@ -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") {

View File

@ -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.