terraform refresh
-
reconciles Terraform statefile with real infrastructure – out what changes compare with statefile and aws resources
-
terraform refresh
task – create ec2 instance with terraform after creation do manual changes in ec2 like tag or instance type …etc and check plan after changes then terraform refresh show the differances.
Terraform graph
- Outpts as a dependency graph in (DOT format) showing in order terraform will create/modifed/destory/replace resources.
- Install dotnet
choco install dotnet-sdk -y - reboot system
terraform init && terraform graph -type=plan | dot -Tpng >graph.png- Refer Terraform graph
Type of conversion:
Refer types of conversions
- converts values to string
tostring(X) ==> tostring(5) ==> "5"
- converts value to number
tonumber("X") ==> tonumber("7") ==> 7 - converts value to an ordered list
tolist(x) ==> tolist(toset(["b", "a"])) ==> ["b", "a"] - converts value to a map
tomap({"a=1","b=2"}) ==> { a=1 , b=2} - return true/false
can(x) ==> can (cidrhost(var.cidr, 0)) ==> false
Task:
-
create ec2 instance using module and install apache2 and use above conversions
-
Next topics
-
terraform azure
- azure cli & terrafom cli install vm
- terraform backend setup
- how to auth azure in vm
- create resources and make it variables
- using copilate / ai tools will generate code.
