Tuesday, April 12, 2022

Terraform Commands (CLI)

 HashiCorp Terraform is an open-source infrastructure as a code software tool that allows DevOps engineers to programmatically provision the physical resources an application requires to run.

Infrastructure as code is an IT practice that manages an application's underlying IT infrastructure through programming. This approach to resource allocation allows developers to logically manage, monitor, and provision resources -- as opposed to requiring that an operations team manually configure each required resource.


Terraform Commands (CLI)


Here is the Tutorial video based on Terraform Commands (CLI)👇👇




1. terraform apply
  • It is used to create or introduce changes to real infrastructure.
  • By default, apply scans the current working directory for the configuration and applies the changes appropriately


2. terraform destroy
  • It destroys all Terraform-managed states.
  • This command is the inverse of terraform apply in that it terminates all the resources specified in your Terraform state.
  • It does not destroy resources running elsewhere that are not managed by the current Terraform project.


3. terraform fmt
  • It is used to rewrite Terraform configuration files to a canonical format and style.
  • This command applies a subset of the Terraform language style conventions, along with other minor adjustments for readability.


4. terraform get
  • It is used to download and update modules mentioned in the root module.


5. terraform graph
  • It is used to generate a visual representation of either a configuration or execution plan.
  • The output is in the DOT format, which can be used by GraphViz to generate charts.


6. terraform import
  • Import will try to find the infrastructure resource identified with ID and import a state into "terraform .tfstate" with the resource id address.
  • The import functionality helps update the state locally and it does not create the corresponding configuration automatically.


7. terraform output
  • It allows you to export structured data about your resources.
  • You can use this data to configure other parts of your infrastructure with automation tools, or as a data source for another Terraform workspace.
  • Outputs are also necessary to share data from a child module to your root module.


8. terraform plan
  • It evaluates a Terraform configuration to determine the desired state of all the resources it declares, then compares that desired state to the real infrastructure objects being managed with the current working directory and workspace.


9. terraform push
  • The terraform state push command is used to manually upload a local state file to a remote state.
  • This command also works with the local state.


10. terraform refresh
  • It refreshes the remote state. Which Can identify differences between the state file and remote state.
  • If you think of differences you just run "terraform refresh", and it is going to compare your "TF state" file within the remote infrastructure.


11. terraform remote
  • It is used to configure remote state storage.


12. terraform show
  • It shows a human-readable output from a state or a plan.
  • This can be used to inspect a plan to ensure that the planned operations are expected, or to inspect the current state as Terraform sees it.


13. terraform state
  • You can use this command for advanced state management.
  • If you make changes to your state and you want to then rename something, then you are going to have to use this one.


14. terraform taint
  • It manually marks a resource that is tainted, meaning it will be destructed and recreated at the next apply.
  • Terraform represents this by marking the object as "tainted" in the Terraform state, and Terraform will propose to replace it in the next plan you create.


15. terraform validate
  • It validates the configuration files in a directory, referring only to the configuration and not accessing any remote services such as remote state, provider APIs, etc.


16. terraform untaint
  • If you do a "taint" and If you want to undo it, then you can do "untaint".
  • This will not change anything to the infrastructure. It is just going to mark it "untaint".




I HOPE YOU ALL ARE CLEAR WITH THIS, 

IF YOU ARE FACING ANY PROBLEM THEN YOU CAN TAKE HELP FROM THE ABOVE VIDEO.




▬▬▬▬▬▬ WANT TO LEARN MORE? ▬▬▬▬▬▬


Full Terraform tutorial ►
https://bit.ly/2GwK8V2 DevOps Tools, like Ansible ► https://bit.ly/3iASHuP Docker Tutorial ► https://bit.ly/3iAT9Jx AWS Tutorial ► https://bit.ly/30GFv1q GCP Tutorial ► https://bit.ly/3mwh412 Jenkins Tutorials ► https://bit.ly/3iHnfv4 Jenkins Pipeline ► https://bit.ly/30CJGLB Python ► https://bit.ly/3I7bewU Python in just 1 video ► https://bit.ly/3EeqGVy


1 comment:

Wireless Security Configuration: Protect Your Network Now!

Introduction: In today’s connected world, wireless networks are as common as smartphones, and they’re often the gateway to our personal, pr...