Skip to content

Commit

Permalink
Make "active-active" a valid production_type value (#249)
Browse files Browse the repository at this point in the history
The active-active mode used to be identified by the vm_node_count parameter. This breaks possible workflows when someone wants to modify the node_count to a value lower than 2 for maintenance or other reasons.

This adds a non-breaking change to decouple the active-active mode from the vm_node_count parameter.
  • Loading branch information
Miguel Hernández authored May 31, 2024
1 parent 59d3d4c commit 051a9fb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
5 changes: 2 additions & 3 deletions locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
locals {
# TFE Architecture
# ----------------
# Determine whether or not TFE in active-active mode based on node count, by default standalone is assumed
active_active = var.vm_node_count >= 2 ? true : false
disk_mode = var.production_type == "disk" ? true : false
active_active = var.vm_node_count >= 2 || var.production_type == "active-active"
disk_mode = var.production_type == "disk"

# Network
# -------
Expand Down
10 changes: 3 additions & 7 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -916,16 +916,12 @@ variable "tls_version" {
variable "production_type" {
default = null
type = string
description = "Where Terraform Enterprise application data will be stored. Valid values are `external`, `disk`, or `null`. Choose `external` when storing application data in an external object storage service and database. Choose `disk` when storing application data in a directory on the Terraform Enterprise instance itself. Leave it `null` when you want Terraform Enterprise to use its own default."
description = "Where Terraform Enterprise application data will be stored. Valid values are `external`, `disk`, `active-active` or `null`. Choose `external` when storing application data in an external object storage service and database. Choose `disk` when storing application data in a directory on the Terraform Enterprise instance itself. Chose `active-active` when deploying more than 1 node. Leave it `null` when you want Terraform Enterprise to use its own default."

validation {
condition = (
var.production_type == "external" ||
var.production_type == "disk" ||
var.production_type == null
)
condition = contains(["external", "disk", "active-active", null], var.production_type)

error_message = "The production_type must be 'external', 'disk', or omitted."
error_message = "The production_type must be 'external', 'disk', `active-active` or omitted."
}
}

Expand Down

0 comments on commit 051a9fb

Please sign in to comment.