Skip to content

Commit

Permalink
Remove insightsPostgresOnlyCustomizeDiff function (#6006)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromefroe authored May 13, 2022
1 parent 6ef46ac commit d802df5
Showing 1 changed file with 2 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ func resourceSqlDatabaseInstance() *schema.Resource {
customdiff.ForceNewIfChange("settings.0.disk_size", isDiskShrinkage),
privateNetworkCustomizeDiff,
pitrPostgresOnlyCustomizeDiff,
insightsPostgresOnlyCustomizeDiff,
),

Schema: map[string]*schema.Schema{
Expand Down Expand Up @@ -762,15 +761,6 @@ func pitrPostgresOnlyCustomizeDiff(_ context.Context, diff *schema.ResourceDiff,
return nil
}

func insightsPostgresOnlyCustomizeDiff(_ context.Context, diff *schema.ResourceDiff, v interface{}) error {
insights := diff.Get("settings.0.insights_config.0.query_insights_enabled").(bool)
dbVersion := diff.Get("database_version").(string)
if insights && !strings.Contains(dbVersion, "POSTGRES") {
return fmt.Errorf("query_insights_enabled is only available for Postgres now.")
}
return nil
}

func resourceSqlDatabaseInstanceCreate(d *schema.ResourceData, meta interface{}) error {
config := meta.(*Config)
userAgent, err := generateUserAgentString(d, config.userAgent)
Expand Down Expand Up @@ -1039,8 +1029,8 @@ func expandCloneContext(configured []interface{}) (*sqladmin.CloneContext, strin
_cloneConfiguration := configured[0].(map[string]interface{})

return &sqladmin.CloneContext{
PointInTime: _cloneConfiguration["point_in_time"].(string),
AllocatedIpRange: _cloneConfiguration["allocated_ip_range"].(string),
PointInTime: _cloneConfiguration["point_in_time"].(string),
AllocatedIpRange: _cloneConfiguration["allocated_ip_range"].(string),
}, _cloneConfiguration["source_instance_name"].(string)
}

Expand Down

0 comments on commit d802df5

Please sign in to comment.