Closed 0xfourzerofour closed 1 month ago
Hello @0xfourzerofour, hope you are doing well. Recently, we have had a lot of changes in our Terraform provider, and we're in the process of updating our examples to reflect that.
That being said, this second error should not be happening. Can you check if the Terraform version you're using is v1.1.3
and if the default values in the variables.tf
file are filled in?
Also, can you check if the latitudesh_server
resources inside the nomad_client.tf
and nomad_server.tf
files have all the required attributes (hostname
, operating_system
, plan
, project
, site
)?
resource "latitudesh_server" "nomad_servers" {
count = var.nomad_server_count
hostname = "nomad-server-${count.index + 1}"
operating_system = "ubuntu_22_04_x64_lts"
site = var.nomad_region
plan = var.plan
project = var.project_id
ssh_keys = [var.ssh_key_id]
provisioner "file" {
connection {
host = self.primary_ipv4
user = "ubuntu"
private_key = file(var.private_key_path)
}
source = "./nomad-setup-scripts/nomad-installations.sh"
destination = "/tmp/nomad-installations.sh"
}
provisioner "remote-exec" {
connection {
host = self.primary_ipv4
user = "ubuntu"
private_key = file(var.private_key_path)
}
inline = [
# Add executable permission to the script, the execute it.
"chmod +x /tmp/nomad-installations.sh",
"sudo /tmp/nomad-installations.sh"
]
}
}
this is my setup
variable "LATITUDESH_AUTH_TOKEN" {
description = "Latitude.sh API token"
}
variable "project_id" {
description = "ID of the Project to deploy to"
default = "{my_id)"
}
// Plan
variable "plan" {
description = "Plan to use for deployment. Plan is the instance type slug. You can find this in the /plans endpoint of the API."
default = "s2-small-x86"
}
// Nomad setup
variable "nomad_server_count" {
description = "The number of Nomad/Consul server instances to create."
default = 1
}
variable "nomad_client_count" {
description = "The number of Nomad/Consul client instances to create."
default = 1
}
variable "nomad_region" {
default = "NYC"
}
variable "nomad_vlan_id" {
description = "Value of the VLAN ID (VID) to use for the Nomad/Consul instances."
default = "{vlan_id}"
}
variable "ssh_key_id" {
}
variable "private_key_path" {
description = "The path to the private key on your computer. This is used to connect to the instances and install the cluster."
default = "~/.ssh/latitude"
}
terraform {
required_providers {
latitudesh = {
source = "latitudesh/latitudesh"
version = "0.2.6"
}
}
}
provider "latitudesh" {
auth_token = var.LATITUDESH_AUTH_TOKEN
}
@ynhummel
@0xfourzerofour Nice, so just for confirmation, after changing the version in the main.tf file from 0.2.6
to 1.1.3
and running terraform init --upgrade
, does this problem still persist?
example main.tf
:
terraform {
required_providers {
latitudesh = {
source = "latitudesh/latitudesh"
version = "1.1.3"
}
}
}
yeh I can confirm it still gives me the error. I tried to use TF_DEBUG and TF_TRACE but it did not spit out the body being sent to the latitude api unfortunately
Alright, this is really strange. I'll run some tests to try to find out why this is happening.
Thank you! I appreciate the quick response
Hi @0xfourzerofour, sorry about the delay. We've made general updates to the Nomad-Consul example that should solve your issue and also improve usability. We will also update the Guide shortly, but the biggest change is that now you won't need to set the VLAN manually; the Terraform script will take care of that for you.
Basically, by copying the contents of the Nomad-Consul folder, exporting your API-token, and running terraform init
and terraform apply
, everything should be up and running!
If you have any other issues, or if this one persists, please feel free to reopen the issue!
@0xfourzerofour please let us know how the updated guide treats you :)
Using the version that is linked 0.2.6 I get an error based on the ssh key as the latitude server
ssh_keys
is expecting a list of numbers instead of a stringWhen I upgrade to the newest version of the provider I get an error that is not too descriptive coming back from the latitude api.