Open sashee opened 1 year ago
hey @sashee , for somethinig like this, how would you want to define the env variables? would you want to do this as a configuration on the AppSync API, or on a specific resolver?
Hey @onlybakam , that's a great question and I haven't thought about it.
Probably adding it to individual resolvers gives the greatest flexibility and I don't see many use-cases when API-wide variables are better. When I need to inject something from the environment it is usually because of the Transact*Items DDB calls need the table names but even these are rare (maybe ~10% of all resolvers). So overall both would work.
When a script needs some information about other resources, the primary way is to use environment variables. For example, I have this Terraform script:
The
TransactWriteItems
needs the table name which is part of the environment. Currently, the only choice is string concatenation or templating (table: "${aws_dynamodb_table.user.name}",
) but there could be a separate block for these values that are available under theprocess.env
, similarly to how Lambda functions work.