import terraform state code example

Example: terraform state

#Commands for Terraform State
SYNTAX :
    terraform state <subcommand> [options] [args]

#List Resources involed in terraform state file
terraform state list
#List Resources with given resource Block name
terraform state list <resource name>
#Shows the attributes of a single resource in the state file
terraform state show 'resource name'
#Pull the state files
terraform state pull
#Push the local state files to remote
terraform state push
#Remove Items from Terraform state
terraform state rm 'packet_device.worker'
#Moving the state from one source to another
terraform state mv 'module.app' 'module.parent.module.app'
#Rename a resource in the terraform state file without destroying
terraform state mv 'packet_device.worker' 'packet_device.helper'