Terraform data types :
- string: a sequence of Unicode characters representing some text, like “hello”.
- number: a numeric value. The number type can represent both whole numbers like 15 and fractional values like 6.283185.
- bool: a boolean value, either true or false. bool values can be used in conditional logic.
- list (or tuple): a sequence of values, like [“us-west-1a”, “us-west-1c”]. Identify elements in a list with consecutive whole numbers, starting with zero.
- set: a collection of unique values that do not have any secondary identifiers or ordering.
- map (or object): a group of values identified by named labels, like {name = “Mabel”, age = 52}.
Terraform format
- this cmd will help to format hcl code like spaces and make prety
terraform fmt
terraform validate
- it is used to validate syntax for tf files
terraform validateneed to run after init
terrafrom plan output:
- save your terraform plan what changes it do
terraform plan -out=tfplanit save plan actions and changes like create, modified, destroy, replace
To apply saved plan changes
terraform apply "tfplan" plan file name should be same.
TasK
- create internet gateway, attach internet gateway
- create 2route table (public & pravite)
- create natgateway
- subnet assocation ==> route tables
- create route attach IGW to public route
- create route attach NGW to pravite route
