Explicit References to attributes #164
starhawking
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Has there been any consideration as to making an explicit reference to an attribute instead of looking it up from the resource's internal dictionary?
Automatically resolving the attribute if it exists breaks the dependency graph because terraform has no way of inferring the dependency between 2 resources anymore.
An example of where I've encountered this was dealing with github repos
Because there is a name attribute set on the github_repository resource, terrascript will simply resolve the value. There is no longer the implicit terraform dependency that causes it to wait for the github_repository resource to complete before beginning to create the github_team_repository resource.
I found a PR where this code section was altered, but it wasn't quite clear what the intended behavior was beforehand.
https://github.com/mjuenema/python-terrascript/issues/89
mjuenema@bf6824a
I wasn't sure what the preferred approach would be. I suspect just removing the two lines that do the immediate lookup would be a safe approach.
https://github.com/mjuenema/python-terrascript/blob/develop/terrascript/__init__.py#L90-L91
But alternately, just adding some sort of
ref()
method, or some way to specify that you explicitly want a reference, or amake_reference()
function or something would also work (Its basically what I end up doing).I just wanted to float this question and see what folks' thoughts were before I opened up a PR for whichever approach.
Beta Was this translation helpful? Give feedback.
All reactions