Skip to content

Latest commit

 

History

History
58 lines (54 loc) · 1.96 KB

reference.md

File metadata and controls

58 lines (54 loc) · 1.96 KB

< readme

Basic Concepts

Terraform

  1. HCL - Hashicorp configuration language
    1. Example
    resource "aws_vpc" "main" {
      cidr_block = var.base_cidr_block
    }
    
    <BLOCK TYPE> "<BLOCK LABEL>" "<BLOCK LABEL>" {
    # Block body
    <IDENTIFIER> = <EXPRESSION> # Argument
    }
  2. Resources
    1. describe one or more infrastructure objects
    2. resources are declared with a resource block
    3. resources define behavior so that they can be
      1. created
      2. destroyed
      3. updated in place
      4. destroyed and recreated
  3. Datasources
    1. special type of read only resource
    2. used to retrieve data for resources that already exist
    3. requested using block
  4. Providers
    1. plugins that define how to interact with a cloud provider, saas provider or any api
    2. includes a set of resources and datasources
    3. providers are typically found and managed in the Terraform Registry
  5. Variables
    1. Input - used as parameters for a module
    2. Output - returned values from a module
    3. local - convenience to name an expression
  6. Modules
    1. containers for multiple resources
    2. types
      1. root module - ex: this main.tf
      2. child module
        1. a module called by another module
        2. can be defined locally
        3. can be called multiple times
        4. ex: argocd module
      3. published module
        1. remote module
        2. can be found in Terraform Registry
        3. could be third party/opensource
  7. State
    1. a file created by terraform to track managed infrastructure
    2. stores identifiers and metadata needed to link infrastructure to resources
    3. the state is refreshed against actual infrastructure before configurations are applied
    4. state can be stored locally or remotely
      1. s3 is a recommended remote store to enable state to be shared
      2. state can contain sensitive data