Skip to content

!terraform.state not aligned with terraform behavior when workspaces are disabled #1920

Closed

Description

@leoagueci

Describe the Bug

With terraform workspaces disabled, when the function tries to read the remote state from the S3 bucket, it looks in the wrong path, specifically at <workspace_key_prefix>/default/<backend_key> while terraform is storing the state at the path <backend_key> .

Expected Behavior

The function should not append either the workspace_key_prefix or the workspace name so that its behavior aligns with Terraform.

Steps to Reproduce

  • Disable terraform workspaces
  • Use !terraform.state function

Screenshots

No response

Environment

No response

Additional Context

No response

Activity

  1. added
    bug
    on Dec 29, 2025
  2. coderabbitai commented on Dec 29, 2025

    @coderabbitai
    Contributor

    📝 CodeRabbit Plan Mode

    Generate an implementation plan and prompts that you can use with your favorite coding agent.

    • Create Plan
    Examples

    🔗 Related PRs

    #1268 - fix: Don't use terraform workspace in terraform.output when backend is http [merged]

    👤 Suggested Assignees

    🧪 Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions