Skip to main content

Allow Module Sharing within the same Spacelift Account

Currently, we use spaces extensively to organize our stacks and modules. Unforuntaely, that means that if we want to use a module in our Space hierarchy, it needs to sit at the root. Given that you can share modules with other Spacelift accounts, I think there should be an option to share a module with the account that it lives in (or share to a higher-level space), to allow modules to live at a lower Space in the hierarchy.

Workaround
Problem
Status: ✅ Completed5 comments

Log in to comment and vote

Comments5

  • Natalia Gazda

    Team•

    May 27, 2025

    Thanks for the feedback! We understand the problem - currently you have to put modules at the root Space to make them available across your hierarchy, which forces you to give broader permissions than you'd prefer. We're exploring a solution where you could explicitly share modules with specific Spaces. Once shared to a Space, the module would be inherited by its children following the normal Space inheritance behavior (the same way policies and contexts work today). So if you share a module from Space A to Space B, then Space B and all of its child Spaces would be able to use that module - but Space A's sibling Spaces wouldn't see it unless explicitly shared with them too. Would this approach solve your use case?
    • Indigo Stew

      •

      May 28, 2025

      yes this would satisfy the use case.

    • Indigo Stew

      •

      Jun 16, 2025

      @Natalia Gazda what is the ETA of this feature?

      • Natalia Gazda

        Team•

        Aug 1, 2025

        We just started, and it should take us around a month :)

    • Silver Pretzel

      •

      Jun 23, 2025

      I think that explicit sharing would only work if there is a reasonable way to to automate it in terraform - something like an attach resource (spacelift_attach_module_to_space) - the problem with that is that every module needs to know how to attach to every team space

      I think that as long as there is a way to specify the attachment using module_id and space_id, I could make it work with depends_on between the team module module and the team space module, setting module_id on an ouput and them adding the spacelift_attach_module_to_space when I create the spaces.

      This works because at least for now, the modules and spaces are created in the same tfstate (which may not be the case forever). If we wanted to move things into separate stacks, we would need a data resource that can retrieve the module id or every module

      Why not just have a setting to mark modules as consumable by all spaces?