terraform code example

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

Example 2: terraform taint

#Commands for Terraform Taint
terraform taint [options] address

#Read State file from different path
terraform taint -state=path

#Tainting a single resource
terraform taint aws_security_group.allow_all

#tainting resource within a module
terraform taint "module.couchbase.aws_instance.cb_node[9]