Last active
June 13, 2020 11:39
-
-
Save iamtheindian/4a9becbd2fc1e6ea709e494884c46102 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#creation of ebs volume | |
resource "aws_ebs_volume" "myvol" { | |
depends_on =[aws_instance.webos] | |
availability_zone = aws_instance.webos.availability_zone | |
size = 1 | |
tags = { | |
Name = "myvolume" | |
} | |
} | |
resource "aws_volume_attachment" "ebs_att" { | |
depends_on = [aws_ebs_volume.myvol] | |
device_name = "/dev/sdd" | |
volume_id = aws_ebs_volume.myvol.id | |
instance_id = aws_instance.webos.id | |
force_detach = true | |
} | |
///////////////////////////////////////////////////// | |
#create snapshot of aws ebs volume | |
resource "aws_ebs_snapshot" "snapshot" { | |
depends_on = [null_resource.nl1] | |
volume_id = "${aws_ebs_volume.myvol.id}" | |
tags = { | |
Name = "terraform ebs snap" | |
} | |
} | |
output "snapshot_id" { | |
value = aws_ebs_snapshot.snapshot.id | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment