You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
value = "ssh -i ~/.ssh/id_rsa root@${tolist(linode_instance.example_instance.ipv4)[0]}"
89
+
}
90
+
91
+
output "ipv6" {
92
+
value = linode_instance.example_instance.ipv6
93
+
}
94
+
95
+
output "login_ipv6" {
96
+
value = "ssh -6 -i ~/.ssh/id_rsa root@${linode_instance.example_instance.ipv6}"
97
+
}
98
+
82
99
{{< /file >}}
83
100
84
101
{{< note >}}
85
-
The SSH key in this example was truncated for brevity.
102
+
* The SSH key in this example was truncated for brevity.
103
+
* SSH Access Defaults to Root:
104
+
By default, the authorized_keys argument sets up SSH access for the root user. If you attempt to SSH as a different user such as `ubuntu`, it fails unless you’ve configured additional steps inside the instance.
105
+
Example SSH command:
106
+
```ssh -i ~/.ssh/id_rsa root@<linode-ip>```
107
+
You can use the login_ipv4 and login_ipv6 outputs to get ready-to-use commands after terraform apply.
108
+
* Non-root Users:
109
+
The linode_instance resource does not support creating or configuring additional users directly. If you prefer to log in as a non-root user (such as ubuntu), you must either:
110
+
- Use a startup script such as stackscript or user_data to create and configure that user.
111
+
- Log in as root and manually create the user, then add your SSH key to their `~/.ssh/authorized_keys` file.
112
+
* Root Password and SSH Key Usage:
113
+
This example provides both a root_pass and authorized_keys. While the password offers a fallback for debugging or recovery, using SSH keys is more secure. It is not recommended to keep the `root_pass` in production use. Consider omitting it or managing access through SSH keys and minimal sudo privileges instead.
114
+
* Outputs for Easier Connectivity:
115
+
The example includes output values that generate SSH commands. These make it easy to copy/paste commands to access your Linode instance after provisioning.
86
116
{{< /note >}}
87
117
88
118
This example Terraform file, with the Terraform file extension `.tf`, represents the creation of a single Linode instance labeled `example_instance_label`. This example file is prefixed with a mandatory `provider` block, which sets up the Linode provider and which you must list somewhere in your configuration.
0 commit comments