Skip to content

Commit

Permalink
Terraform config to provision EBS volumes for jupyter-home-nfs
Browse files Browse the repository at this point in the history
  • Loading branch information
sunu committed Sep 11, 2024
1 parent 1db5244 commit 81c2ef8
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
20 changes: 20 additions & 0 deletions terraform/aws/ebs-volumes.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
resource "aws_ebs_volume" "nfs_home_dirs" {
for_each = var.ebs_volumes

availability_zone = var.cluster_nodes_location
size = each.value.size
type = each.value.type
encrypted = true

tags = merge(each.value.tags, {
Name = each.value.name_suffix == null ? "hub-nfs-home-dirs" : "hub-nfs-home-dirs-${each.value.name_suffix}"
})

lifecycle {
prevent_destroy = true
}
}

output "ebs_volume_id_map" {
value = { for vol in values(aws_ebs_volume.nfs_home_dirs)[*] : vol.tags["Name"] => vol.id }
}
9 changes: 9 additions & 0 deletions terraform/aws/projects/nasa-veda.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -211,3 +211,12 @@ hub_cloud_permissions = {
},
},
}

ebs_volumes = {
"staging" = {
size = 100
type = "gp3"
name_suffix = "staging"
tags = {}
}
}
16 changes: 16 additions & 0 deletions terraform/aws/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -313,3 +313,19 @@ variable "enable_aws_ce_grafana_backend_iam" {
Create an IAM role with attached policy to permit read use of AWS Cost Explorer API.
EOT
}

variable "ebs_volumes" {
type = map(object({
size = number
type = string
name_suffix = optional(string, null)
tags = optional(map(string), {})
}))
default = {}
description = <<-EOT
Deploy one or more AWS ElasticBlockStore volumes.
This provisions a managed EBS volume that can be used by jupyter-home-nfs server
to store home directories for users.
EOT
}

0 comments on commit 81c2ef8

Please sign in to comment.