Method: RubyTerraform::ClassMethods#refresh
- Defined in:
- lib/ruby_terraform.rb
#refresh(parameters = {}, invocation_options = {}) ⇒ Object
Invokes the terraform refresh command which updates the state file of your infrastructure with metadata that matches the physical resources they are tracking.
This will not modify your infrastructure, but it can modify your state file to update metadata. This metadata might cause new changes to occur when you generate a plan or call apply next.
Examples:
Basic Invocation
Basic Invocation
RubyTerraform.refresh(
directory: 'infra/networking',
vars: {
region: 'eu-central'
})
Parameters:
-
parameters
(defaults to: {})
—
The parameters used to invoke the command
-
invocation_options
(Hash<String, Object>)
(defaults to: {})
—
Additional options controlling the invocation of the command.
Options Hash (parameters):
-
:directory
(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.
-
:backup
(String)
—
The path to backup the existing state file before modifying; defaults to the
:state_outpath with “.backup” extension; set:no_backuptotrueto skip backups entirely (legacy). -
: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. -
: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_backup
(Boolean)
— default:
false
—
When
true, no backup file will be written (legacy). -
: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) (legacy). -
:state_out
(String)
—
The path to write state to that is different than
:state; this can be used to preserve the old state (legacy). -
: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.
Options Hash (invocation_options):
-
:environment
(Hash<String, String>)
—
A map of environment variables to expose at command invocation time.
916 917 918 |
# File 'lib/ruby_terraform.rb', line 916 def refresh(parameters = {}, invocation_options = {}) exec(RubyTerraform::Commands::Refresh, parameters, invocation_options) end |