- Manage infrastructure on multiple cloud platforms
- Human-readable
- Track resource changes
~~~graph-easy --as=boxart
[ Dev ] -> [ IaC ] -> [Plan] -> [Apply] -> [AWS]
[Apply] -> [Azure]
[Apply] -> [K8s]
~~~
To deploy infrastructure with Terraform:
- Scope - Identify the infrastructure for your project.
- Author - Write the configuration for your infrastructure.
- Initialize - Install the plugins Terraform needs to manage the infrastructure.
- Plan - Preview the changes Terraform will make to match your configuration.
- Apply - Make the planned changes.
resource "local_file" "foo" {
content = "foo!"
filename = "${path.module}/foo.txt"
}
resource "random_string" "password" {
length = 18
upper = true
lower = true
number = true
special = false
}
output "password" {
value = random_string.password.result
}
- Data sources provide dynamic information about entities that are not managed by the current Terraform and configuration.
- Variables provide static information.
- Data sources allow data to be fetched or computed for use elsewhere in Terraform configuration.
data "aws_ami" "free" {
most_recent = true
owners = ["amazon"]
filter {
name = "name"
values = ["amzn2-ami-hvm-2.0.????????.?-x86_64-gp2"]
}
}
variable "instance_name" {
description = "Value of the Name tag for the EC2 instance"
type = string
default = "TerraformDemo"
}
terraform init
terraform validate
terraform plan
terraform apply
terraform show
- terraform-cli
- aws-cli
- graph-easy