-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Description
Two of my instance require an ebs volume and I'm trying to get it set up.
I tried using a block in the calling module, but it complains that should be type list, got map
(see commented section below).
Is it best practice to create an aws_ebs_volume
and then reference it in the calling module?
Thanks for any tips,
Chris.
# create the required volume
resource "aws_ebs_volume" "example1" {
availability_zone = "us-west-2a"
size = 40
tags {
Name = "HelloWorld"
}
}
module "ec2_myinstance" {
source = "terraform-aws-modules/ec2-instance/aws"
name = "my-instance"
count = 5
ami = "ami-ebd02392"
instance_type = "t2.micro"
key_name = "user1"
monitoring = true
vpc_security_group_ids = ["sg-12345678"]
# <==== set the ebs_block_device
ebs_block_device = "${aws_ebs_volume.example1.id}"
# tried this, did not work:
# ebs_block_device = {
# volume_size = 40
# volume_type = "gp2"
# # delete_on_termination = false
# }
tags = {
Terraform = "true"
Environment = "dev"
}
}
Metadata
Metadata
Assignees
Labels
No labels