4. Terraform
• Execution plans
• Resource graph
• Change automation
• Agnostic
• HCL is the HashiCorp configuration language.
• Development with Go
https://github.com/hashicorp/terraform
7. Provisioners
• Used to execute scripts on a local or remote
machine as part of resource creation or
destruction.
• Can be used to bootstrap a resource, cleanup
before destroy, run configuration management, etc.
• There are: chef, connection, file, local-exec,
remote-exec, null_resource
8. Demo
• 1 VPC
• 1 Route Table
• 4 Subnets: 2 publics and 2 privates
• 2 Zones
• 2 EC2
• Move to another region
15. Targets
• Plan:
• terraform plan -target=module.vpc
• terraform plan -destroy -target=module.vpc
• Destroy
• terraform destroy -target=module.vpc
• Show
• terraform show -target=module.vpc
16. Filters data
• No more aws cli
• No more tags
• No more tricks
• Use:
data "aws_ami" "ami" {
most_recent = true
filter {
name = "name"
values = ["${var.ami_name}"]
}
filter {
name = "virtualization-type"
values = ["hvm"]
}
}
"${data.aws_ami.ami.id}"
21. Module
• Download: terraform get -update=true
module "vpc" {
source = "github.com/mario21ic/terraform-aws-vpc"
region = "${var.region}"
name = “${var.name}"
…
}
22. Recomendaciones
• Automatizar todo lo que se pueda y deba.
• Usa un storage para los states
• No existe la bala de plata
• La nube no la controlamos al 100%, ejem: la caída
de Aws S3
• Es mejor tener un plan a no tener ninguno