I am working on setting up a Cloud9 environment using Terraform, I ran into an issue when it comes to my Terraform apply and specifically:
Error: Error applying plan: 1 error(s) occurred: * aws_instance.cloud9Test: 1 error(s) occurred: * aws_instance.cloud9Test: Error launching instance, possible mismatch of Security Group IDs and Names. See AWS Instance docs here: https://terraform.io/docs/providers/aws/r/instance.html. AWS Error: Value () for parameter groupId is invalid. The value cannot be empty Here is my Terraform code that seems to be related and causing the issue.
resource "aws_vpc" "cloud9Test" { cidr_block = "10.0.0.0/16" instance_tenancy = "dedicated" tags = { Name = "cloud9Test" } } resource "aws_security_group" "cloud9Test" { name = "cloud9Test-sg" description = "Cloud9 Group" vpc_id = "${aws_vpc.cloud9Test.id}" } When I comment out the vpc_id in the security group I don't have the issue anymore but I do want the security group inside my VPC.
How do I fix this?
Note I do not have anything that should overlap causing an issue, this is a fairly new account with only 3 ec2 instances and 1 cloud9 instance all created manually