Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f/aws_rds_cluster-add-enhanced-monitoring #41002

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changelog/41002.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
```release-note:enhancement
resource/aws_rds_cluster: Add `monitoring_interval` and `monitoring_role_arn` arguments
```

```release-note:enhancement
data-source/aws_rds_cluster: Add `monitoring_interval` and `monitoring_role_arn` attributes
```
45 changes: 45 additions & 0 deletions internal/service/rds/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,17 @@ func resourceCluster() *schema.Resource {
Optional: true,
ForceNew: true,
},
"monitoring_interval": {
Type: schema.TypeInt,
Optional: true,
Computed: true,
},
"monitoring_role_arn": {
Type: schema.TypeString,
Optional: true,
Computed: true,
ValidateFunc: verify.ValidARN,
},
"network_type": {
Type: schema.TypeString,
Optional: true,
Expand Down Expand Up @@ -745,6 +756,14 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int
requiresModifyDbCluster = true
}

if v, ok := d.GetOk("monitoring_interval"); ok {
input.MonitoringInterval = aws.Int32(int32(v.(int)))
}

if v, ok := d.GetOk("monitoring_role_arn"); ok {
input.MonitoringRoleArn = aws.String(v.(string))
}

if v, ok := d.GetOk("network_type"); ok {
input.NetworkType = aws.String(v.(string))
}
Expand Down Expand Up @@ -995,6 +1014,14 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int
requiresModifyDbCluster = true
}

if v, ok := d.GetOk("monitoring_interval"); ok {
input.MonitoringInterval = aws.Int32(int32(v.(int)))
}

if v, ok := d.GetOk("monitoring_role_arn"); ok {
input.MonitoringRoleArn = aws.String(v.(string))
}

if v, ok := d.GetOk("network_type"); ok {
input.NetworkType = aws.String(v.(string))
}
Expand Down Expand Up @@ -1180,6 +1207,14 @@ func resourceClusterCreate(ctx context.Context, d *schema.ResourceData, meta int
input.MasterUsername = aws.String(v.(string))
}

if v, ok := d.GetOk("monitoring_interval"); ok {
input.MonitoringInterval = aws.Int32(int32(v.(int)))
}

if v, ok := d.GetOk("monitoring_role_arn"); ok {
input.MonitoringRoleArn = aws.String(v.(string))
}

if v, ok := d.GetOk("network_type"); ok {
input.NetworkType = aws.String(v.(string))
}
Expand Down Expand Up @@ -1363,6 +1398,8 @@ func resourceClusterRead(ctx context.Context, d *schema.ResourceData, meta inter
d.Set("master_user_secret", nil)
}
d.Set("master_username", dbc.MasterUsername)
d.Set("monitoring_interval", dbc.MonitoringInterval)
d.Set("monitoring_role_arn", dbc.MonitoringRoleArn)
d.Set("network_type", dbc.NetworkType)
d.Set("performance_insights_enabled", dbc.PerformanceInsightsEnabled)
d.Set("performance_insights_kms_key_id", dbc.PerformanceInsightsKMSKeyId)
Expand Down Expand Up @@ -1568,6 +1605,14 @@ func resourceClusterUpdate(ctx context.Context, d *schema.ResourceData, meta int
}
}

if d.HasChange("monitoring_interval") {
input.MonitoringInterval = aws.Int32(int32(d.Get("monitoring_interval").(int)))
}

if d.HasChange("monitoring_role_arn") {
input.MonitoringRoleArn = aws.String(d.Get("monitoring_role_arn").(string))
}

if d.HasChange("network_type") {
input.NetworkType = aws.String(d.Get("network_type").(string))
}
Expand Down
10 changes: 10 additions & 0 deletions internal/service/rds/cluster_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,14 @@ func dataSourceCluster() *schema.Resource {
Type: schema.TypeString,
Computed: true,
},
"monitoring_interval": {
Type: schema.TypeInt,
Computed: true,
},
"monitoring_role_arn": {
Type: schema.TypeString,
Computed: true,
},
"network_type": {
Type: schema.TypeString,
Computed: true,
Expand Down Expand Up @@ -224,6 +232,8 @@ func dataSourceClusterRead(ctx context.Context, d *schema.ResourceData, meta int
}
}
d.Set("master_username", dbc.MasterUsername)
d.Set("monitoring_interval", dbc.MonitoringInterval)
d.Set("monitoring_role_arn", dbc.MonitoringRoleArn)
d.Set("network_type", dbc.NetworkType)
d.Set(names.AttrPort, dbc.Port)
d.Set("preferred_backup_window", dbc.PreferredBackupWindow)
Expand Down
Loading
Loading