Skip to content

Latest commit

 

History

History
144 lines (114 loc) · 4 KB

File metadata and controls

144 lines (114 loc) · 4 KB
page_title subcategory description
Provider: Genesis Cloud
The Genesis Cloud provider is used to interact with resources supported by Genesis Cloud https://www.genesiscloud.com/. The provider needs to be configured with the proper credentials before it can be used.

Genesis Cloud Provider

The Genesis Cloud provider is used to interact with resources supported by Genesis Cloud. The provider needs to be configured with the proper credentials before it can be used.

The provider repository is licensed under Mozilla Public License 2.0 (no copyleft exception) (see LICENSE.txt) and includes third-party code subject to third-party notices (see THIRD-PARTY-NOTICES.txt).

Example Usage

  • Create a Genesis Cloud account
  • Create an API token (see above)
  • Set the GENESISCLOUD_TOKEN env var or specify the token in the provider
  • Make sure to set the version in the provider
terraform {
  required_providers {
    genesiscloud = {
      source = "genesiscloud/genesiscloud"
      # version = "..."
    }
  }
}

provider "genesiscloud" {
  # optional configuration...

  # set GENESISCLOUD_TOKEN env var or:
  # token = "..."
}

# Create an instance:

locals {
  region = "ARC-IS-HAF-1"
}

resource "genesiscloud_ssh_key" "alice" {
  name       = "alice"
  public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBOpdKM8wSI07+PO4xLDL7zW/kNWGbdFXeHyBU1TRlBn [email protected]"
}

resource "genesiscloud_security_group" "allow-ssh" {
  name   = "allow-ssh"
  region = local.region
  rules = [
    {
      direction      = "ingress"
      protocol       = "tcp"
      port_range_min = 22
      port_range_max = 22
    },
  ]
}

resource "genesiscloud_security_group" "allow-http" {
  name   = "allow-http"
  region = local.region
  rules = [
    {
      direction      = "ingress"
      protocol       = "tcp"
      port_range_min = 80
      port_range_max = 80
    }
  ]
}

resource "genesiscloud_security_group" "allow-https" {
  name   = "allow-https"
  region = local.region
  rules = [
    {
      direction      = "ingress"
      protocol       = "tcp"
      port_range_min = 443
      port_range_max = 443
    }
  ]
}

resource "genesiscloud_floating_ip" "floating_ip" {
  name        = "terraform-floating-ip"
  description = "The description for you terraform floating IP."
  region      = local.region
  version     = "ipv4"
}

resource "genesiscloud_instance" "instance" {
  name   = "terraform-instance"
  region = local.region

  image = "ubuntu-22.04"
  type  = "vcpu-4_memory-12g_nvidia-rtx-3080-1"

  ssh_key_ids = [
    genesiscloud_ssh_key.alice.id,
  ]

  security_group_ids = [
    genesiscloud_security_group.allow-ssh.id,
    genesiscloud_security_group.allow-http.id,
    genesiscloud_security_group.allow-https.id,
  ]

  floating_ip_id = genesiscloud_floating_ip.floating_ip.id

  disk_size = 128

  metadata = {
    startup_script = <<EOF
#!/bin/bash
set -eo pipefail

# Add startup script

EOF

  }
}

output "connect" {
  value = "ssh ubuntu@${genesiscloud_instance.instance.public_ip}"
}

Schema

Optional

  • endpoint (String) Genesis Cloud API endpoint. May also be provided via GENESISCLOUD_ENDPOINT environment variable. If neither is provided, defaults to https://api.genesiscloud.com/compute/v1.
  • polling_interval (String) The polling interval.
    • The string must be a positive time duration, for example "10s".
  • token (String, Sensitive) Genesis Cloud API token. May also be provided via GENESISCLOUD_TOKEN environment variable.