Provision linode instance in Linode.
References:
- https://registry.terraform.io/providers/linode/linode/latest/docs/resources/instance
- https://www.linode.com/docs/api/linode-instances/#linode-create
EXPERIMENTAL!! Not fully implemented or tested (aside from what's in examples).
See examples for example usage. You'll need a Linode personal access token.
To be able to log in to your Linode, you'll need a Public SSH key. There's several ways to provide this for provsioning. By default, this module will look for an SSH pub key in ~/.ssh/id_rsa.pub
and silently pass an empty list if not found. If that exists and contains a valid key, there's nothing else to do but run the terraform below.
A second method is to pass your pub key as a variable by creating a terraform.tfvars
file, adding it, then running the terraform below. For example:
authorized_keys = [ "<YOUR_SSHPUBKEY_FINGERPRINT>" ]
A third way is to upload your key to Linode through the console in Profile -> SSH Keys. If using this, create a terraform.tfvars
file, add the usernames and run the terraform below. For example:
authorized_users = [ "<INSERT_USERNAME>" ]
Once you've sorted out providing your key, init, plan and apply:
export LINODE_TOKEN="<YOUR_TOKEN_HERE>"
terraform init
terraform plan -out=/tmp/tf
terraform apply "/tmp/tf"
Assuming you correctly provided an SSH public key you can SSH to the IP shown in outputs:
ssh root@XX.XX.XX.XX
Profit!
Name | Version |
---|---|
linode | 1.25.2 |
null | 3.1.0 |
random | 3.1.0 |
Name | Description | Type | Default | Required |
---|---|---|---|---|
alerts | See docs: https://registry.terraform.io/providers/linode/linode/latest/docs/resources/instance#alerts.0.cpu | list(any) |
[] |
no |
authorized_keys | A list of SSH public keys to deploy for the root user on the newly created Linode. | list(string) |
[] |
no |
authorized_users | A list of Linode usernames. If the usernames have associated SSH keys, the keys will be appended to the root user's ~/.ssh/authorized_keys file automatically. | list(string) |
[] |
no |
backup_id | A Backup ID from another Linode's available backups. | number |
null |
no |
backups_enabled | If this field is set to true, the created Linode will automatically be enrolled in the Linode Backup service. | bool |
false |
no |
boot_config_label | The Label of the Instance Config that should be used to boot the Linode instance. | string |
null |
no |
config_block | See documentation: https://registry.terraform.io/providers/linode/linode/latest/docs/resources/instance#disk-and-config-arguments | list(any) |
[] |
no |
disk_block | See documentation: https://registry.terraform.io/providers/linode/linode/latest/docs/resources/instance#disk-and-config-arguments | list(any) |
[] |
no |
group | The display group of the Linode instance. | string |
null |
no |
image | An Image ID to deploy the Disk from. Official Linode Images start with linode/, while your Images start with private/. See https://api.linode.com/v4/images | string |
"linode/ubuntu20.04" |
no |
interface | A list of network interfaces to be assigned to the Linode on creation. | list(string) |
[] |
no |
interface_block | See documentation: https://registry.terraform.io/providers/linode/linode/latest/docs/resources/instance#interface | list(any) |
[] |
no |
label | The Linode's label is for display purposes only. If no label is provided for a Linode, a default will be assigned. | string |
null |
no |
linode_token | Linode personal access token | any |
null |
no |
private_ip | If true, the created Linode will have private networking enabled, allowing use of the 192.168.128.0/17 network within the Linode's region. It can be enabled on an existing Linode but it can't be disabled. | bool |
false |
no |
provisioner | Optional provisioner | string |
"" |
no |
provisioner_connection_type | The connection type. Valid values are ssh and winrm. | string |
"ssh" |
no |
provisioner_connection_user | The user to use for the connection | string |
"root" |
no |
provisioner_inline | A list of command strings. They are executed in the order they are provided. | list |
[] |
no |
provisioner_script | This is a path (relative or absolute) to a local script that will be copied to the remote resource and then executed. This cannot be provided with inline or scripts. | any |
null |
no |
provisioner_scripts | This is a list of paths (relative or absolute) to local scripts that will be copied to the remote resource and then executed. They are executed in the order they are provided. This cannot be provided with inline or script. | list |
[] |
no |
region | (Required) This is the location where the Linode is deployed. See https://api.linode.com/v4/regions | string |
"us-central" |
no |
root_pass | The initial password for the root user account. If omitted, a random password will be generated but will not be stored in Terraform state. | string |
"" |
no |
ssh_private_key_file | File containing your SSH Private Key | string |
"~/.ssh/id_rsa" |
no |
ssh_public_key_file | File containing your SSH Public Key Fingerprint. | string |
"~/.ssh/id_rsa.pub" |
no |
stackscript_data | An object containing responses to any User Defined Fields present in the StackScript being deployed to this Linode. Only accepted if 'stackscript_id' is given. | map(any) |
{} |
no |
stackscript_id | The StackScript to deploy to the newly created Linode. If provided, 'image' must also be provided, and must be an Image that is compatible with this StackScript. | number |
null |
no |
swap_size | When deploying from an Image, this field is optional with a Linode API default of 512mb, otherwise it is ignored. This is used to set the swap disk size for the newly-created Linode. | number |
512 |
no |
tags | A list of tags applied to this object. Tags are for organizational purposes only. | list(string) |
[] |
no |
timeouts_block | See documentation: https://registry.terraform.io/providers/linode/linode/latest/docs/resources/instance#timeouts | list(any) |
[] |
no |
type | (Required) The Linode type defines the pricing, CPU, disk, and RAM specs of the instance. See https://api.linode.com/v4/linode/types | string |
"g6-nanode-1" |
no |
watchdog_enabled | The watchdog, named Lassie, is a Shutdown Watchdog that monitors your Linode and will reboot it if it powers off unexpectedly. | bool |
false |
no |
Name | Description |
---|---|
backups | Information about this Linode's backups status |
id | Linode id |
ip_address | A string containing the Linode's public IP address. |
ipv4 | This Linode's IPv4 Addresses. |
ipv6 | This Linode's IPv6 SLAAC addresses. |
label | Linode label |
private_ip_address | This Linode's Private IPv4 Address, if enabled. |
specs | Specs |
status | The status of the instance, indicating the current readiness state. |
README.md formatting using terraform-docs
MIT Licensed. See LICENSE for full details.