variable "do_token" { default = "12e7ff309c07e9e8aee91e81214d4dfa653182a3e65c21d0df12c27b9b01a07f" }
variable "do_ssh_key" { default = "1200719" }
provider "digitalocean" { token = "${var.do_token}" }
resource "digitalocean_droplet" "meetup_nginx" {
name = "nginx"
image = "debian-8-x64"
region = "fra1"
size = "1gb"
private_networking = "true"
ssh_keys = ["${var.do_ssh_key}"]
connection { key_file = "id_robot" }
provisioner "remote-exec" {
inline = [
"apt-get update",
"apt-get install -qy nginx"
]
}
}
output "nginx_ip" { value = "${digitalocean_droplet.meetup_nginx.ipv4_address}" }
Resource: something created by providers. Can be physical (VM, IP address) or logical (generated configuration file).Providers: creators of resources. Many providers are supplied by default such as VMWare, Amazon, Google, Azure, DigitalOcean, OpenStack.Provisioners: modifiers of resources such as command execution and file upload.
terraform apply reads all the *.tf files in the current directory. File ordering is not important.terraform apply will pick up on the failed path(s) and try them again.terraform plan to get an idea of how terraform will execute your deployment.terraform graph to get a GraphViz data of the plan.terraform show to get the current state of the deployment.terraform destroy to remove all the created resources.