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

Add support for custom prefixing of JSON parsed secrets #1

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

jromero-pg
Copy link

@jromero-pg jromero-pg commented Feb 7, 2023


NOTE:

This change is intended to be contributed upstream.


Summary

Add support for custom prefixing of JSON-parsed secrets.

In our particular case, we needed to disable prefixing. This was achieved by implementing custom prefixing and supporting "empty" prefixes.

Details

From the updated README:


Example 4: Parsed JSON in secret with custom prefix

The following example creates environment variables by parsing the JSON in the secret and prefixes them based on provided prefix.

- name: Get Secrets by Name and by ARN
  uses: aws-actions/aws-secretsmanager-get-secrets@v1
  with:
    secret-ids: |
      CUSTOM,test/secret
    parse-json-secrets: true

The secret test/secret has the following secret value.

{
  "api_user": "user",
  "api_key": "key",
  "config": {
    "active": "true"
  }
}

Environment variables created:

CUSTOM_API_USER: "user"
CUSTOM_API_KEY: "key"
CUSTOM_CONFIG_ACTIVE: "true"

Pro-tip: It's possible remove prefixes by providing an "empty" prefix:

- name: Get Secrets by Name and by ARN
  uses: aws-actions/aws-secretsmanager-get-secrets@v1
  with:
    secret-ids: |
      ,test/secret
    parse-json-secrets: true

@jromero-pg jromero-pg changed the title Add support for custom prefixing of JSON parsed secrets (DO NOT MERGE): Add support for custom prefixing of JSON parsed secrets Feb 8, 2023
@jromero-pg jromero-pg changed the title (DO NOT MERGE): Add support for custom prefixing of JSON parsed secrets (DO NOT MERGE) Add support for custom prefixing of JSON parsed secrets Feb 8, 2023
@jromero-pg jromero-pg changed the base branch from main to paragon February 8, 2023 20:27
@jromero-pg jromero-pg changed the title (DO NOT MERGE) Add support for custom prefixing of JSON parsed secrets Add support for custom prefixing of JSON parsed secrets Feb 8, 2023
@jromero-pg jromero-pg marked this pull request as ready for review February 8, 2023 20:27
Copy link

@tedparagon tedparagon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@jromero-pg jromero-pg merged commit 055e320 into paragon Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants