Closed AmitKumarDas closed 2 years ago
// Learn Terraform
//
// Resources
// - https://www.terraform.io/docs/language/resources/syntax.html
//
// resource "type" "name" {...}
// - is an identifier
// - unique within a module
//
// Resource Type == Provider == Plugin ~ Golang Import
// - each resource type is implemented by a provider
// - provider is a plugin for Terraform
// - provider offers a collection of resource types
// - providers are distributed separately from Terraform itself
// - Terraform can automatically install most providers when initializing
// - Most public providers are available in Terraform registry
//
// Module ~ Golang Package
// - Terraform module must specify which providers it requires
// - most providers need some configuration to access their remote APIs
// - the **root module** must provide that configuration
//
// Resource Argument
// - values for resource arguments can make use of expressions
// - Terraform applies some meta-arguments across all resource types
//
// Meta Argument
// - depends_on - for specifying hidden dependencies
// - count - for creating multiple resource instances according to a count
// - for_each - to create multiple instances according to a map, or set of strings
// - provider - for selecting a non-default provider configuration
// - lifecycle - for lifecycle customizations
// - provisioner and connection - for taking extra actions after resource creation
//
// Data
// - Each data instance will **export** one or more attributes
// - used in other resources in the form data.<TYPE>.<NAME>.<ATTRIBUTE>
//
// Local only Data Resources
// - calculate within tf itself & use elsewhere
// - used for:
// -- rendering templates
// -- reading local files
// -- reading AWS IAM policies
// - is the same as all other data sources
// - result data exists only temporarily during a Terraform operation
// - re-calculated each time a new plan is created
//
// Making modules composable & reusable
// -1- use Input variables
// - are like function arguments
// - declaring variables in the root module of your configuration
// -- you can set their values using CLI options and environment variables
// - declaring them in child modules
// -- the calling module should pass values in the module block
//
// -2- use Output variables
// - like function return values
// - child module uses outputs to expose a subset of its resource attributes
// -- exposed to a parent module
// - root module can use outputs to print certain values in the CLI output
// -- after running terraform apply
//
//
// Terraform Expressions
// - https://www.terraform.io/docs/language/expressions/index.html