Method: RubyTerraform::ClassMethods#plan
- Defined in:
- lib/ruby_terraform.rb
#plan(parameters = {}) ⇒ Object
Invokes the terraform plan command which generates a speculative
execution plan, showing what actions Terraform would take to apply the
current configuration. This command will not actually perform the planned
actions.
You can optionally save the plan to a file, which you can then pass to the #apply command to perform exactly the actions described in the plan.
Examples:
Basic Invocation
Basic Invocation
RubyTerraform.plan(
directory: 'infra/networking',
vars: {
region: 'eu-central'
})
Parameters:
-
parameters
(defaults to: {})
—
The parameters used to invoke the command
Options Hash (parameters):
-
:plan
(String)
—
The path to a directory containing terraform configuration (deprecated in terraform 0.14, removed in terraform 0.15, use
:chdirinstead). -
:chdir
(String)
—
The path of a working directory to switch to before executing the given subcommand.
-
:compact_warnings
(Boolean)
— default:
false
—
When
true, if terraform produces any warnings that are not accompanied by errors, they are shown in a more compact form that includes only the summary messages. -
:destroy
(Boolean)
— default:
false
—
When
true, a plan will be generated to destroy all resources managed by the given configuration and state. -
:detailed_exitcode
(Boolean)
— default:
false
—
Whether or not to return detailed exit codes when the command exits; this will change the meaning of exit codes to: 0 - Succeeded, diff is empty (no changes); 1 - Errored; 2 - Succeeded, there is a diff.
-
:input
(Boolean)
— default:
true
—
When
false, will not ask for input for variables not directly set. -
:lock
(Boolean)
— default:
true
—
When
true, locks the state file when locking is supported; whenfalse, does not lock the state file. -
:lock_timeout
(String)
— default:
"0s"
—
The duration to retry a state lock.
-
:no_color
(Boolean)
— default:
false
—
Whether or not the output from the command should be in color.
-
:parallelism
(Integer)
— default:
10
—
The number of parallel resource operations.
-
:refresh
(Boolean)
— default:
true
—
When
true, updates state prior to checking for differences; whenfalseuses locally available state; this has no effect when:planis provided. -
:state
(String)
— default:
"terraform.tfstate"
—
The path to the state file from which to read state and in which to store state (unless
:state_outis specified). -
:target
(String)
—
The address of a resource to target; if both
:targetand:targetsare provided, all targets will be passed to terraform. -
:targets
(Array<String>)
—
An array of resource addresses to target; if both
:targetand:targetsare provided, all targets will be passed to terraform. -
:vars
(Hash<String, Object>)
—
A map of variables to be passed to the terraform configuration.
-
:var_file
(String)
—
The path to a terraform var file; if both
:var_fileand:var_filesare provided, all var files will be passed to terraform. -
:var_files
(Array<String>)
—
An array of paths to terraform var files; if both
:var_fileand:var_filesare provided, all var files will be passed to terraform.
604 605 606 |
# File 'lib/ruby_terraform.rb', line 604 def plan(parameters = {}) exec(RubyTerraform::Commands::Plan, parameters) end |