add module arg corresponding to cli refresh flag #168
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds
-refresh=true
to the plan generation command line (which is the default if not specified), and adds a module argumentrefresh
with defaulttrue
value, so user can override and make sure resources are not refreshed for a specific module run. This way,plan
can be called with-refresh=false
when a user knows they want this.My use case: while implementing an image bake pipeline that uses Terraform to provision and Ansible to configure a node to be imaged, my play ends by cleaning out the cloud-init identity, shutting down the node, and then imaging the node. Unfortunately, the state refresh that happens prior to imaging wakes up the node, and then it can't be imaged. So I have a chicken-egg situation where I cannot plan the imaging step without waking up the node, whereas waking up the node prevents imaging.
Using
-refresh=false
during plan phase fixes this for my use case. I think it's a valuable flag to expose to other users of the Ansible Terraform module.Terraform source code has the first reference to
-refresh=
flag very early, in June 2014, so don't think we need a version check for this.