Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Zarf Variable to be the contents of a file #1372

Closed
runyontr opened this issue Feb 18, 2023 · 0 comments · Fixed by #1906
Closed

Allow Zarf Variable to be the contents of a file #1372

runyontr opened this issue Feb 18, 2023 · 0 comments · Fixed by #1906
Labels
enhancement ✨ New feature or request

Comments

@runyontr
Copy link
Contributor

runyontr commented Feb 18, 2023

Is your feature request related to a problem? Please describe.

Some deploy time configurations naturally live as files: TLS certs, credentials, etc. it would be easier to be able to point to files on disk than need to move them into the zarf.toml file and risk formatting them incorrectly.

e.g. for a BigBang deployment:

istio:
  gateways:
    public:
      tls:
        key: ###ZARF_VAR_TLS_KEY_CONTENTS###
        cert: ###ZARF_VAR_TLS_CERT_CONTENTS###

There could be a new property in the variable definition that specifies it as a filepath location and not a literal:

variables:
  - name: TLS_KEY_CONTENTS
    default: "privkey.pem"
    prompt: false
    type: file # defaults to literal
  - name: TLS_CERT_CONTENTS
    default: "fullchain.pem"
    prompt: false
    type: file # defaults to literal

This could be tackled with the actions (see below), but seems more complicated for a package dev for repeatedly using file contents as variables.

variables:
  - name: TLS_KEY_FILE
    default: "privkey.pem"
    prompt: false
  - name: TLS_CERT_FILE
    default: "fullchain.pem"
    prompt: false
components:
- actions:
    onDeploy:
      before:
      - cmd: cat "###ZARF_VAR_TLS_KEY###"
        setVariable: TLS_KEY_CONTENTS
      - cmd: cat "###ZARF_VAR_TLS_CERT###"
        setVariable: TLS_CERT_CONTENTS

which could now be used as above to contain the contents of the filename provided

@github-project-automation github-project-automation bot moved this to New Requests in Zarf Project Board Feb 18, 2023
@Racer159 Racer159 added the enhancement ✨ New feature or request label Mar 21, 2023
Racer159 added a commit that referenced this issue Jul 19, 2023
## Description

This allows Zarf variables to be filepaths to be loaded on templating
(without exceeding env var size limits) - similar to
https://docs.gitlab.com/ee/ci/variables/#use-file-type-cicd-variables

## Related Issue

Fixes #1372
Fixes #1852

## Type of change

- [ ] Bug fix (non-breaking change which fixes an issue)
- [X] New feature (non-breaking change which adds functionality)
- [ ] Other (security config, docs update, etc)

## Checklist before merging

- [ ] Test, docs, adr added or updated as needed
- [X] [Contributor Guide
Steps](https://github.com/defenseunicorns/zarf/blob/main/CONTRIBUTING.md#developer-workflow)
followed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants