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.
This commit is contained in:
Chris Arcand 2021-10-05 15:51:48 -05:00
parent 412679522d
commit 46e47ed379
1 changed files with 2 additions and 8 deletions

View File

@ -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