From 7dd6b779cae3f8e35c332db2f35836b0948734b6 Mon Sep 17 00:00:00 2001 From: YuusukeMatsuura Date: Tue, 7 Jul 2015 16:58:37 +0900 Subject: [PATCH 1/2] Add AutoMinorVersionUpgrade to RDS. --- .../providers/aws/resource_aws_db_instance.go | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index e941a359f..d153c1208 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -387,17 +387,17 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error } } else { opts := rds.CreateDBInstanceInput{ - AllocatedStorage: aws.Int64(int64(d.Get("allocated_storage").(int))), - CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)), - DBName: aws.String(d.Get("name").(string)), - DBInstanceClass: aws.String(d.Get("instance_class").(string)), - DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), - MasterUsername: aws.String(d.Get("username").(string)), - MasterUserPassword: aws.String(d.Get("password").(string)), - Engine: aws.String(d.Get("engine").(string)), - EngineVersion: aws.String(d.Get("engine_version").(string)), - StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), - Tags: tags, + AllocatedStorage: aws.Int64(int64(d.Get("allocated_storage").(int))), + DBName: aws.String(d.Get("name").(string)), + DBInstanceClass: aws.String(d.Get("instance_class").(string)), + DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), + MasterUsername: aws.String(d.Get("username").(string)), + MasterUserPassword: aws.String(d.Get("password").(string)), + Engine: aws.String(d.Get("engine").(string)), + EngineVersion: aws.String(d.Get("engine_version").(string)), + StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), + AutoMinorVersionUpgrade: aws.Bool(d.Get("auto_minor_version_upgrade").(bool)), + Tags: tags, } attr := d.Get("backup_retention_period") @@ -712,6 +712,11 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error req.StorageType = aws.String(d.Get("storage_type").(string)) requestUpdate = true } + if d.HasChange("auto_minor_version_upgrade") { + d.SetPartial("auto_minor_version_upgrade") + req.AutoMinorVersionUpgrade = aws.Bool(d.Get("auto_minor_version_upgrade").(bool)) + requestUpdate = true + } if d.HasChange("vpc_security_group_ids") { if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 { From 03e7c6cf12eef37e338974b422c23a7abb27a606 Mon Sep 17 00:00:00 2001 From: clint shryock Date: Wed, 28 Oct 2015 15:07:11 -0500 Subject: [PATCH 2/2] default true for auto_minor_update and allow updates for RDS DB Instance --- .../providers/aws/resource_aws_db_instance.go | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/builtin/providers/aws/resource_aws_db_instance.go b/builtin/providers/aws/resource_aws_db_instance.go index d153c1208..d00dce597 100644 --- a/builtin/providers/aws/resource_aws_db_instance.go +++ b/builtin/providers/aws/resource_aws_db_instance.go @@ -246,8 +246,8 @@ func resourceAwsDbInstance() *schema.Resource { "auto_minor_version_upgrade": &schema.Schema{ Type: schema.TypeBool, - Computed: false, Optional: true, + Default: true, }, "allow_major_version_upgrade": &schema.Schema{ @@ -294,14 +294,11 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error } } else if _, ok := d.GetOk("snapshot_identifier"); ok { opts := rds.RestoreDBInstanceFromDBSnapshotInput{ - DBInstanceClass: aws.String(d.Get("instance_class").(string)), - DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), - DBSnapshotIdentifier: aws.String(d.Get("snapshot_identifier").(string)), - Tags: tags, - } - - if attr, ok := d.GetOk("auto_minor_version_upgrade"); ok { - opts.AutoMinorVersionUpgrade = aws.Bool(attr.(bool)) + DBInstanceClass: aws.String(d.Get("instance_class").(string)), + DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), + DBSnapshotIdentifier: aws.String(d.Get("snapshot_identifier").(string)), + AutoMinorVersionUpgrade: aws.Bool(d.Get("auto_minor_version_upgrade").(bool)), + Tags: tags, } if attr, ok := d.GetOk("availability_zone"); ok { @@ -510,6 +507,7 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error { d.Set("engine_version", v.EngineVersion) d.Set("allocated_storage", v.AllocatedStorage) d.Set("copy_tags_to_snapshot", v.CopyTagsToSnapshot) + d.Set("auto_minor_version_upgrade", v.AutoMinorVersionUpgrade) d.Set("storage_type", v.StorageType) d.Set("instance_class", v.DBInstanceClass) d.Set("availability_zone", v.AvailabilityZone)