Skip to content

Commit

Permalink
Break out compare function
Browse files Browse the repository at this point in the history
  • Loading branch information
bill-rich committed Jul 16, 2021
1 parent dc34460 commit 07b8f72
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 4 additions & 0 deletions aws/resource_aws_rds_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -1506,6 +1506,10 @@ func waitForRDSClusterDeletion(conn *rds.RDS, id string, timeout time.Duration)
func rdsClusterSetResourceDataEngineVersionFromCluster(d *schema.ResourceData, c *rds.DBCluster) {
oldVersion := d.Get("engine_version").(string)
newVersion := aws.StringValue(c.EngineVersion)
compareActualEngineVersion(d, oldVersion, newVersion)
}

func compareActualEngineVersion(d *schema.ResourceData, oldVersion string, newVersion string) {
if oldVersion != newVersion && string(append([]byte(oldVersion), []byte(".")...)) != string([]byte(newVersion)[0:len(oldVersion)+1]) {
d.Set("engine_version", newVersion)
}
Expand Down
5 changes: 1 addition & 4 deletions aws/resource_aws_rds_cluster_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,5 @@ var resourceAwsRdsClusterInstanceDeletePendingStates = []string{
func rdsClusterSetResourceDataEngineVersionFromClusterInstance(d *schema.ResourceData, c *rds.DBInstance) {
oldVersion := d.Get("engine_version").(string)
newVersion := aws.StringValue(c.EngineVersion)
if oldVersion != newVersion && string(append([]byte(oldVersion), []byte(".")...)) != string([]byte(newVersion)[0:len(oldVersion)+1]) {
d.Set("engine_version", newVersion)
}
d.Set("engine_version_actual", newVersion)
compareActualEngineVersion(d, oldVersion, newVersion)
}

0 comments on commit 07b8f72

Please sign in to comment.