Sunday, August 21, 2022

[FIXED] How to use parameter from Gitlab in AWS CDK?

Issue

I am using AWS CDK and want to use parameters stored in Gitlab as variables in CDK build.

Someone tried something like this?


Solution

Solutions found:

  1. Create custom variable in Gitlab (with the same repository as project) in two ways:

    • In pipeline file with project (not sensitive data)

    • In project properties in Gitlab (recomended solution if want to store sensitive params as credentials - those parameters should not be stored with project in file)

  2. Declare custom env in main CDK file (e.x. const CUSTOM_ENV = ${CUSTOM_ENV})

  3. Call cdk deploy with created parameter e.g. cdk deploy $CUSTOM_ENV and the variable will be automatically delivered by Gitlab.

More details how to declare variables - Gitlab docs



Answered By - CeZet
Answer Checked By - Candace Johnson (PHPFixing Volunteer)

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.