From 5c60f7f2c146952f752ee1375d9f1d28ea5f643f Mon Sep 17 00:00:00 2001 From: clint shryock Date: Wed, 9 Dec 2015 15:59:36 -0600 Subject: [PATCH] provider/aws: Trap Instance error from mismatched SG IDs and Names --- builtin/providers/aws/resource_aws_instance.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builtin/providers/aws/resource_aws_instance.go b/builtin/providers/aws/resource_aws_instance.go index f9f2a29d728c..f6b7ef69abfc 100644 --- a/builtin/providers/aws/resource_aws_instance.go +++ b/builtin/providers/aws/resource_aws_instance.go @@ -364,6 +364,13 @@ func resourceAwsInstanceCreate(d *schema.ResourceData, meta interface{}) error { time.Sleep(2 * time.Second) continue } + + // Warn if the AWS Error involves group ids, to help identify situation + // where a user uses group ids in security_groups for the Default VPC. + // See https://github.com/hashicorp/terraform/issues/3798 + if awsErr.Code() == "InvalidParameterValue" && strings.Contains(awsErr.Message(), "groupId is invalid") { + return fmt.Errorf("Error launching instance, possible mismatch of Security Group IDs and Names. See AWS Instance docs here: %s.\n\n\tAWS Error: %s", "https://terraform.io/docs/providers/aws/r/instance.html", awsErr.Message()) + } } break }