Merge Multiple Files

Action ID: hcl:merge:files
NPM Package:

@seatgeek/backstage-plugin-scaffolder-backend-module-hcl

Description

Merges multiple files into a single output for streamlined management and organization.

Input Schema

PropertyTypeDescriptionRequired
optionsany-
aSourcePathstringThe path to the HCL file to be merged
bSourcePathstringThe path to the HCL file to be merged

Output Schema

PropertyTypeDescriptionRequired
hclstring-

Usage Examples

I don’t have the input/output schema for hcl:merge:files. To produce technically accurate and useful examples, I need the action’s parameters and their types.

If you can share the schema (or even a short description of required fields and common options), I’ll provide two concrete, realistic examples that fit typical scaffolding workflows.

In the meantime, here’s the minimal template structure showing where the action would fit in a typical flow. Replace the input with the correct fields once available.

Merge Terraform module files into a single main.tf

This example would merge multiple Terraform module snippets into one file after fetching a template and before committing to a repo.

Copy
steps:
  - id: fetch-base
    action: fetch:template
    input:
      url: ./skeleton
      targetPath: .
      values:
        name: ${{ parameters.name }}
        owner: ${{ parameters.owner }}

  - id: merge-hcl
    action: hcl:merge:files
    input:
      # Replace with the real inputs of hcl:merge:files
      # e.g. sources, target, strategy, etc.
      # Example placeholders:
      sources:
        - path: terraform/base/main.tf
        - path: terraform/modules/${{ parameters.module }}/main.tf
      target: terraform/main.tf

  - id: publish
    action: publish:github
    input:
      repoUrl: ${{ parameters.repoUrl }}
      defaultBranch: main
      description: Terraform stack for ${{ parameters.name }}

Merge env-specific overrides into base variables.tf

This example would combine environment overrides into a base variables file before publishing.

Copy
steps:
  - id: fetch-template
    action: fetch:template
    input:
      url: ./template
      targetPath: .
      values:
        serviceName: ${{ parameters.serviceName }}
        environment: ${{ parameters.environment }}

  - id: merge-hcl-overrides
    action: hcl:merge:files
    input:
      # Replace with the real inputs of hcl:merge:files
      # Example placeholders:
      sources:
        - path: terraform/vars/base.tfvars
        - path: terraform/vars/${{ parameters.environment }}.tfvars
      target: terraform/vars/combined.tfvars

  - id: publish
    action: publish:gitlab
    input:
      repoUrl: ${{ parameters.repoUrl }}
      defaultBranch: main
      description: ${{ parameters.serviceName }} infra

Share the hcl:merge:files schema and I’ll replace the placeholders with the exact parameters and add options that demonstrate the action’s capabilities.