Skip to content

Commit

Permalink
resource/aws_dms_replication_instance: Add `allow_major_version_upgra…
Browse files Browse the repository at this point in the history
…de` argument (#14550)

* r/aws_dms_replication_instance: Support allow_major_version_upgrade attribute

* Stop setting AllowMajorVersionUpgrade

Co-authored-by: Brian Flad <bflad417@gmail.com>

* Optionally include allow_major_version_upgrade

Co-authored-by: Brian Flad <bflad417@gmail.com>

Co-authored-by: Brian Flad <bflad417@gmail.com>
  • Loading branch information
shuheiktgw and bflad authored Aug 14, 2020
1 parent 2105133 commit 0f56a33
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions aws/resource_aws_dms_replication_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func resourceAwsDmsReplicationInstance() *schema.Resource {
Optional: true,
ValidateFunc: validation.IntBetween(5, 6144),
},
"allow_major_version_upgrade": {
Type: schema.TypeBool,
Optional: true,
},
"apply_immediately": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -286,6 +290,12 @@ func resourceAwsDmsReplicationInstanceUpdate(d *schema.ResourceData, meta interf
}
}

if v, ok := d.GetOk("allow_major_version_upgrade"); ok {
request.AllowMajorVersionUpgrade = aws.Bool(v.(bool))
// Having allowing_major_version_upgrade by itself should not trigger ModifyReplicationInstance
// as it results in InvalidParameterCombination: No modifications were requested
}

if d.HasChange("engine_version") {
if v, ok := d.GetOk("engine_version"); ok {
request.EngineVersion = aws.String(v.(string))
Expand Down
3 changes: 2 additions & 1 deletion aws/resource_aws_dms_replication_instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ func TestAccAWSDmsReplicationInstance_EngineVersion(t *testing.T) {
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
ImportStateVerifyIgnore: []string{"apply_immediately"},
ImportStateVerifyIgnore: []string{"allow_major_version_upgrade", "apply_immediately"},
},
}

Expand Down Expand Up @@ -714,6 +714,7 @@ data "aws_partition" "current" {
resource "aws_dms_replication_instance" "test" {
apply_immediately = true
allow_major_version_upgrade = true
engine_version = %q
replication_instance_class = data.aws_partition.current.partition == "aws" ? "dms.t2.micro" : "dms.c4.large"
replication_instance_id = %q
Expand Down
1 change: 1 addition & 0 deletions website/docs/r/dms_replication_instance.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ resource "aws_dms_replication_instance" "test" {
The following arguments are supported:

* `allocated_storage` - (Optional, Default: 50, Min: 5, Max: 6144) The amount of storage (in gigabytes) to be initially allocated for the replication instance.
* `allow_major_version_upgrade` - (Optional, Default: false) Indicates that major version upgrades are allowed.
* `apply_immediately` - (Optional, Default: false) Indicates whether the changes should be applied immediately or during the next maintenance window. Only used when updating an existing resource.
* `auto_minor_version_upgrade` - (Optional, Default: false) Indicates that minor engine upgrades will be applied automatically to the replication instance during the maintenance window.
* `availability_zone` - (Optional) The EC2 Availability Zone that the replication instance will be created in.
Expand Down

0 comments on commit 0f56a33

Please # to comment.