add Aurora instance failover priority feature (#8087)
* add Aurora instance failover priority feature * promotion_tier move to input directly * fix format issue
This commit is contained in:
parent
c9468efd9a
commit
45c5675c8e
|
@ -109,6 +109,12 @@ func resourceAwsRDSClusterInstance() *schema.Resource {
|
|||
Default: 0,
|
||||
},
|
||||
|
||||
"promotion_tier": &schema.Schema{
|
||||
Type: schema.TypeInt,
|
||||
Optional: true,
|
||||
Default: 0,
|
||||
},
|
||||
|
||||
"tags": tagsSchema(),
|
||||
},
|
||||
}
|
||||
|
@ -123,6 +129,7 @@ func resourceAwsRDSClusterInstanceCreate(d *schema.ResourceData, meta interface{
|
|||
DBClusterIdentifier: aws.String(d.Get("cluster_identifier").(string)),
|
||||
Engine: aws.String("aurora"),
|
||||
PubliclyAccessible: aws.Bool(d.Get("publicly_accessible").(bool)),
|
||||
PromotionTier: aws.Int64(int64(d.Get("promotion_tier").(int))),
|
||||
Tags: tags,
|
||||
}
|
||||
|
||||
|
@ -226,6 +233,7 @@ func resourceAwsRDSClusterInstanceRead(d *schema.ResourceData, meta interface{})
|
|||
d.Set("instance_class", db.DBInstanceClass)
|
||||
d.Set("identifier", db.DBInstanceIdentifier)
|
||||
d.Set("storage_encrypted", db.StorageEncrypted)
|
||||
d.Set("promotion_tier", db.PromotionTier)
|
||||
|
||||
if db.MonitoringInterval != nil {
|
||||
d.Set("monitoring_interval", db.MonitoringInterval)
|
||||
|
@ -285,6 +293,12 @@ func resourceAwsRDSClusterInstanceUpdate(d *schema.ResourceData, meta interface{
|
|||
requestUpdate = true
|
||||
}
|
||||
|
||||
if d.HasChange("promotion_tier") {
|
||||
d.SetPartial("promotion_tier")
|
||||
req.PromotionTier = aws.Int64(int64(d.Get("promotion_tier").(int)))
|
||||
requestUpdate = true
|
||||
}
|
||||
|
||||
log.Printf("[DEBUG] Send DB Instance Modification request: %#v", requestUpdate)
|
||||
if requestUpdate {
|
||||
log.Printf("[DEBUG] DB Instance Modification request: %#v", req)
|
||||
|
|
|
@ -222,6 +222,7 @@ resource "aws_rds_cluster_instance" "cluster_instances" {
|
|||
cluster_identifier = "${aws_rds_cluster.default.id}"
|
||||
instance_class = "db.r3.large"
|
||||
db_parameter_group_name = "${aws_db_parameter_group.bar.name}"
|
||||
promotion_tier = "3"
|
||||
}
|
||||
|
||||
resource "aws_db_parameter_group" "bar" {
|
||||
|
|
|
@ -70,6 +70,7 @@ details on controlling this property.
|
|||
enhanced monitoring metrics to CloudWatch Logs. You can find more information on the [AWS Documentation](http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_Monitoring.html)
|
||||
what IAM permissions are needed to allow Enhanced Monitoring for RDS Instances.
|
||||
* `monitoring_interval` - (Optional) The interval, in seconds, between points when Enhanced Monitoring metrics are collected for the DB instance. To disable collecting Enhanced Monitoring metrics, specify 0. The default is 0. Valid Values: 0, 1, 5, 10, 15, 30, 60.
|
||||
* `promotion_tier` - (Optional) Default 0. Failover Priority setting on instance level. The reader who has lower tier has higher priority to get promoter to writer
|
||||
* `kms_key_id` - (Optional) The ARN for the KMS encryption key. When specifying `kms_key_id`, `storage_encrypted` needs to be set to true
|
||||
* `tags` - (Optional) A mapping of tags to assign to the instance.
|
||||
|
||||
|
|
Loading…
Reference in New Issue