From a3cc0f784939b929f3c54276ae804874d686cb82 Mon Sep 17 00:00:00 2001 From: Jake Howard Date: Fri, 21 Feb 2020 18:44:25 +0000 Subject: [PATCH] Init terraform --- .gitignore | 37 +++++++++++++++++++++++++++++++++++++ scripts/terraform-apply.sh | 7 +++++++ scripts/terraform-lint.sh | 7 +++++++ scripts/terraform-plan.sh | 7 +++++++ terraform/casey_vps.tf | 6 ++++++ terraform/providers.tf | 5 +++++ terraform/variables.tf | 1 + 7 files changed, 70 insertions(+) create mode 100755 scripts/terraform-apply.sh create mode 100755 scripts/terraform-lint.sh create mode 100755 scripts/terraform-plan.sh create mode 100644 terraform/casey_vps.tf create mode 100644 terraform/providers.tf create mode 100644 terraform/variables.tf diff --git a/.gitignore b/.gitignore index a1eb6b8..9ab2214 100644 --- a/.gitignore +++ b/.gitignore @@ -113,3 +113,40 @@ dmypy.json # End of https://www.gitignore.io/api/python,ansible env/ ansible/.vault_pass + +# Created by https://www.gitignore.io/api/terraform +# Edit at https://www.gitignore.io/?templates=terraform + +### Terraform ### +# Local .terraform directories +**/.terraform/* + +# .tfstate files +*.tfstate +*.tfstate.* + +# Crash log files +crash.log + +# Ignore any .tfvars files that are generated automatically for each Terraform run. Most +# .tfvars files are managed as part of configuration and so should be included in +# version control. +# +# example.tfvars + +# Ignore override files as they are usually used to override resources locally and so +# are not checked in +override.tf +override.tf.json +*_override.tf +*_override.tf.json + +# Include override files you do wish to add to version control using negated pattern +# !example_override.tf + +# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan +# example: *tfplan* + +# End of https://www.gitignore.io/api/terraform + +terraform/secrets.auto.tfvars diff --git a/scripts/terraform-apply.sh b/scripts/terraform-apply.sh new file mode 100755 index 0000000..0023776 --- /dev/null +++ b/scripts/terraform-apply.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -ex + +cd terraform/ + +terraform apply diff --git a/scripts/terraform-lint.sh b/scripts/terraform-lint.sh new file mode 100755 index 0000000..80088c1 --- /dev/null +++ b/scripts/terraform-lint.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e + +cd terraform/ + +terraform fmt -check -recursive diff --git a/scripts/terraform-plan.sh b/scripts/terraform-plan.sh new file mode 100755 index 0000000..a1ec465 --- /dev/null +++ b/scripts/terraform-plan.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -ex + +cd terraform/ + +terraform plan diff --git a/terraform/casey_vps.tf b/terraform/casey_vps.tf new file mode 100644 index 0000000..3ef215b --- /dev/null +++ b/terraform/casey_vps.tf @@ -0,0 +1,6 @@ +resource "vultr_server" "casey" { + plan_id = 200 + region_id = 8 + os_id = 159 + hostname = "casey" +} diff --git a/terraform/providers.tf b/terraform/providers.tf new file mode 100644 index 0000000..2ffc58c --- /dev/null +++ b/terraform/providers.tf @@ -0,0 +1,5 @@ +provider "vultr" { + api_key = var.vultr_api_key + rate_limit = 700 + retry_limit = 3 +} diff --git a/terraform/variables.tf b/terraform/variables.tf new file mode 100644 index 0000000..273d694 --- /dev/null +++ b/terraform/variables.tf @@ -0,0 +1 @@ +variable "vultr_api_key" {}