Local Preview Should Support Symlinks or Explicitly Allow Them
In workflows where Terraform variable directories are symlinked from an external repo, local preview fails to render changes properly. Currently, the CLI does not follow symlinks, and ignores symlinked directories — especially when also listed in .gitignore.
As a result, developers are forced to:
Delete the symlink
Manually copy the target directory into the project
Modify
.gitignoretemporarily to allow the content to be picked up
Requested Enhancements:
Add a CLI flag such as
--follow-symlinksor--include ./pathto explicitly whitelist symlinked directoriesImprove
.gitignorehandling inlocal previewto support more flexible inclusion logic
Why It Matters:
While the impact is minor and there are workarounds, this limitation creates friction in common enterprise workflows — especially where variable sets or config fragments live in external repositories and are symlinked in. Supporting this would improve usability and encourage wider adoption of local preview.
Log in to comment and vote
Comments3
Black Breeze
Jun 19, 2025
Thank you for this feature request, Marty. We understand the friction you're experiencing when developing interdependent Terraform modules locally. After careful analysis, we've decided not to implement symlink support in local preview. Here's why:
Security & Determinism Concerns:
Following symlinks could potentially expose files outside your project directory, creating security vulnerabilities
Symlinks create non-deterministic behavior - what works on your machine may not work for teammates or in CI/CD
Most importantly, local preview is designed to accurately simulate what will happen when you push to Spacelift. Since symlinked local files won't exist in our execution environment, supporting them would create false confidence
Recommended Solution: Terraform Override Files
Terraform has a built-in mechanism designed exactly for this use case - override files. Here's how to use them:
1. Create an
override.tffile in your working directory:# override.tf - for local development only module "my_module" { source = "../path/to/local/module" }2. Add
override.tfto your.gitignoreto prevent committing local-only configuration3. Run
spacelift local-previewnormally - it will use your local module source4. When done with local development, simply delete the override.tf file
Example workflow:
# Start local development echo 'module "my_module" { source = "../modules/my-module" }' > override.tf # Test with local preview spacelift local-preview # Clean up when done rm override.tfThis approach:
Works today without any changes needed
Uses Terraform's native functionality
Maintains clear separation between local development and production configuration
Ensures your local preview accurately represents what will run in Spacelift
We believe this pattern provides the rapid iteration you need while maintaining the security and reliability that Spacelift promises. Would this workflow address your local development needs?
Black Breeze
Jun 6, 2025
Hi Marty! Thanks for the detailed request. I'd love to understand your workflow better to make sure we're solving the right problem.
Why symlinks specifically? What's driving you to symlink variable directories from external repos rather than using other patterns like:
Security concern: Following symlinks could potentially expose files outside your intended directory structure. Are you comfortable with that risk?
The real job: It sounds like you're trying to share configuration across multiple repos/stacks. Is that the core problem we should solve, rather than symlink support specifically?
Understanding your setup will help us find the best solution!
Aqua Toast
Jun 12, 2025
these are from local runs, we keep our variables in a separate repo so we can promote config changes without promoting terraform changes, things like changing a resource instance class, whitelisting an ip, toggling on some feature, etc…
we used to keep these in the same repo as our terraform code but had to do hotfixes to make simple configuration changes - we pulled these vars out into their own repo to simplify this and the easiest way to continue to perform local terraform options while using these vars was to create a softlink to them - in our spacelift containers this “oc-stacks” (vars) repo is just checked out so the code expects it to be in that location, but locally we do not want to have this repo buried in another repo directory
I don’t know what “spacelift context for shared variables” is but for local runs I’m doing nothing spacelift, I’m running atmos/terraform commands - then when I am ready I want to do a local-preview for whatever reason and I then have to do the hoop jumping to ensure I have updated vars - if my particular project doesn’t have config changes (updated/new/removed) then this is a non-issue as the local-preview checks out the oc-stacks repo if it is not present, but when I am testing something with a config change I run into this
just yesterday I was trying to understand why some local test/run (non-spacelift related) was not working and realized I had removed the symlink and manually copied in the oc-stacks directory to make local preview work days earlier, and so the repo I was making changes in was not being seen by the local code because it was not symlinked