This project contains a Terraform script for setting up a server on Hetzner Cloud, including the creation of a private network and firewall with certain ports open.
- Terraform >= 1.7.5 installed
- Hetzner Cloud Token
- SSH Private Key – SSH Key have to be added to Hetzner Cloud Project
- Clone this repository:
git clone https://link-to-this-repo
- Navigate into the project directory:
cd directory-name
- Rename
terraform.tfvars.example
toterraform.tfvars
:mv terraform.tfvars.example terraform.tfvars
- Open
terraform.tfvars
and replace the example values with your actual Hetzner Cloud token and ssh key details. - Initialize Terraform:
terraform init
- Plan the infrastructure:
terraform plan
- Apply the infrastructure:
terraform apply
After completion, Terraform will create a new Hetzner Cloud server with specific network and firewall rules.
If you do not have an SSH key pair, you can generate one using the following command:
ssh-keygen -t rsa -b 4096 -C "your-email@example.com" -f ~/.ssh/your_key_name
This will create a new SSH key pair in your ~/.ssh
directory.
This project is licensed under the MIT License - see the LICENSE.md file for details