Skip to content

Commit

Permalink
fix: enable handling of vault through helmfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
msvticket committed Jul 2, 2024
1 parent 849a5fc commit a9543fb
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 22 deletions.
3 changes: 1 addition & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,7 @@ module "cluster" {
// ----------------------------------------------------------------------------
module "vault" {
source = "./modules/vault"
external_vault = local.external_vault
use_vault = var.use_vault
resource_count = var.use_vault && !local.external_vault && var.install_vault ? 1 : 0
}

// ----------------------------------------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions modules/vault/charts.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
resource "helm_release" "vault-operator" {
count = local.create_vault_resources ? 1 : 0
count = var.resource_count
name = "vault-operator"
chart = "vault-operator"
namespace = "jx-vault"
Expand All @@ -9,7 +9,7 @@ resource "helm_release" "vault-operator" {
}

resource "helm_release" "vault-instance" {
count = local.create_vault_resources ? 1 : 0
count = var.resource_count
name = "vault-instance"
chart = "vault-instance"
namespace = "jx-vault"
Expand Down
4 changes: 0 additions & 4 deletions modules/vault/local.tf

This file was deleted.

17 changes: 3 additions & 14 deletions modules/vault/variables.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
// ----------------------------------------------------------------------------
// Optional Variables // Optional Variables
// ----------------------------------------------------------------------------

variable "external_vault" {
description = "Whether or not Jenkins X creates and manages the Vault instance. If set to true a external Vault URL needs to be provided"
type = bool
default = false
}

variable "use_vault" {
description = "Flag to control vault resource creation"
type = bool
default = true
variable "resource_count" {
description = "Number of resources to create (0 or 1)"
type = number
}
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ variable "vault_url" {
default = ""
}

variable "install_vault" {
description = "Whether or not this modules creates and manages the Vault instance. If set to false and use_vault is true either an external Vault URL needs to be provided or you need to install vault operator and instance using helmfile."
type = bool
default = true
}

// ----------------------------------------------------------------------------
// Velero/backup
// ----------------------------------------------------------------------------
Expand Down

0 comments on commit a9543fb

Please sign in to comment.