Using Terraform, this configuration will allow you to spin up multiple Linode instances, create Cloudflare A records for the Linode instances and apply rDNS to the Linode instances.
- Linode Account
- Cloudflare Account
- Domain name
- Terraform installed
- List of current images
- List of current instance types
Multiple tokens will be required to authenticate terraform with Linode and Cloudflare.
- Linode API Token
- Cloudflare API Token
- Cloudflare Zone ID
- SSH Public Key (reccomended)
- root Password (optional)
note: This example uses SSH keys only. To use root password uncomment in
main.tf
,variables.tf
andterraform.tvars
.
This example terraform.tfvars
will deploy a single Linode instance.
server_name = "ubuntu20.04"
#root_pass = ""
authorized_keys = "ecdsa-sha2-nistp256 AAAAE2...rTucc= dgibbs@home"
linode_token = "--- Linode API Token ---"
linode_image = "linode/ubuntu20.04"
linode_region = "eu-west"
linode_type = "g6-nanode-1"
linode_tags = [ "Tag 1", "Tag 2" ]
cloudflare_token = "--- Cloudflare API Token ---"
cloudflare_zone_id = "--- Cloudflare Zone ID ---"
This example terraform.tfvars
will deploy multiple Linode instances.
This example will create 5 Linode instances using difference distro images. It does this by using arrays and will loop though eachserver_name
. It is also possible using the same arrays to specify different regions and types by adding [count.index]
in main.tf
.
server_name = [ "ubuntu20.04", "ubuntu18.04", "debian11", "almalinux8", "centos7" ]
#root_pass = ""
authorized_keys = "ecdsa-sha2-nistp256 AAAAE2...rTucc= dgibbs@home"
linode_token = "--- Linode API Token ---"
linode_image = [ "linode/ubuntu20.04", "linode/ubuntu18.04", "linode/debian11", "linode/almalinux8", "linode/centos7" ]
linode_region = "eu-west"
linode_type = "g6-nanode-1"
linode_tags = [ "Tag 1", "Tag 2" ]
cloudflare_token = "--- Cloudflare API Token ---"
cloudflare_zone_id = "--- Cloudflare Zone ID ---"