Skip to content

Commit

Permalink
Revert "Fix terraform updates for min_consul_version (#161)" (#162)
Browse files Browse the repository at this point in the history
This reverts commit 3343615.
  • Loading branch information
chapmanc authored Jul 8, 2021
1 parent bd07c6d commit 1cb9360
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 12 deletions.
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/go-openapi/strfmt v0.20.1
github.com/google/uuid v1.2.0
github.com/hashicorp/go-cty v1.4.1-0.20200414143053-d3edf31b6320
github.com/hashicorp/go-version v1.3.0
github.com/hashicorp/hcl/v2 v2.8.2 // indirect
github.com/hashicorp/hcp-sdk-go v0.10.0
github.com/hashicorp/terraform-exec v0.13.3 // indirect
Expand Down
12 changes: 1 addition & 11 deletions internal/provider/resource_consul_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"strings"
"time"

"github.com/hashicorp/go-version"
consulmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-consul-service/preview/2021-02-04/models"
sharedmodels "github.com/hashicorp/hcp-sdk-go/clients/cloud-shared/v1/models"
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
Expand Down Expand Up @@ -95,12 +94,7 @@ func resourceConsulCluster() *schema.Resource {
DiffSuppressFunc: func(_, old, new string, _ *schema.ResourceData) bool {
// Suppress diff is normalized versions match OR min_consul_version is removed from the resource
// since min_consul_version is required in order to upgrade the cluster to a new Consul version.
actualConsulVersion := version.Must(version.NewVersion(old))
currentTFVersion := version.Must(version.NewVersion(new))
log.Printf("[DEBUG] Actual Consul Version %v", old)
log.Printf("[DEBUG] Current TF Version %v", new)

return currentTFVersion.LessThanOrEqual(actualConsulVersion) || new == ""
return input.NormalizeVersion(old) == input.NormalizeVersion(new) || new == ""
},
},
"datacenter": {
Expand Down Expand Up @@ -467,10 +461,6 @@ func setConsulClusterResourceData(d *schema.ResourceData, cluster *consulmodels.
return err
}

if err := d.Set("min_consul_version", cluster.ConsulVersion); err != nil {
return err
}

if err := d.Set("auto_hvn_to_hvn_peering", cluster.Config.AutoHvnToHvnPeering); err != nil {
return err
}
Expand Down

0 comments on commit 1cb9360

Please sign in to comment.