terraform-provider-spacelift icon indicating copy to clipboard operation
terraform-provider-spacelift copied to clipboard

Error "could not update space: unauthorized - is it an administrative stack in the root space?"

Open nitrocode opened this issue 2 years ago • 1 comments

From this terraform plan change within an admin stack run

  # module.spacelift.module.stacks["gbl-corp-infrastructure-snip"].spacelift_space.default[0] will be updated in-place
  ~ resource "spacelift_space" "default" {
        id               = "infrastructure-snip"
      ~ labels           = [
          - "deps:stacks/orgs/snip/mgmt/_defaults.yaml",
            # (8 unchanged elements hidden)
        ]
        name             = "infrastructure-snip"
        # (2 unchanged attributes hidden)
    }

We receive this error when trying to update a spacelift_space in terraform.

╷
│ Error: could not update space: unauthorized - is it an administrative stack in the root space?
│ 
│   with module.spacelift.module.stacks["gbl-corp-infrastructure-snip"].spacelift_space.default[0],
│   on .terraform/modules/spacelift/modules/stack/main.tf line 221, in resource "spacelift_space" "default":
│  221: resource "spacelift_space" "default" {
│ 

The spacelift space was created by terraform but it cannot be modified with terraform. I'm unsure if this is a spacelift terraform issue or a spacelift API issue, or maybe even a permissions issue.

The spacelift space is called flex and it's part of the infrastructure space which inherits from the root space.

The workaround was to no-op the terraform by clickops'ing the change within Spacelift.

references

  • https://registry.terraform.io/providers/spacelift-io/spacelift/latest/docs/resources/space

nitrocode avatar Feb 03 '23 21:02 nitrocode