Created variables file for Packer

This commit is contained in:
Héctor Molinero Fernández 2020-06-14 21:25:25 +02:00
parent 5b47a506de
commit cc4f0c40f1
5 changed files with 17 additions and 3 deletions

View File

@ -6,14 +6,19 @@
## Deployment instructions ## 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 ```sh
cd ./packer/ cd ./packer/
export HCLOUD_TOKEN=XXXX
packer build ./ 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 ```sh
cd ./terraform/ cd ./terraform/
terraform init terraform init

View File

@ -0,0 +1 @@
hcloud_api_token = ""

View File

@ -1,4 +1,6 @@
source "hcloud" "main" { source "hcloud" "main" {
token = var.hcloud_api_token
image = "ubuntu-20.04" image = "ubuntu-20.04"
server_name = "wireguard-{{timestamp}}" server_name = "wireguard-{{timestamp}}"
server_type = "cx11" server_type = "cx11"

5
packer/variables.pkr.hcl Normal file
View File

@ -0,0 +1,5 @@
variable "hcloud_api_token" {
type = string
description = "Hetzner Cloud API token"
default = ""
}

View File

@ -1,6 +1,7 @@
variable "hcloud_api_token" { variable "hcloud_api_token" {
type = string type = string
description = "Hetzner Cloud API token" description = "Hetzner Cloud API token"
default = ""
} }
variable "wg_server_name" { variable "wg_server_name" {