Answers: <p>Check if the caller stack is set to Administrative.</p>
  
Answers: CC BY-SA 4.0
Answers: 2024-01-02T08:27:26.900Z
Answers: 2024-01-02T19:15:07.923Z
Answers: 2024-01-02T19:15:07.923Z
Answers: ShadowMan
Body: <p>I am trying to use Spacelift's external state access however I get the following error:</p>
  <pre><code>Error: Error loading state error 
  │
  │ with module.service.data.terraform_remote_state.environment, 
  │ on ../modules/service/ecs.tf line 79, in data &quot;terraform_remote_state&quot; &quot;environment&quot;: 
  │ 79: backend = &quot;remote&quot; 
  │ 
  │ error loading the remote state: Error creating workspace test-stack: cannot 
  │ create a workspace
  </code></pre>
  <p>My block looks like:</p>
  <pre><code> data &quot;terraform_remote_state&quot; &quot;environment&quot; {
    backend = &quot;remote&quot;
  
    config = {
      hostname     = &quot;spacelift.io&quot;
      organization = &quot;&lt;organizationname&gt;&quot;
  
      workspaces = {
        name = &quot;test-stack&quot;
      }
    }
  }
  </code></pre>
  <p>I have external state access enabled on the stack but still get this error.</p>
  
Tags: <terraform><continuous-integration><cicd><spacelift>
Title: Spacelift - external state access - cannot create a workspace error
UserDisplayName: Danielle Murphy
ThreadText: # Spacelift - external state access - cannot create a workspace error
  
  (Asked by: username_0 on 2023-12-07)
  
  I am trying to use Spacelift's external state access however I get the following error:
  
  ```
  Error: Error loading state error 
  │
  │ with module.service.data.terraform_remote_state.environment, 
  │ on ../modules/service/ecs.tf line 79, in data "terraform_remote_state" "environment": 
  │ 79: backend = "remote" 
  │ 
  │ error loading the remote state: Error creating workspace test-stack: cannot 
  │ create a workspace
  
  ```
  
  My block looks like:
  
  ```
   data "terraform_remote_state" "environment" {
    backend = "remote"
  
    config = {
      hostname     = "spacelift.io"
      organization = "<organizationname>"
  
      workspaces = {
        name = "test-stack"
      }
    }
  }
  
  ```
  
  I have external state access enabled on the stack but still get this error.
  
  **Tags:** terraform, continuous-integration, cicd, spacelift
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2024-01-02. Score: 1 | Accepted answer
  
  Check if the caller stack is set to Administrative.
  
  
  ---
  
  