Skip to content

Commit

Permalink
fix: allow this module to be reused
Browse files Browse the repository at this point in the history
  • Loading branch information
ctreatma committed Apr 26, 2024
1 parent 7cb86c4 commit 931b76e
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 5 deletions.
32 changes: 32 additions & 0 deletions examples/deploy/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
terraform {
required_version = ">= 1.0"
required_providers {
equinix = {
source = "equinix/equinix"
version = ">= 1.30"
}
}
}

# Configure the Equinix Metal Provider.
provider "equinix" {
auth_token = var.metal_auth_token
}

module "nutanix" {
source = "../../"

metal_auth_token = var.metal_auth_token
metal_vlan_description = var.metal_vlan_description
metal_project_name = var.metal_project_name
metal_project_id = var.metal_project_id
metal_organization_id = var.metal_organization_id
metal_metro = var.metal_metro
create_project = var.create_project
metal_bastion_plan = var.metal_bastion_plan
create_vlan = var.create_vlan
metal_vlan_id = var.metal_vlan_id
nutanix_node_count = var.nutanix_node_count
skip_cluster_creation = var.skip_cluster_creation
nutanix_reservation_ids = var.nutanix_reservation_ids
}
87 changes: 87 additions & 0 deletions examples/deploy/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
variable "metal_auth_token" {
type = string
sensitive = true
description = "Equinix Metal API token."
}

variable "metal_vlan_description" {
type = string
default = "ntnx-demo"
description = "Description to add to created VLAN."
}

variable "metal_project_name" {
type = string
default = ""
description = <<EOT
The name of the Metal project in which to deploy the cluster. If `create_project` is false and
you do not specify a project ID, the project will be looked up by name. One (and only one) of
`metal_project_name` or `metal_project_id` is required or `metal_project_id` must be set.
Required if `create_project` is true.
EOT
}

variable "metal_project_id" {
type = string
default = ""
description = <<EOT
The ID of the Metal project in which to deploy to cluster. If `create_project` is false and
you do not specify a project name, the project will be looked up by ID. One (and only one) of
`metal_project_name` or `metal_project_id` is required or `metal_project_id` must be set.
EOT
}

variable "metal_organization_id" {
type = string
default = null
description = "The ID of the Metal organization in which to create the project if `create_project` is true."
}

variable "metal_metro" {
type = string
description = "The metro to create the cluster in."
}
variable "create_project" {
type = bool
default = true
description = "(Optional) to use an existing project matching `metal_project_name`, set this to false."
}

variable "metal_bastion_plan" {
type = string
default = "c3.small.x86"
description = "Which plan to use for the bastion host."
}

variable "create_vlan" {
type = bool
default = true
description = "Whether to create a new VLAN for this project."
}
variable "metal_vlan_id" {
type = number
default = null
description = "ID of the VLAN you wish to use."
}

variable "nutanix_node_count" {
type = number
default = 3
description = "The number of Nutanix nodes to create."
}

variable "skip_cluster_creation" {
type = bool
default = false
description = "Skip the creation of the Nutanix cluster."
}

variable "nutanix_reservation_ids" {
type = list(string)
default = []
description = <<EOT
Hardware reservation IDs to use for the Nutanix nodes. If specified, the length of this list must
be the same as `nutanix_node_count`. Each item can be a reservation UUID or `next-available`. If
you use reservation UUIDs, make sure that they are in the same metro specified in `metal_metro`.
EOT
}
5 changes: 0 additions & 5 deletions providers.tf
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,3 @@ terraform {
}
}
}

# Configure the Equinix Metal Provider.
provider "equinix" {
auth_token = var.metal_auth_token
}

0 comments on commit 931b76e

Please sign in to comment.