terraform init -state code example

Example 1: 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'

Example 2: terraform init

#Commands from Terraform Init
#upgrade modules and plugins
terraform init -upgrade
#Skip Backend Initialization
terraform init -backend=false
#Skip Child Module Initialization
terraform init -get=false
#Skip Plugin initialization
terraform init -get-plugins=false
#Copy a Source Module
terraform init -from-module=MODULE-SOURCE

#During initialization the plugins are stored in below location

On most operationg systems :         ~/.terraform.d/plugins
on Windows                 :         %APPDATA%\terraform.d\plugins

Tags:

Php Example