Skip to content

mycodeself/spacelift-atmos-test

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Spacelift + atmos test

Pre-requirements:

  • Move atmos.yaml config file to ~/.atmos/atmos.yaml
  • Set ATMOS_BASE_PATH to repo root export ATMOS_BASE_PATH=$(pwd)

Steps:

  1. Apply spaces with atmos terraform apply spaces -s root-gbl-spacelift

Apply complete! Resources: 9 added, 0 changed, 0 destroyed.

Policies + Spaces created in spacelfit successfuly (plat and core)

  1. Apply root admin stack atmos terraform apply admin-stack -s root-gbl-spacelift

Fails at plan:

Could not find the component 'spacelift/spaces' in the stack 'root-gbl-root'. │ Check that all the context variables are correctly defined in the stack manifests. │ Are the component and stack names correct? Did you forget an import? │ │ with module.spaces.data.utils_component_config.config[0], │ on .terraform/modules/spaces/modules/remote-state/main.tf line 1, in data "utils_component_config" "config": │ 1: data "utils_component_config" "config" { │

  • Change the spacelift_spaces_stage_name from root to spacelift in the stacks/catalog/spacelift/admin-stack.yaml solves the problem of looking for the component in the wrong stack root-gbl-root

  • Rename the atmos component of the spacelift spaces from spaces to spacelift/spaces in stacks/catalog/spacelift/spaces.yaml. To solve the error that the component spacelift/spaces doesn't exists.

2.1. Trying to apply the root admin stack again after applying both fixes:

Fails at plan:

╷ │ Error: Invalid index │ │ on root-admin-stack.tf line 108, in resource "spacelift_policy_attachment" "root": │ 108: policy_id = local.policies[each.key] │ ├──────────────── │ │ each.key is "TRIGGER Global administrator" │ │ local.policies is object with 7 attributes │ │ The given key does not identify an element in this collection value. ╵

  • Replace the root_stack_policy_attachments in orgs/acme/spacelift.yaml from [TRIGGER Global administrator] to [] (empty array)

2.2. Run the apply of the admin stack again

Apply complete! Resources: 27 added, 0 changed, 0 destroyed.

Following stacks where created in spacelift:

  • root-gbl-spacelift-admin-stack
  • root-gbl-spacelift-spacelift-spaces
  • core-gbl-spacelift-admin-stack
  • plat-gbl-spacelift-admin-stack
  1. Apply tenant-specific spaces atmos terraform apply admin-stack -s core-gbl-spacelift

Fails at plan:

╷ │ Error: │ Could not find the component 'spacelift/spaces' in the stack 'core-gbl-spacelift'. │ Check that all the context variables are correctly defined in the stack manifests. │ Are the component and stack names correct? Did you forget an import? │ │ │ with module.spaces.data.utils_component_config.config[0], │ on .terraform/modules/spaces/modules/remote-state/main.tf line 1, in data "utils_component_config" "config": │ 1: data "utils_component_config" "config" { │

  • Add the import to the tenant-specific of the spaces component catalog/spacelift/spaces

Fails at apply time:

╷ │ Error: could not create stack: could not persist the stack: stack/module with this slug already exists for this account │ │ with module.child_stack["core-gbl-spacelift-admin-stack"].spacelift_stack.this[0], │ on .terraform/modules/child_stack/modules/spacelift-stack/main.tf line 18, in resource "spacelift_stack" "this": │ 18: resource "spacelift_stack" "this" { │

... To be continued ...

References:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors