From c66cedf146e91c3afe983bd6f0ce039129b67da3 Mon Sep 17 00:00:00 2001 From: Noah Masur <7386960+nmasur@users.noreply.github.com> Date: Sat, 30 Mar 2024 14:30:02 -0400 Subject: [PATCH] use variable for vultr plan --- .github/workflows/arrow.yml | 12 ++++++++++++ hosts/arrow/main.tf | 9 ++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/arrow.yml b/.github/workflows/arrow.yml index 62338ac..3ce6ee9 100644 --- a/.github/workflows/arrow.yml +++ b/.github/workflows/arrow.yml @@ -27,6 +27,16 @@ on: - create - destroy - nothing + plan: + type: choice + required: false + options: + - vc2-1c-1gb # 25 GB / $5 + - vc2-1c-2gb # 55 GB / $10 (default) + - vc2-2c-2gb # 65 GB / $15 + - vc2-2c-4gb # 80 GB / $20 + - vc2-4c-8gb # 160 GB / $40 + - vc2-6c-16gb # 320 GB / $80 jobs: build-deploy: @@ -92,6 +102,8 @@ jobs: - name: Terraform Apply if: inputs.action == 'create' working-directory: ${{ env.TERRAFORM_DIRECTORY }} + env: + TF_VAR_vultr_plan: ${{ inputs.plan }} run: | terraform apply \ -auto-approve \ diff --git a/hosts/arrow/main.tf b/hosts/arrow/main.tf index 007add2..2834be1 100644 --- a/hosts/arrow/main.tf +++ b/hosts/arrow/main.tf @@ -45,6 +45,13 @@ variable "vultr_api_key" { sensitive = true } +# https://api.vultr.com/v2/plans +variable "vultr_plan" { + type = string + description = "Size of instance to launch" + default = "vc2-1c-2gb" # 55 GB SSD ($10/mo) +} + provider "aws" { region = "auto" skip_credentials_validation = true @@ -75,7 +82,7 @@ resource "vultr_iso_private" "image" { } resource "vultr_instance" "arrow" { - plan = "vc2-1c-2gb" + plan = var.vultr_plan region = "ewr" iso_id = vultr_iso_private.image.id label = "arrow"