From 46e47ed3791816a47bd7dc3b2d88f9d587b475b0 Mon Sep 17 00:00:00 2001 From: Chris Arcand Date: Tue, 5 Oct 2021 15:51:48 -0500 Subject: [PATCH] Use the 'tfe' service for everything. The 'tfe' service was appended to with various versions to denote a new 'feature' implemented by a new 'service'. This quickly proved to not be scalable, as adding an entry to the discovery document from every feature is bad. The new mechanism added was checking the TFP-API-Version header on requests for a version, instead. So we'll remove the separation here between different tfe service 'versions' and the separate 'state' service and Just Use TFE, as well as the TFP-API-Version header for all feature versioning., as well as the TFP-API-Version header for all feature versioning. --- internal/cloud/backend.go | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/internal/cloud/backend.go b/internal/cloud/backend.go index bd71d23ba..d1b493b1c 100644 --- a/internal/cloud/backend.go +++ b/internal/cloud/backend.go @@ -34,8 +34,7 @@ import ( const ( defaultHostname = "app.terraform.io" defaultParallelism = 10 - stateServiceID = "state.v2" - tfeServiceID = "tfe.v2.1" + tfeServiceID = "tfe.v2" ) // Cloud is an implementation of EnhancedBackend in service of the Terraform Cloud/Enterprise @@ -349,11 +348,6 @@ func (b *Cloud) setConfigurationFields(obj cty.Value) tfdiags.Diagnostics { // discover the TFC/E API service URL and version constraints. func (b *Cloud) discover() (*url.URL, error) { - serviceID := tfeServiceID - if b.forceLocal { - serviceID = stateServiceID - } - hostname, err := svchost.ForComparison(b.hostname) if err != nil { return nil, err @@ -364,7 +358,7 @@ func (b *Cloud) discover() (*url.URL, error) { return nil, err } - service, err := host.ServiceURL(serviceID) + service, err := host.ServiceURL(tfeServiceID) // Return the error, unless its a disco.ErrVersionNotSupported error. if _, ok := err.(*disco.ErrVersionNotSupported); !ok && err != nil { return nil, err