You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was wondering is this intended and is it something we need to take into account when adopting remote states.
We are currently adopting remote states for our usage of terraform and having Jenkins run our terraform plan and apply commands to simplify auditing and controls.
What we have found is on terraform stacks that use the ${path.moduel}, the value is hardcoded on the tfstate file. This complicates matter when we run terraform apply on another location as this is usually run on another location/machine that would not have access to the locaiton where terraform plan was run.
Is this expected behaviour and something we should take into account for when using remote states?
Terraform Version
0.6.15
Affected Resource(s)
path.module - mostly usage in template_file
Expected Behavior
Unknown
Actual Behavior
The tfstate file has the path to the file hardcoded
Steps to Reproduce
Run terraform plan on Machine A and generate a plan
Run terraform apply on Machine B with the generated plan
The text was updated successfully, but these errors were encountered:
In general we've been moving away from including filenames directly in Terraform configs for a number of reasons, including this one. Instead, we now prefer to make an attribute for the file's contents and use the file(...) to fill it, so that it's the contents rather than the filename that get written into the state.
For template_file in particular, the recommendation is now to use the template argument instead of the filename argument:
@apparentlymart's comment here is precisely the direction we are heading in - if you have a specific example that you're having trouble with we can help you figure out how to refactor it to deal in file contents rather than paths.
In the meantime I'm going to close this as answered! 👍
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.
ghost
locked and limited conversation to collaborators
Apr 25, 2020
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I was wondering is this intended and is it something we need to take into account when adopting remote states.
We are currently adopting remote states for our usage of terraform and having Jenkins run our terraform plan and apply commands to simplify auditing and controls.
What we have found is on terraform stacks that use the ${path.moduel}, the value is hardcoded on the tfstate file. This complicates matter when we run terraform apply on another location as this is usually run on another location/machine that would not have access to the locaiton where terraform plan was run.
Is this expected behaviour and something we should take into account for when using remote states?
Terraform Version
0.6.15
Affected Resource(s)
path.module - mostly usage in template_file
Expected Behavior
Unknown
Actual Behavior
The tfstate file has the path to the file hardcoded
Steps to Reproduce
Run terraform plan on Machine A and generate a plan
Run terraform apply on Machine B with the generated plan
The text was updated successfully, but these errors were encountered: