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

💡 [REQUEST] - Richer record type for env vars #201

Open
l50 opened this issue Jul 24, 2023 · 0 comments
Open

💡 [REQUEST] - Richer record type for env vars #201

l50 opened this issue Jul 24, 2023 · 0 comments
Assignees
Labels
question Clarification and/or additional information required to move forward

Comments

@l50
Copy link
Contributor

l50 commented Jul 24, 2023

Implementation PR

No response

Reference Issues

No response

Summary

Make top level TTP env vars work like args (default values, required values, etc.)

If you don't say key: whatever, then it functions as a "the user must set this to a non-empty value" declaration.

Conditional passing (pass this OR that)

Basic Example

The solution should make these steps irrelevant:

steps:
  - name: ensure-aws-creds-present
    inline: |
      set -e
      if [[ -z "${AWS_DEFAULT_REGION}" ]]; then
        echo "AWS_DEFAULT_REGION must be set."
        exit 1
      fi
      if [[ -n "${AWS_ACCESS_KEY_ID}" && -n "${AWS_SECRET_ACCESS_KEY}" ]]; then
        if [[ -z "${AWS_SESSION_TOKEN}" ]]; then
          echo "AWS_SESSION_TOKEN must be set when using AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY."
          exit 1
        fi
      elif [[ -z "${AWS_PROFILE}" ]]; then
        echo "Either AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, and AWS_SESSION_TOKEN, or AWS_PROFILE must be set."
        exit 1
      fi

  - name: ensure-aws-cli-present
    inline: |
      set -e
      if ! [[ -x "$(command -v aws)" ]]; then
        echo 'Error: AWS CLI is not installed.' >&2
      else
        echo -e "AWS CLI is installed: $(aws --version)"
      fi

Drawbacks

No response

Unresolved questions

No response

@l50 l50 added the question Clarification and/or additional information required to move forward label Jul 24, 2023
@l50 l50 added the BSides label Aug 1, 2023
@l50 l50 removed the BSides label Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Clarification and/or additional information required to move forward
Projects
None yet
Development

No branches or pull requests

2 participants