update examples

This commit is contained in:
Marius Pana 2022-03-01 12:58:33 +02:00
parent 8a39458fab
commit 0ec17ed585
3 changed files with 60 additions and 0 deletions

3
README
View File

@ -1 +1,4 @@
# coming soon
Terraform templates and examples for use with spearhead.coud or other triton providers.
In the root directory you will find some templates to help get you started.

46
triton/main.tf.tpl Normal file
View File

@ -0,0 +1,46 @@
terraform {
required_providers {
triton = {
source = "joyent/triton"
version = "0.8.2"
}
}
}
provider "triton" {
account = "username"
key_id = "key:id"
url = "https://eu-ro-1.api.spearhead.cloud"
key_material = "/path/to/id_rsa"
insecure_skip_tls_verify = false
}
resource "triton_machine" "internal_resource_name" {
count = var.instance_count
name = "linux-${count.index + 1}"
package = "standard-2cpu-4ram-100disk"
image = "b70d5484-5168-4ecb-8127-0a0c59c1d906"
provisioner "file" {
source = "scripts/setup.sh"
destination = "/var/tmp/setup.sh"
}
provisioner "remote-exec" {
inline = [
"bash /var/tmp/setup.sh",
]
}
connection {
type = "ssh"
host = self.primaryip
user = "ubuntu"
}
cns {
services = ["${var.service_name}"]
}
}

11
triton/variables.tf.tpl Normal file
View File

@ -0,0 +1,11 @@
variable "instance_count" {
description = "Number of triton instances to create"
type = number
default = 8
}
variable "service_name" {
type = string
description = "The name of the service in CNS."
default = "somename"
}