Skip to content

Add flag to dereference symlinks in coder templates push #19310

@blink-so

Description

@blink-so

Problem

Currently, coder templates push doesn't follow symlinks when creating template archives. This makes it difficult to share common files (like modules.tf and ides.tf) between multiple templates in a monorepo while keeping templates self-contained and functional offline.

Proposed Solution

Add an optional flag (e.g., --dereference-symlinks or --follow-symlinks) to coder templates push that would:

  • Follow symlinks and include the actual file contents in the template archive
  • Allow templates to share common files via symlinks while remaining standalone
  • Be opt-in to avoid breaking existing workflows

Use Case

This would enable template authors to:

  1. Create symlinks to shared files in template directories
  2. Use the flag to push templates with dereferenced symlinks
  3. Maintain template portability without requiring module dependencies

Security Considerations

  • Should be opt-in only to avoid mistakes
  • Consider validation to prevent following symlinks outside the template directory

Alternative Workarounds

  • Hard links (but Git doesn't track them)
  • Build scripts to copy files (adds a build step, and makes it more annoying/misleading to contribute)
  • Custom tar creation with coder templates push -d - (kinda sucks)

Issue by @phorcys420

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions