Skip to main content

Add template data sources to Terraform provider

Add data sources for working with templates in the Terraform provider, such as spacelift_templates to list templates and spacelift_template_version_by_name to resolve a version by name (for example 1.0.0).

Workaround
None
Problem
Status: 🔭 Discovery2 comments

Log in to comment and vote

Comments2

  • Magenta Spaghetti

    •

    Apr 8

    Hi, thanks for the follow-up, happy to clarify.

    1. We currently have two main workflows where this becomes an issue.

      • First, when deploying templates from admin stacks. This requires a version ID, which isn’t human-readable. In practice, users typically know the version number they want, but not the corresponding ID, and they may not have UI access to look it up.

      • Second, when using intent-based workflows. Here, users naturally think in terms of “deploy version X of template Y”, but this breaks down because:
        a) there’s no straightforward way to list available templates, or resolve template IDs by name, and
        b) there’s no way to resolve a version ID from a known template name and version number.

    2. What we’re trying to achieve is the ability to reference templates and versions using human-readable identifiers (name + version), rather than opaque IDs, so this can be automated cleanly across both Terraform and intent-based workflows.

    3. We’ve looked at using the API directly, but it doesn’t fit well in practice. It can’t be used within intent workflows, and when used alongside Terraform it introduces extra complexity and glue logic just to resolve IDs, which feels like something the platform could handle natively.

    Hopefully that gives a clearer picture of the pain points.

  • Aleksandra Cieslak

    Team•

    Apr 8

    Hi! Thanks for submitting this request. We'd love to understand your use case better before we dive in.

    1. How does your current stack creation workflow look like? Are you creating stacks through the Terraform provider, the UI, the API, or some internal automation?

    2. What are you specifically trying to automate or achieve that you can't do today? For example: "We want a single Terraform module that creates a stack and automatically picks the latest version of our corporate template."

    3. Have you tried using the API directly for this? If so, what didn't work for you?

    This will really help us understand the real pain point and make sure we build the right thing. Thanks!