Terraform Command Lines (CLIs)

Command Usage Description
terraform init Used to initialize a working directory containing Terraform configuration files
terraform plan Creates an execution plan, which lets you preview the changes that Terraform plans to make to your infrastructure.
terraform workspace show Used to output the current workspace
terraform workspace new dev Used to create a new workspace
terraform apply The terraform apply command executes the actions proposed in a Terraform plan.
terraform destory Terminates resources defined in your Terraform configuration
terraform plan -destroy Showing you the proposed destroy changes without executing them.
terraform refresh Reads the current settings from all managed remote objects and updates the Terraform state to match
terraform force-unlock LOCK_ID Forcible unlock the state file
terraform taint   Informs Terraform that a particular object has become degraded or damaged
terraform fmt Used to rewrite Terraform configuration files to a canonical format and style
terraform state mv Changes bindings in Terraform state, associating existing remote objects with new resource instances
terraform state push Used to manually upload a local state file to remote state
terraform providers Shows information about the provider requirements of the configuration in the current working directory,
terraform init --upgrade Downloads and upgrades the plugins
terraform import This functionality helps update the state locally and it does not create the corresponding configuration automatically
terraform graph Command generates a visual representation of a configuration or execution plan that you can use to generate charts
terraform apply -var -file="testing.tfvars" Executes the plan with input variables from the var file
terraform workspace new dev Create a new workspace
terraform workspace select dev Navigates to selected workspace
terraform state rm This command can remove single resources, single instances of a resource, entire modules, and mor
terraform state pull Command is used to manually download and output the state from remote state
terraform state list The command will list all resources in the state file matching the given addresses
terraform get The terraform get command is used to download and update modules mentioned in the root module
terraform import aws_instance.myec2 instance-id Import only the mentioned instance/resources or an object in the state file without creating the configuration file
terraform destory -target aws_instance.my_ec2 destroys only the mentioned instance/resources or an object
terraform show Command is used to provide human-readable output from a state or plan file
terraform output variable_name Command is used to extract the value of an output variable from the state file
terraform workspace delete To delete workspace
terraform workspace list Will list all existing workspaces

No comments:

Post a Comment

Featured Post

Cloud : A Trendsetter Technology