provider/aws: Rename parameter_group_name to db_cluster_parameter_group_name (supersedes #7068) (#7083)

* modify parameter_group_name to db_cluster_parameter_group_name #7046

* provider/aws: Deprecate parameter_group_name in RDS Cluster

Use db_cluster_parameter_group_name instead
This commit is contained in:
Clint 2016-06-09 16:45:29 -05:00
parent 2536c7e489
commit 6318b8fd4c
3 changed files with 24 additions and 4 deletions

View File

@ -61,10 +61,20 @@ func resourceAwsRDSCluster() *schema.Resource {
Computed: true,
},
// TODO: remove parameter_group_name
// See https://github.com/hashicorp/terraform/issues/7046
// Likely need migration to remove from state
"parameter_group_name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
Deprecated: "Use db_cluster_parameter_group_name instead. This attribute will be removed in a future version",
},
"db_cluster_parameter_group_name": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
},
"endpoint": &schema.Schema{
@ -205,6 +215,10 @@ func resourceAwsRDSClusterCreate(d *schema.ResourceData, meta interface{}) error
createOpts.DBClusterParameterGroupName = aws.String(attr.(string))
}
if attr, ok := d.GetOk("db_cluster_parameter_group_name"); ok {
createOpts.DBClusterParameterGroupName = aws.String(attr.(string))
}
if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 {
createOpts.VpcSecurityGroupIds = expandStringList(attr.List())
}
@ -297,6 +311,7 @@ func resourceAwsRDSClusterRead(d *schema.ResourceData, meta interface{}) error {
d.Set("db_subnet_group_name", dbc.DBSubnetGroup)
d.Set("parameter_group_name", dbc.DBClusterParameterGroup)
d.Set("db_cluster_parameter_group_name", dbc.DBClusterParameterGroup)
d.Set("endpoint", dbc.Endpoint)
d.Set("engine", dbc.Engine)
d.Set("master_username", dbc.MasterUsername)
@ -362,6 +377,11 @@ func resourceAwsRDSClusterUpdate(d *schema.ResourceData, meta interface{}) error
req.DBClusterParameterGroupName = aws.String(d.Get("parameter_group_name").(string))
}
if d.HasChange("db_cluster_parameter_group_name") {
d.SetPartial("db_cluster_parameter_group_name")
req.DBClusterParameterGroupName = aws.String(d.Get("db_cluster_parameter_group_name").(string))
}
_, err := conn.ModifyDBCluster(req)
if err != nil {
return fmt.Errorf("[WARN] Error modifying RDS Cluster (%s): %s", d.Id(), err)

View File

@ -28,7 +28,7 @@ func TestAccAWSRDSCluster_basic(t *testing.T) {
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "storage_encrypted", "false"),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "parameter_group_name", "default.aurora5.6"),
"aws_rds_cluster.default", "db_cluster_parameter_group_name", "default.aurora5.6"),
),
},
},
@ -50,7 +50,7 @@ func TestAccAWSRDSCluster_encrypted(t *testing.T) {
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "storage_encrypted", "true"),
resource.TestCheckResourceAttr(
"aws_rds_cluster.default", "parameter_group_name", "default.aurora5.6"),
"aws_rds_cluster.default", "db_cluster_parameter_group_name", "default.aurora5.6"),
),
},
},
@ -168,7 +168,7 @@ resource "aws_rds_cluster" "default" {
database_name = "mydb"
master_username = "foo"
master_password = "mustbeeightcharaters"
parameter_group_name = "default.aurora5.6"
db_cluster_parameter_group_name = "default.aurora5.6"
}`, n)
}

View File

@ -77,7 +77,7 @@ Default: A 30-minute window selected at random from an 8-hour block of time per
are applied immediately, or during the next maintenance window. Default is
`false`. See [Amazon RDS Documentation for more information.](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.DBInstance.Modifying.html)
* `db_subnet_group_name` - (Optional) A DB subnet group to associate with this DB instance. **NOTE:** This must match the `db_subnet_group_name` specified on every [`aws_rds_cluster_instance`](/docs/providers/aws/r/rds_cluster_instance.html) in the cluster.
* `parameter_group_name` - (Optional) A cluster parameter group to associate with the cluster.
* `db_cluster_parameter_group_name` - (Optional) A cluster parameter group to associate with the cluster.
## Attributes Reference