Merge pull request #3677 from hashicorp/pr-2637

provider/aws: Add AutoMinorVersionUpgrade to RDS [GH-3677]
This commit is contained in:
Clint 2015-11-11 09:48:24 -06:00
commit dda6973c0a
1 changed files with 23 additions and 20 deletions

View File

@ -246,8 +246,8 @@ func resourceAwsDbInstance() *schema.Resource {
"auto_minor_version_upgrade": &schema.Schema{ "auto_minor_version_upgrade": &schema.Schema{
Type: schema.TypeBool, Type: schema.TypeBool,
Computed: false,
Optional: true, Optional: true,
Default: true,
}, },
"allow_major_version_upgrade": &schema.Schema{ "allow_major_version_upgrade": &schema.Schema{
@ -297,13 +297,10 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
DBInstanceClass: aws.String(d.Get("instance_class").(string)), DBInstanceClass: aws.String(d.Get("instance_class").(string)),
DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), DBInstanceIdentifier: aws.String(d.Get("identifier").(string)),
DBSnapshotIdentifier: aws.String(d.Get("snapshot_identifier").(string)), DBSnapshotIdentifier: aws.String(d.Get("snapshot_identifier").(string)),
AutoMinorVersionUpgrade: aws.Bool(d.Get("auto_minor_version_upgrade").(bool)),
Tags: tags, Tags: tags,
} }
if attr, ok := d.GetOk("auto_minor_version_upgrade"); ok {
opts.AutoMinorVersionUpgrade = aws.Bool(attr.(bool))
}
if attr, ok := d.GetOk("availability_zone"); ok { if attr, ok := d.GetOk("availability_zone"); ok {
opts.AvailabilityZone = aws.String(attr.(string)) opts.AvailabilityZone = aws.String(attr.(string))
} }
@ -388,7 +385,6 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
} else { } else {
opts := rds.CreateDBInstanceInput{ opts := rds.CreateDBInstanceInput{
AllocatedStorage: aws.Int64(int64(d.Get("allocated_storage").(int))), 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)), DBName: aws.String(d.Get("name").(string)),
DBInstanceClass: aws.String(d.Get("instance_class").(string)), DBInstanceClass: aws.String(d.Get("instance_class").(string)),
DBInstanceIdentifier: aws.String(d.Get("identifier").(string)), DBInstanceIdentifier: aws.String(d.Get("identifier").(string)),
@ -397,6 +393,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
Engine: aws.String(d.Get("engine").(string)), Engine: aws.String(d.Get("engine").(string)),
EngineVersion: aws.String(d.Get("engine_version").(string)), EngineVersion: aws.String(d.Get("engine_version").(string)),
StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)), StorageEncrypted: aws.Bool(d.Get("storage_encrypted").(bool)),
AutoMinorVersionUpgrade: aws.Bool(d.Get("auto_minor_version_upgrade").(bool)),
Tags: tags, Tags: tags,
} }
@ -510,6 +507,7 @@ func resourceAwsDbInstanceRead(d *schema.ResourceData, meta interface{}) error {
d.Set("engine_version", v.EngineVersion) d.Set("engine_version", v.EngineVersion)
d.Set("allocated_storage", v.AllocatedStorage) d.Set("allocated_storage", v.AllocatedStorage)
d.Set("copy_tags_to_snapshot", v.CopyTagsToSnapshot) d.Set("copy_tags_to_snapshot", v.CopyTagsToSnapshot)
d.Set("auto_minor_version_upgrade", v.AutoMinorVersionUpgrade)
d.Set("storage_type", v.StorageType) d.Set("storage_type", v.StorageType)
d.Set("instance_class", v.DBInstanceClass) d.Set("instance_class", v.DBInstanceClass)
d.Set("availability_zone", v.AvailabilityZone) d.Set("availability_zone", v.AvailabilityZone)
@ -712,6 +710,11 @@ func resourceAwsDbInstanceUpdate(d *schema.ResourceData, meta interface{}) error
req.StorageType = aws.String(d.Get("storage_type").(string)) req.StorageType = aws.String(d.Get("storage_type").(string))
requestUpdate = true 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 d.HasChange("vpc_security_group_ids") {
if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 { if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 {