I came across an issue while launching a single ec2 instance (with existing AMI having volume size=32GB) using the ec2-instance gruntwork module in terraform-aws-service-catalog. It does not allow the creation of root volume with the given snapshot id (size=32GB). The error popped up while launching ec2 instance -
module.demo_instance.module.ec2_instance.aws_instance.instance: Creating...
Error: Error launching source instance: InvalidBlockDeviceMapping: Volume of size 8GB is smaller than snapshot 'snap-0850762dcfacpb2957', expect size >= 32GBB
on .terraform/modules/demo_instance.ec2_instance/modules/single-server/main.tf line 23, in resource "aws_instance" "instance":
23: resource "aws_instance" "instance" {
I see ec2 instance is using single-server module from terraform-aws-server and it has a default root_volume_size of 8GB which can't be modifiable from the ec2-instance module. And it seems that the ebs_volume I am trying to attach to ec2 instance is not working
module "demo_instance" {
source = "git::git@github.com:gruntwork-io/terraform-aws-service-catalog.git//modules/services/ec2-instance?ref=v0.44.5"
name = "${var.name}-${var.account_name}"
instance_type = var.instance_type
ami = "ami-03a0a2de6ce3aq7ff7"
ami_filters = null
enable_ssh_grunt = false
keypair_name = local.key_pair_name
vpc_id = var.vpc_id
subnet_id = var.subnet_ids[0]
ebs_volumes = {
"demo-volume" = {
type = "gp2"
size = 32
snapshot_id = "snap-0850762dcfacpb2957"
},
}
allow_ssh_from_cidr_blocks = var.allow_ssh_from_cidr_list
allow_ssh_from_security_group_ids = []
allow_port_from_cidr_blocks = {}
allow_port_from_security_group_ids = {}
route53_zone_id = ""
dns_zone_is_private = true
route53_lookup_domain_name = ""
}
Is there any way to modify the default value (8GB) of root_volume_size using ec2-instance gruntwork module ? Any help would be appreciated.