Skip to content

The terraform block's experiments list is ignored in _override.tf files, but terminal output suggests it is used. #38012

@SarahFrench

Description

@SarahFrench

Terraform Version

Terraform v1.15.0-dev
on darwin_arm64


Using a binary built from source with _experiments enabled_.

Terraform Configuration Files

Note that this is hard to manually test as there are no current (i.e. active, usable) experiments enabled in the code base. Use this branch to use a version of Terraform that contains a fake experiment called current: https://github.com/hashicorp/terraform/tree/example-current-experiment

main.tf

terraform {
  # empty
}

main_override.tf

terraform {
  experiments = [current]
}

Debug Output

2025-12-15T16:05:13.984Z [INFO]  Terraform version: 1.15.0 dev
2025-12-15T16:05:13.985Z [DEBUG] using github.com/hashicorp/go-tfe v1.94.0
2025-12-15T16:05:13.985Z [DEBUG] using github.com/hashicorp/hcl/v2 v2.24.0
2025-12-15T16:05:13.985Z [DEBUG] using github.com/hashicorp/terraform-svchost v0.1.1
2025-12-15T16:05:13.985Z [DEBUG] using github.com/zclconf/go-cty v1.16.3
2025-12-15T16:05:13.985Z [INFO]  Go runtime version: go1.25.3
2025-12-15T16:05:13.985Z [INFO]  CLI args: []string{"/Users/sarahfrench/go/src/github.com/hashicorp/terraform/__debug_bin1526299403", "-chdir=/Users/sarahfrench/tfc-test-repos/tf-manual-testing/core/pss/scratch2", "init"}
2025-12-15T16:05:13.985Z [INFO]  This build of Terraform allows using experimental features
2025-12-15T16:05:13.985Z [TRACE] Stdout is a terminal of width 133
2025-12-15T16:05:13.985Z [TRACE] Stderr is a terminal of width 133
2025-12-15T16:05:13.985Z [TRACE] Stdin is a terminal
2025-12-15T16:05:13.985Z [DEBUG] Attempting to open CLI config file: /Users/sarahfrench/.terraformrc
2025-12-15T16:05:13.985Z [INFO]  Loading CLI configuration from /Users/sarahfrench/.terraformrc
2025-12-15T16:05:13.985Z [INFO]  Loading CLI configuration from /Users/sarahfrench/.terraform.d/credentials.tfrc.json
2025-12-15T16:05:13.986Z [DEBUG] Explicit provider installation configuration is set
2025-12-15T16:05:13.986Z [TRACE] Selected provider installation method cliconfig.ProviderInstallationFilesystemMirror("/Users/sarahfrench/tf-filesystem-mirror/") with includes [registry.terraform.io/hashicorp/pss] and excludes []
2025-12-15T16:05:13.986Z [TRACE] Selected provider installation method cliconfig.ProviderInstallationDirect with includes [] and excludes [registry.terraform.io/hashicorp/pss]
2025-12-15T16:05:13.986Z [INFO]  CLI command args: []string{"init"}
*********
This is terminal output that's only present when the experiment `current` is INACTIVE.
*********
Initializing the backend...
2025-12-15T16:05:16.526Z [TRACE] Meta.Backend: no config given or present on disk, so returning nil config
2025-12-15T16:05:16.526Z [TRACE] Meta.Backend: backend has not previously been initialized in this working directory
2025-12-15T16:05:16.526Z [TRACE] Meta.Backend: using default local state only (no backend configuration, and no existing initialized backend)
2025-12-15T16:05:16.526Z [TRACE] Meta.Backend: instantiated backend of type <nil>
2025-12-15T16:05:16.526Z [DEBUG] checking for provisioner in "."
2025-12-15T16:05:16.527Z [DEBUG] checking for provisioner in "/Users/sarahfrench/go/src/github.com/hashicorp/terraform"
2025-12-15T16:05:16.527Z [TRACE] Meta.Backend: backend <nil> does not support operations, so wrapping it in a local backend
2025-12-15T16:05:16.527Z [TRACE] backend/local: state manager for workspace "default" will:
 - read initial snapshot from terraform.tfstate
 - write new snapshots to terraform.tfstate
 - create any backup at terraform.tfstate.backup
2025-12-15T16:05:16.527Z [TRACE] statemgr.Filesystem: reading initial snapshot from terraform.tfstate
2025-12-15T16:05:16.527Z [TRACE] statemgr.Filesystem: snapshot file has nil snapshot, but that's okay
2025-12-15T16:05:16.527Z [TRACE] statemgr.Filesystem: read nil snapshot
Initializing provider plugins...

╷
│ Warning: Experimental feature "current" is active
│ 
│   on main_override.tf line 2, in terraform:
│    2:   experiments = [current]
│ 
│ Experimental features are available only in alpha releases of Terraform and are subject to breaking changes or total removal in
│ later versions, based on feedback. We recommend against using experimental features in production.
│ 
│ If you have feedback on the design of this feature, please open a GitHub issue to discuss it.
│ 
│ (and one more similar warning elsewhere)
╵
Terraform has been successfully initialized!

You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.

If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
Exiting.

Expected Behavior

Given that the terminal output says Warning: Experimental feature "current" is active I'd expect the experiment to be active. It is not active.

In the branch I'm using to demonstrate this issue I added this if...else block and you would expect the terminal to include the log line that indicates the experiment is active

*********
This is terminal output that's only present when the experiment `current` is ACTIVE.
*********

Actual Behavior

Instead, the terminal output includes this:

*********
This is terminal output that's only present when the experiment `current` is INACTIVE.
*********

This shows that the warning about the active experiment is misleading, because the experiment it isn't actually affecting Terraform's behaviour at all.

Steps to Reproduce

  1. Build Terraform from this branch with experiments enabled, using go build -ldflags "-w -s -X 'main.experimentsAllowed=yes'" -o ~/go/bin/terraform-experimental
  2. Create the project using the config I shared above.
  3. Run ~/go/bin/terraform-experimental init

Additional Context

Currently when override configuration files are merged with the 'base' config the experiments list from the terraform block is ignored from all _override.tf files. This is why in my example above the current experiment doesn't cause the expected log line to be logged.

I think the reason we get the warning about Experimental feature "current" is active is because that warning is created when we parse the override file.

References

Generative AI / LLM assisted development?

no.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugnewnew issue not yet triaged

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions