From 3850c300c83ddad4e24e2e4e3fba2affa5cbdc8b Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Tue, 5 Oct 2021 11:36:56 +0100 Subject: [PATCH] Add Equinix Metal Terraform config Used for a new blog post and the hosted Derek service. Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- contrib/terraform-equinixmetal/.gitignore | 3 ++ .../.terraform.lock.hcl | 42 +++++++++++++++++++ .../example.main.tfvars | 8 ++++ contrib/terraform-equinixmetal/main.tf | 31 ++++++++++++++ contrib/terraform-equinixmetal/output.tf | 27 ++++++++++++ contrib/terraform-equinixmetal/variables.tf | 41 ++++++++++++++++++ 6 files changed, 152 insertions(+) create mode 100644 contrib/terraform-equinixmetal/.gitignore create mode 100644 contrib/terraform-equinixmetal/.terraform.lock.hcl create mode 100644 contrib/terraform-equinixmetal/example.main.tfvars create mode 100644 contrib/terraform-equinixmetal/main.tf create mode 100644 contrib/terraform-equinixmetal/output.tf create mode 100644 contrib/terraform-equinixmetal/variables.tf diff --git a/contrib/terraform-equinixmetal/.gitignore b/contrib/terraform-equinixmetal/.gitignore new file mode 100644 index 0000000..5273650 --- /dev/null +++ b/contrib/terraform-equinixmetal/.gitignore @@ -0,0 +1,3 @@ +/main.tfvars +/.terraform +/*.tfstate diff --git a/contrib/terraform-equinixmetal/.terraform.lock.hcl b/contrib/terraform-equinixmetal/.terraform.lock.hcl new file mode 100644 index 0000000..075a049 --- /dev/null +++ b/contrib/terraform-equinixmetal/.terraform.lock.hcl @@ -0,0 +1,42 @@ +# This file is maintained automatically by "terraform init". +# Manual edits may be lost in future updates. + +provider "registry.terraform.io/equinix/metal" { + version = "3.2.0" + constraints = ">= 3.0.0" + hashes = [ + "h1:SzC4gFRhDkT/+KY9SaqXPEU0VJKtiMh572eMTCcfuXY=", + "zh:4a53b56d7cab5a75dca16c4a285438f13fe07a37c45967668dae8e4a70b78a85", + "zh:4fa88d43bd2370e420de6238f02f8ad668a0cd9e7f010a24a8bc0a76982ff3bc", + "zh:525b0f6d977437388b7ee7428bccd351e46af39a0883ce08f624b4dd173de8c2", + "zh:5c906ee75fbd1daa63dc40221015bfdcea7cec24ed7aa3687fcc18265556e379", + "zh:6153771a66d1f5058e977a686e706f3ced64cbcb7cd623a9adf7e8ed3f0d08d8", + "zh:79dd26afcc0846864ede59e79ae07fdf6cc084315cd9e50f4e09c700d9d8dfb4", + "zh:992e410067995537565f38ad9f93f4d66fabdc25a8303a1be418aefaf172daae", + "zh:9e52d2d008846cb6db8d0cd0aac7e1c6c635fc65c192b0217b2e673d165def0f", + "zh:c2ca5c36358c03c996d97b8baca6809675f54010c021d5704124bd3815660c86", + "zh:e2d4bfae4489142cfac31fb7939047226335c0fddf59c3544faeb1f3029a36d8", + "zh:e5c6727b6404beb3aa54bbc7eb3145bac29bab8135771f21754e093c178ee23f", + "zh:ecf34c7c8b3eb8cd61b381d8f26ec61b3d8b5d57a87fff97cb24331230286fef", + "zh:fcae7646861ccf3393828ac53d05487ba8547cf9f8a9da13553dcedf8dd2646e", + ] +} + +provider "registry.terraform.io/hashicorp/random" { + version = "3.1.0" + constraints = ">= 3.1.0" + hashes = [ + "h1:BZMEPucF+pbu9gsPk0G0BHx7YP04+tKdq2MrRDF1EDM=", + "zh:2bbb3339f0643b5daa07480ef4397bd23a79963cc364cdfbb4e86354cb7725bc", + "zh:3cd456047805bf639fbf2c761b1848880ea703a054f76db51852008b11008626", + "zh:4f251b0eda5bb5e3dc26ea4400dba200018213654b69b4a5f96abee815b4f5ff", + "zh:7011332745ea061e517fe1319bd6c75054a314155cb2c1199a5b01fe1889a7e2", + "zh:738ed82858317ccc246691c8b85995bc125ac3b4143043219bd0437adc56c992", + "zh:7dbe52fac7bb21227acd7529b487511c91f4107db9cc4414f50d04ffc3cab427", + "zh:a3a9251fb15f93e4cfc1789800fc2d7414bbc18944ad4c5c98f466e6477c42bc", + "zh:a543ec1a3a8c20635cf374110bd2f87c07374cf2c50617eee2c669b3ceeeaa9f", + "zh:d9ab41d556a48bd7059f0810cf020500635bfc696c9fc3adab5ea8915c1d886b", + "zh:d9e13427a7d011dbd654e591b0337e6074eef8c3b9bb11b2e39eaaf257044fd7", + "zh:f7605bd1437752114baf601bdf6931debe6dc6bfe3006eb7e9bb9080931dca8a", + ] +} diff --git a/contrib/terraform-equinixmetal/example.main.tfvars b/contrib/terraform-equinixmetal/example.main.tfvars new file mode 100644 index 0000000..38d0570 --- /dev/null +++ b/contrib/terraform-equinixmetal/example.main.tfvars @@ -0,0 +1,8 @@ +auth_token = "" // your Equinix Personal API Key +project = "" // your Equinix Project name +name = "derek" +#domain = "derek.example.com" +#email = "" +metro = "am" +plan = "c3.small.x86" +ufw_enabled = true diff --git a/contrib/terraform-equinixmetal/main.tf b/contrib/terraform-equinixmetal/main.tf new file mode 100644 index 0000000..4c45ed2 --- /dev/null +++ b/contrib/terraform-equinixmetal/main.tf @@ -0,0 +1,31 @@ +terraform { + required_providers { + metal = { + source = "equinix/metal" + } + } +} + +# Configure the Equinix Metal Provider. +provider "metal" { + auth_token = var.auth_token +} + +data "metal_project" "project" { + name = var.project +} + +module "faasd" { + source = "github.com/jsiebens/terraform-equinix-faasd" + + project_id = data.metal_project.project.id + name = var.name + domain = var.domain + email = var.email + + plan = var.plan + metro = var.metro + ufw_enabled = var.ufw_enabled + project_ssh_key_ids = [] +} + diff --git a/contrib/terraform-equinixmetal/output.tf b/contrib/terraform-equinixmetal/output.tf new file mode 100644 index 0000000..31eefc1 --- /dev/null +++ b/contrib/terraform-equinixmetal/output.tf @@ -0,0 +1,27 @@ +output "summary" { + value = <