Skip to content

Commit

Permalink
Fix AWS RDS read replica always being placed in default VPC
Browse files Browse the repository at this point in the history
Fixes #4192 by honouring the `db_subnet_group_name` parameter when creating a cross-region read replica.
  • Loading branch information
nTraum committed Dec 8, 2015
1 parent d69abba commit 9724ee4
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions builtin/providers/aws/resource_aws_db_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
CopyTagsToSnapshot: aws.Bool(d.Get("copy_tags_to_snapshot").(bool)),
DBInstanceClass: aws.String(d.Get("instance_class").(string)),
DBInstanceIdentifier: aws.String(d.Get("identifier").(string)),
DBSubnetGroupName: aws.String(d.Get("db_subnet_group_name").(string)),
Tags: tags,
}
if attr, ok := d.GetOk("iops"); ok {
Expand All @@ -288,6 +289,10 @@ func resourceAwsDbInstanceCreate(d *schema.ResourceData, meta interface{}) error
if attr, ok := d.GetOk("publicly_accessible"); ok {
opts.PubliclyAccessible = aws.Bool(attr.(bool))
}

if attr, ok := d.GetOk("db_subnet_group_name"); ok {
opts.DBSubnetGroupName = aws.String(attr.(string))
}
_, err := conn.CreateDBInstanceReadReplica(&opts)
if err != nil {
return fmt.Errorf("Error creating DB Instance: %s", err)
Expand Down

0 comments on commit 9724ee4

Please sign in to comment.