Terraform Commands
refresh - query infrascture provider to get the current state - State
plan - Create an execution plan/ preview of what is going to happen - Plan
apply - Execute the plan/applies the configuration file - Apply
destroy - Destroy the resource/infrascture/ removes one by one in an order. Revert back everything created will be destroyed.
-------------------------
> terraform plan command
How plan creates the plan
ansible core evaluates
- your code - terraform configuration code
- tfstate file
to create the execution plan and decides what needs to be done.
So, it will determines what actions are required to achive the desire state.
it basically checks the file you created that is your desire state (your code) and compares with the existing set up and figures it out what changes or adjustments need to be made in order to meet the desire state.
For eg, change an instance type, create a new instance or user ..
a sample code
-------------
# AWS Provider
provider "aws" {
region = "us-east-1"
profile = "default"
}
# resource
resource "aws-instance" "web" {
ami = "ami...." "web" {
instance_type = "t3.small"
tags = {
Name = "Test"
}
}
# Create VPC
resource "aws_vpc" "wnet" {
cidr
}
$ cat storage-db-55a.inv | grep -E "\s+Trya.*\(SAS\)" | awk '{print "%20s| %s\n", $8,$15}' | sort | uniq -c
No comments:
Post a Comment