spacelift-io / terraform-provider-spacelift

Terraform provider to interact with Spacelift
MIT License
76 stars 29 forks source link

Error: Unexpected token issuer api-key, is this a Spacelift run? #283

Closed nitrocode closed 2 years ago

nitrocode commented 2 years ago

I tried running a spacelift terraform module locally.

I have this in my hcl which works in spacelift

provider "spacelift" {}

Locally, I set the following inputs

export SPACELIFT_API_KEY_ENDPOINT=https://snip.app.spacelift.io
export SPACELIFT_API_KEY_ID=snip
export SPACELIFT_API_KEY_SECRET=snip

I get the following error when I do a terraform init && terraform plan

 Error: unexpected token issuer api-key, is this a Spacelift run?
│
│   with module.spacelift.data.spacelift_current_stack.administrative[0],
│   on .terraform/modules/spacelift/main.tf line 167, in data "spacelift_current_stack" "administrative":
│  167: data "spacelift_current_stack" "administrative" {

Followed this guide https://registry.terraform.io/providers/spacelift-io/spacelift/latest/docs#running-outside-of-spacelift

michieldewilde commented 2 years ago

Hi.

You are using the spacelift_current_stack resource which requires that the run is executed within Spacelift by a stack or a module.

I hope that this response helped you.

nitrocode commented 2 years ago

Oh I see, thank you!