Terraform code is written in the Hashicorp configuration language in files with extension .tf file.
1. AWS region is a separate geographic area, such as us-east-1, us-east2, there are multiple isolated datacenters know as availability zone.
2. There are different kinds of resources available, base on your requirement you have to choose. for example aws_instance
3. Terraform allows defining input variables. because don't need to repeat the same value everywhere.
variable "Name" {
}
In the user Data section, I refer to the interpolation expression "${....}"
4. Terraform allow to define output variables by the following syntax.
output "name" {
}
Instead of find the ec2 console to get ip address of instance, output section provide the ip address as an output.
5. You have to create the server ssh key before itself.
Details:
Step: 1
create an empty directory and put a file in it called main.rf.
Step: 2
Copy my following contents
Step: 3 Terraform show dependency graph by running the graph command.
The output is in a graph called DOT, copy the content apply to Graphvizline tool.
No comments:
Post a Comment