From 75bbcd36c4ab3ae0ff052c2a6ec71246fe70f63e Mon Sep 17 00:00:00 2001 From: Steven Dickenson Date: Mon, 4 Nov 2024 12:11:57 -0500 Subject: [PATCH] Add support for creating EBS volume from a snapshot --- main.tf | 4 ++-- variables.tf | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 963e967..f36b220 100644 --- a/main.tf +++ b/main.tf @@ -74,12 +74,12 @@ resource "aws_autoscaling_group" "this" { } } - resource "aws_ebs_volume" "data" { count = var.ebs_data_volume ? 1 : 0 availability_zone = var.availability_zone - size = var.ebs_volume_size + size = var.ebs_volume_snapshot_id == "" ? var.ebs_volume_size : null + snapshot_id = var.ebs_volume_snapshot_id == "" ? null : var.ebs_volume_snapshot_id tags = merge(var.tags, { diff --git a/variables.tf b/variables.tf index ab7db5c..6d47fca 100644 --- a/variables.tf +++ b/variables.tf @@ -195,10 +195,17 @@ variable "ebs_data_volume" { } variable "ebs_volume_size" { + default = 100 description = "Size of Nexus data volume in GB" type = number } +variable "ebs_volume_snapshot_id" { + default = "" + description = "Snapshot ID to use as source for new EBS volume" + type = string +} + ######################################## # EFS Vars ########################################