#HashiCorp Terraform stores plugins under the local directory (the one where configuration files# located) .terraform/plugins/
. Terraform will download any missing plugins for the infrastructure after calling terraform init
.
Terraform Plugins
-
Terraform Providers
There are several #HashiCorp Terraform providers available from HashiCorp either through official support, verified, or community support. They can be downloaded from Terraform Registry# as a Terraform Plugins# if needed and stored into the local directory
.terraform/plugins/
. -
HashiCorp Terraform
A usual Terraform workflow should start with initialising the project and identify the Terraform Providers# to be used for the target environment using the command
terraform init
(initialise phase). Then, dry-run or test blueprint for each target environment by laying out the action that will be carried out with the commandterraform plan
(planning phase). Finally, apply the blueprint and make necessary changes for the target environment accordingly by runningterraform apply
(apply phase). Bothterraform plan
andterraform apply
change the state of Terraform. The state of the resources is recorded in the fileterraform.tfstate
. If there is a disparity between current environment and the blueprint such as missing plugins#, Terraform will fix it in order to adhere to the specified requirements. Otherwise, one could simply runterraform refresh
to synchronise the state of Terraform and the underlying infrastructure. We can import resources that is created manually or providers that is outside Terraform Registry# (from other #Infrastructure as Code (IaC) tools). -
HashiCorp Configuration Language (HCL)
The above example specify a
resource
block with parameters oflocal_file
andmy_file
. Defined within the block scope is what will be passed as arguments to the accordingresource
plugin#. Generally speaking, the block will contain the information about the infrastructure platform and resources from that infrastructure platform.