Skip to content

beginners-guide-to-terraform should explain how to logon using ssh #4962

@mjbright

Description

@mjbright

I created my first instance using this tutorial, it's really useful, thanks.

I have several comments about how this could be improved to enable an initial ssh connection.

root user for connection
It wasn't obvious to me that the authorised_key is for the 'root' user, I was trying with user 'ubuntu'
It would help to state this and/or provide an ssh example.
I propose to output the appropriate ssh commands - see below.

non-root user
Is there no way to specify a non-root user, or to at least enable authorized_keys for the existing - in this case - 'ubuntu' user ?

root password + authorized keys
It seems strange to me that we specify both - I guess this is for "safety"of not losing the ability to connect, but I would not use a password for root. Useful for debugging but maybe at least mention that it's unsafe.

output ssh connectivity info
I suggest adding some output statements as below (need to specify correct key of course)

output login_ipv4 { value = "ssh -i ~/.ssh/id_rsa root@${tolist( linode_instance.example_instance.ipv4 )[0]}" }
output ipv4 { value = linode_instance.example_instance.ipv4 }

output login_ipv6 { value = "ssh -6 -i ~/.ssh/id_rsa root@${linode_instance.example_instance.ipv6}" }
output ipv6 { value = linode_instance.example_instance.ipv6 }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions