How to set environment variable for ggv2 components

0

Hi there,

I have tried

RecipeFormatVersion: '2020-01-25'
ComponentName: "{COMPONENT_NAME}"
ComponentVersion: "{COMPONENT_VERSION}"
ComponentDescription: ''
ComponentPublisher: "{COMPONENT_AUTHOR}"

ComponentConfiguration:
  DefaultConfiguration:
    secretArn: 'no_secret'

Manifests:
- Platform:
    os: linux
  Artifacts:
    - URI: s3://BUCKET_NAME/COMPONENT_NAME/COMPONENT_VERSION/secret_loader.zip
      Unarchive: ZIP
  Lifecycle:
    Setenv: SECRET_ARN={configuration:/secretArn}
    Install: python3 -m pip install --user -r {artifacts:decompressedPath}/secret_loader/requirements.txt
    Run: |
      export SECRET_ARN={configuration:/secretArn}
      python3 -u {artifacts:decompressedPath}/secret_loader/main.py

but still the component cant get the variable: SECRET_ARN=os.getenv('SECRET_ARN')

asked 2 years ago293 views
1 Answer
1
Accepted Answer

Hi. Instead of SECRET_ARN={configuration:/secretArn} I think the Setenv syntax should be SECRET_ARN: "{configuration:/secretArn}".

Alternatively, you could pass the secret as an argument:

python3 -u {artifacts:decompressedPath}/secret_loader/main.py {configuration:/secretArn}
profile pictureAWS
EXPERT
Greg_B
answered 2 years ago
profile picture
EXPERT
reviewed 24 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions