LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

terraform-get

Download modules declared in a Terraform configuration

TLDR

Download the modules referenced by the root module
$ terraform get
copy
Update modules that are already in the local cache
$ terraform get -update
copy
Set a const variable that a module source uses
$ terraform get -var='[name]=[value]'
copy
Load those values from a tfvars file
$ terraform get -var-file=[path/to/file.tfvars]
copy
Disable colored output
$ terraform get -no-color
copy

SYNOPSIS

terraform get [options]

DESCRIPTION

terraform get downloads the modules declared in the root module into the .terraform directory of the working directory. That directory is a local cache. Do not commit it.terraform init also downloads modules, and it installs provider plugins. get does not install providers. Use -update when a module source can move, such as a Git branch, and the cached copy should be checked again.

PARAMETERS

-update

Check modules that are already downloaded and fetch a newer revision when the source has one.
-var 'name=value'
Set one input variable declared in the root module. Repeat the flag to set more than one. A variable used in a module source or version must be declared with const = true.
-var-file filename
Load variable values from a .tfvars file. Repeat the flag to include more than one file.
-no-color
Disable colored output.

INSTALL

sudo pacman -S terraform
copy
nix profile install nixpkgs#terraform
copy

CAVEATS

Terraform evaluates most input variables when it creates a plan, so those values are not available during get. Any variable referenced from a module block's source or version argument must set const = true. Other variables can be left unset.-update refreshes modules only. Provider upgrades are done with terraform init -upgrade.

HISTORY

Terraform was created by Mitchell Hashimoto at HashiCorp and first released in 2014.

SEE ALSO

RESOURCES

Copied to clipboard
Kai