diff --git a/README.md b/README.md index b553982..f8c787c 100644 --- a/README.md +++ b/README.md @@ -6,14 +6,19 @@ ## Deployment instructions - 1. Build the server image with Packer. + 1. Copy `./packer/packer.auto.pkrvars.hcl.sample` file to `./packer/packer.auto.pkrvars.hcl` and + fill it with the appropriate values. + + 2. Build the server image with Packer. ```sh cd ./packer/ - export HCLOUD_TOKEN=XXXX packer build ./ ``` - 2. Deploy the server image with Terraform. + 3. Copy `./terraform/terraform.tfvars.sample` file to `./terraform/terraform.tfvars` and fill it + with the appropriate values. + + 4. Deploy the server image with Terraform. ```sh cd ./terraform/ terraform init diff --git a/packer/packer.auto.pkrvars.hcl.sample b/packer/packer.auto.pkrvars.hcl.sample new file mode 100644 index 0000000..fce2517 --- /dev/null +++ b/packer/packer.auto.pkrvars.hcl.sample @@ -0,0 +1 @@ +hcloud_api_token = "" diff --git a/packer/sources.pkr.hcl b/packer/sources.pkr.hcl index ceafceb..658aa25 100644 --- a/packer/sources.pkr.hcl +++ b/packer/sources.pkr.hcl @@ -1,4 +1,6 @@ source "hcloud" "main" { + token = var.hcloud_api_token + image = "ubuntu-20.04" server_name = "wireguard-{{timestamp}}" server_type = "cx11" diff --git a/packer/variables.pkr.hcl b/packer/variables.pkr.hcl new file mode 100644 index 0000000..f277595 --- /dev/null +++ b/packer/variables.pkr.hcl @@ -0,0 +1,5 @@ +variable "hcloud_api_token" { + type = string + description = "Hetzner Cloud API token" + default = "" +} diff --git a/terraform/variables.tf b/terraform/variables.tf index ee93e6d..aa185e5 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -1,6 +1,7 @@ variable "hcloud_api_token" { type = string description = "Hetzner Cloud API token" + default = "" } variable "wg_server_name" {