terraform-cdk icon indicating copy to clipboard operation
terraform-cdk copied to clipboard

Specifying context values in the CDKTF CLI

Open lucasvieirasilva opened this issue 1 year ago • 4 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Description

This feature is about adding the CLI option --context or -c to pass runtime context values to your CDK app, like in the AWS CDK.

This feature can be helpful in providing runtime values to the CDK app using a CLI format, currently, the only way is using environment variables.

References

lucasvieirasilva avatar Aug 11 '22 20:08 lucasvieirasilva

#347 has some additional thoughts on this topic.

jsteinich avatar Aug 12 '22 01:08 jsteinich

One can use a workaround by passing your context values in as environment variables and read them from your CDKTF program. I think one can also put them in the cdktf.json's context section, right @jsteinich ?

DanielMSchmidt avatar Aug 12 '22 11:08 DanielMSchmidt

One can use a workaround by passing your context values in as environment variables and read them from your CDKTF program. I think one can also put them in the cdktf.json's context section, right @jsteinich ?

Yes, if you add in the cdktf.json you cannot change at runtime like you can in the AWS CDK by passing the --context var1=value1.

Regarding the values as environment variables, I'm already doing that.

lucasvieirasilva avatar Aug 12 '22 12:08 lucasvieirasilva

This is essential for maintaining multi-environment stacks, please integrate this functionality

jamrod avatar Dec 21 '23 16:12 jamrod