spacelift-io / terraform-starter

Starter repository to play with Spacelift
MIT License
36 stars 94 forks source link

Stack is currently failing with the Getting Started documentation #14

Closed vcatalano closed 3 weeks ago

vcatalano commented 3 years ago

Going through the Getting Started documentation (https://docs.spacelift.io/getting-started) using this forked stack, I'm getting a failure with running the latest from the branch.

[01FEZWMYZTKAJ8DV3Y993YD9GH] Running 0 custom hooks... [01FEZWMYZTKAJ8DV3Y993YD9GH] Applying changes... 2021/09/20 23:59:14 [DEBUG] GET https://app.spacelift.io/state/testing-out-spacelift spacelift_policy.plan: Creating... spacelift_policy.access: Creating... spacelift_context.managed: Creating... spacelift_policy.login: Creating... spacelift_policy.push: Creating... spacelift_stack.managed: Creating... spacelift_policy.task: Creating... spacelift_policy.trigger: Creating... 2021/09/20 23:59:16 [DEBUG] POST https://app.spacelift.io/state/testing-out-spacelift ╷ │ Error: could not create context: unauthorized - is it an administrative stack? │ │ on context.tf line 7, in resource "spacelift_context" "managed": │ 7: resource "spacelift_context" "managed" { │ ╵ ╷ │ Error: could not create policy All of Engineering gets read access: unauthorized - is it an administrative stack? │ │ on policies.tf line 9, in resource "spacelift_policy" "acceass": │ 9: resource "spacelift_policy" "access" { │ ╵ ╷ │ Error: could not create policy Enforce password strength: unauthorized - is it an administrative stack? │ │ on policies.tf line 30, in resource "spacelift_policy" "plan": │ 30: resource "spacelift_policy" "plan" { │ ╵ ╷ │ Error: could not create policy Ignore commits outside the project root: unauthorized - is it an administrative stack? │ │ on policies.tf line 53, in resource "spacelift_policy" "push": │ 53: resource "spacelift_policy" "push" { │ ╵ ╷ │ Error: could not create policy Allow only safe commands: unauthorized - is it an administrative stack? │ │ on policies.tf line 73, in resource "spacelift_policy" "task": │ 73: resource "spacelift_policy" "task" { │ ╵ ╷ │ Error: could not create policy Trigger stacks that declare an explicit dependency: unauthorized - is it an administrative stack? │ │ on policies.tf line 94, in resource "spacelift_policy" "trigger": │ 94: resource "spacelift_policy" "trigger" { │ ╵ ╷ │ Error: could not create policy DevOps are admins: unauthorized - is it an administrative stack? │ │ on policies.tf line 125, in resource "spacelift_policy" "login": │ 125: resource "spacelift_policy" "login" { │ ╵ ╷ │ Error: could not create stack: unauthorized - is it an administrative stack? │ │ on stack.tf line 3, in resource "spacelift_stack" "managed": │ 3: resource "spacelift_stack" "managed" { │ ╵ [01FEZWMYZTKAJ8DV3Y993YD9GH] Unexpected exit code when applying changes: 1 [01FEZWMYZTKAJ8DV3Y993YD9GH] Uploading the list of managed resources... 2021/09/20 23:59:16 [DEBUG] GET https://app.spacelift.io/state/testing-out-spacelift 2021/09/20 23:59:17 [DEBUG] GET https://app.spacelift.io/state/testing-out-spacelift 2021/09/20 23:59:17 [DEBUG] GET https://app.spacelift.io/state/testing-out-spacelift [01FEZWMYZTKAJ8DV3Y993YD9GH] Resource list upload is GO

jmfontaine commented 2 years ago

Hi @vcatalano,

I am very sorry for the late reply. 😞

Are you still running into this issue? If so, I can help you.

Thanks.

marcinwyszynski commented 2 years ago

You need to mark your first stack as administrative.

alexfornuto commented 1 year ago

You need to mark your first stack as administrative.

Well it's a year later and https://docs.spacelift.io/getting-started still doesn't indicate that, it says:

Leave the default options checked for Define Behavior and click Continue. image

It's always fun trying to guess which instructions will be more up-to-date; the docs site or the repo README.

alexfornuto commented 1 year ago

For the next person:

  1. From the Stacks view, hover over the Terraform Starter stack to show the edit icon and click on it.
  2. Go to the Behavior tab to switch to Administrative. Click SAVE then try again.

Of course, when I ran again I got:

Sorry, it looks like you don't have permission to see this page. Please reach out to one of your friendly account admins to grant you access. You can also try going back to the home page.

After logging out and back in I reviewed the logs from the second attempt:

Error: could not create context: could not persist context: context with this slug already exists for this account
│ 
│   with spacelift_context.managed,
│   on context.tf line 7, in resource "spacelift_context" "managed":
│    7: resource "spacelift_context" "managed" {
│ 
╵
╷
│ Error: could not create policy All of Engineering gets read access: could not persist policy: policy with this slug already exists for this account
│ 
│   with spacelift_policy.access,
│   on policies.tf line 9, in resource "spacelift_policy" "access":
│    9: resource "spacelift_policy" "access" {
│ 
╵
╷
│ Error: could not create policy Enforce password strength: could not persist policy: policy with this slug already exists for this account
│ 
│   with spacelift_policy.plan,
│   on policies.tf line 30, in resource "spacelift_policy" "plan":
│   30: resource "spacelift_policy" "plan" {
│ 
╵
╷
│ Error: could not create policy Ignore commits outside the project root: could not persist policy: policy with this slug already exists for this account
│ 
│   with spacelift_policy.push,
│   on policies.tf line 53, in resource "spacelift_policy" "push":
│   53: resource "spacelift_policy" "push" {
│ 
╵
╷
│ Error: could not create policy Allow only safe commands: could not persist policy: policy with this slug already exists for this account
│ 
│   with spacelift_policy.task,
│   on policies.tf line 73, in resource "spacelift_policy" "task":
│   73: resource "spacelift_policy" "task" {
│ 
╵
[UUID] Unexpected exit code when applying changes: 1

Edit: P.S., I ended up deleting the stack, including running the suggested terraform destroy as a one-off task. After re-creating the stack and triggering it, I'm still getting the permissions error. After log-cycling I'm getting the same log output on my failed run.

michieldewilde commented 1 year ago

Are you doing these steps in a fresh account (no other stacks, policies, or contexts)?

alexfornuto commented 1 year ago

Are you doing these steps in a fresh account (no other stacks, policies, or contexts)?

Yes.

cloudnost commented 1 month ago

it's fucking amazing to me that a bullshit example cannot even work... sad state for tech... maybe AI does stand a chance?

alexfornuto commented 4 weeks ago

3 year old issue, 1 year since the last commit... FYI Spacelift this are the kind of things your potential users consider when choosing services.

jmfontaine commented 4 weeks ago

@alexfornuto @cloudnost I am sorry for dropping the ball here. 😞

I agree that this example should always be up-to-date. We have assigned this task to an engineer.

Thanks for the reminder!

Apollorion commented 3 weeks ago

Hello all, thanks for opening this issue and apologies for the slow response on our end. We've updated this repository and the getting started page on our documentation so none of the problems listed in this issue should be happening anymore. Please open up further issues if you come across something in the future.