@@ -85,6 +85,8 @@ type Cloud struct {
8585 // version. This will also cause VerifyWorkspaceTerraformVersion to return
8686 // a warning diagnostic instead of an error.
8787 ignoreVersionConflict bool
88+
89+ runningInAutomation bool
8890}
8991
9092var _ backend.Backend = (* Cloud )(nil )
@@ -296,15 +298,25 @@ func (b *Cloud) Configure(obj cty.Value) tfdiags.Diagnostics {
296298
297299 if parseErr != nil || currentAPIVersion .LessThan (desiredAPIVersion ) {
298300 log .Printf ("[TRACE] API version check failed; want: >= %s, got: %s" , desiredAPIVersion .Original (), currentAPIVersion )
299- // FIXME: Skip version checking temporarily.
300- // diags = diags.Append(tfdiags.Sourceless(
301- // tfdiags.Error,
302- // "Unsupported Terraform Enterprise version",
303- // fmt.Sprintf(
304- // `The 'cloud' option requires Terraform Enterprise %s or later.`,
305- // apiToMinimumTFEVersion["2.5"],
306- // ),
307- // ))
301+ if b .runningInAutomation {
302+ // It should never be possible for this Terraform process to be mistakenly
303+ // used internally within an unsupported Terraform Enterprise install - but
304+ // just in case it happens, give an actionable error.
305+ diags = diags .Append (
306+ tfdiags .Sourceless (
307+ tfdiags .Error ,
308+ "Unsupported Terraform Enterprise version" ,
309+ cloudIntegrationUsedInUnsupportedTFE ,
310+ ),
311+ )
312+ } else {
313+ diags = diags .Append (tfdiags .Sourceless (
314+ tfdiags .Error ,
315+ "Unsupported Terraform Enterprise version" ,
316+ `The 'cloud' option is not supported with this version of Terraform Enterprise.` ,
317+ ),
318+ )
319+ }
308320 }
309321
310322 // Configure a local backend for when we need to run operations locally.
@@ -967,8 +979,13 @@ const refreshToApplyRefresh = `[bold][yellow]Proceeding with 'terraform apply -r
967979const unavailableTerraformVersion = `
968980[reset][yellow]The local Terraform version (%s) is not available in Terraform Cloud, or your
969981organization does not have access to it. The new workspace will use %s. You can
970- change this later in the workspace settings.[reset]
971- `
982+ change this later in the workspace settings.[reset]`
983+
984+ const cloudIntegrationUsedInUnsupportedTFE = `
985+ This version of Terraform Cloud/Enterprise does not support the state mechanism
986+ attempting to be used by the platform. This should never happen.
987+
988+ Please reach out to HashiCorp Support to resolve this issue.`
972989
973990var (
974991 workspaceConfigurationHelp = fmt .Sprintf (
0 commit comments