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')

질문됨 2년 전304회 조회
1개 답변
1
수락된 답변

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
전문가
Greg_B
답변함 2년 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠