I want to control some shared/non-environment spec...
# general
f
I want to control some shared/non-environment specific resources like the GitHub repo and rules, and also control some environment specific resources. The most sensible to me seems to use different projects. so I will have
foo-env
and
foo-shared
- but I want to get data from foo-shared to foo env, is the best option to just use stack references?
d
Yes, this is their intended use
g
Another option (my preferred) is to do lookups instead. eg. calling
get_<resource>
functions with the parameters known from the library. This way you can have constant eg.
AWS_ROLE_NAME=myRole
and then you can
Copy code
const role = aws.iam.getRole(AWS_ROLE_NAME) 
role.arn
The benefit of this approach is sharing more complex objects is easier. Also prevents outdated stack references
d
Combining the two methods is a common approach. Passing the ID or Name using a stack reference, then using functions or the
.get
method to load the rest of the data for the stack to use
g
be careful about using
<Resource>.get
method it is very different from
get_<resource>
and can lead to side effects
d
What side effects have you encountered?