Automating Linux Server Deployments with Terraform and Linode

Subscribe to LearnLinuxTV

First example

 provider "linode" {
     token = "d95ab522b717f75439d6a84455eb4239dae836d73419ff3a6dc1067e9d7de834"
 }
 
 resource "linode_instance" "my_linode" {
     label = "my_linode"
     image = "linode/debian10"
     region = "us-east"
     type = "g6-nanode-1"
     root_pass = "Supersecret!!!"
 }

Second example

 variable "linode-api-key" {}
 variable "root-password" {}
 
 provider "linode" {
     token = var.linode-api-key
 }
 
 resource "linode_instance" "my_linode_2" {
     label = "my_linode_2"
     image = "private/7692309"
     region = "us-east"
     type = "g6-nanode-1"
     root_pass = var.root-password
 }