Hi! I have a terraform_remote_state question. I'm trying to access the state output from a project, but I realize the project is generated via two runs of a single module. Therefore, I have the output listed twice in the state. each with a different result. Is there any way to reference them separately? Or am I going to need to refactor this into two separate state files?
mohae joined the channel
abtreece
how/why are you needing to run a single module twice to get to a completed state?
jgerry
@abtreece I'm just calling the same module twice from a main.tf with different variables passed in
abtreece
in order to stand up two different versions of the same thing?
jgerry
in this case, to generate an IAM role in two different AWS accounts
it may just be easier to forego the module and generate the resources directly in main.tf
abtreece
w/out knowing more about what you're doing I would probably separate the configs for the different accounts into their own dirs so they have their own state
jgerry
Yeah I think that's the easiest path
not a big deal, just not at DRY as i'd like
abtreece
I would also consider making a module of your IAM role config and then ref'ing that in the two configs
that would get you back to DRY
Spanktar
.oO - Why does Hashicorp hate variables so much
jgerry
I can still use my IAM module that's already written. But instead of calling it twice from one project, just use two separate projects
tvon joined the channel
with separate state files
abtreece
yes. then you can resource those state files wherever as needed
jgerry
I'll go that route. thanks for the guidance
abtreece
anytime
jgerry
too bad you can't reference anything deeper in the state files than a single output -- all the data is in there
abtreece
I suppose you could also try to use outputs, but if you're reusing the config for different vars you may end up with strange behavior
sz0 joined the channel
jgerry
yeah - totally not worth it in this case. just a few extra lines of code and one more consul k/v
sebstrax joined the channel
mohae_ joined the channel
ferzan has quit
impi joined the channel
Spanktar
so, I must be confused. Where am I allowed to use interpolations and where am I not? I can’t seem to figure it out myself
No in variable defaults, and apparently also not in template file variable passing
only in resource definitions?
only on Wednesdays?
puhrez joined the channel
azerus joined the channel
azerus has quit
azerus joined the channel
azerus joined the channel
azerus has quit
azerus joined the channel
impi joined the channel
ferzan joined the channel
abtreece
AFAIK interpolation can only be used on things that are rendered. IDK about Wednesdays
devoid joined the channel
devoid
Can someone familiar with Terraform take a look at my changes here: https://github.com/hashicorp/otto/pull/519 where a fix a bug that prevent's Otto's master branch from building due to a change in the Terraform API