-
Notifications
You must be signed in to change notification settings - Fork 51
add module arg corresponding to cli refresh flag #168
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 4m 48s |
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 18s |
|
Rebased to current P.S. did not know what to use for |
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 20s |
…le-collections#168) Sometimes we want our task to create a plan without the usual implied state-refresh. The default behavior of Terraform (either no-arg, or '-refresh=true') is to always refresh state sources when the plan is created. When the user knows better, they can override, as they can already on cli.
cfb2cd6 to
e6a4a2d
Compare
|
Build succeeded. ✔️ ansible-galaxy-importer SUCCESS in 3m 11s |
|
So I rebased off the 4.0 |
This patch adds
-refresh=trueto the plan generation command line (which is the default if not specified), and adds a module argumentrefreshwith defaulttruevalue, so user can override and make sure resources are not refreshed for a specific module run. This way,plancan be called with-refresh=falsewhen 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=falseduring 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.