Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform config to provision EBS volumes for jupyter-home-nfs #4783

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
}