sidpalas / devops-directive-terraform-course

Companion repo for complete Terraform course
994 stars 1.62k forks source link

Error applying the tf template in 02-Overview exercise #7

Open carlos-salinas opened 2 years ago

carlos-salinas commented 2 years ago

It seems there are missing the definitions of VPC and Subnet resources in the template, because the executing fails as you can see the in the snippet below:

aws_instance.example: Creating...
Error: Error launching source instance: VPCIdNotSpecified: No default VPC for this user. GroupName is only supported for EC2-Classic and default VPC.     status code: 400, request id: ef9266e7-f56a-44fd-b0b3-65cf029252fc

with aws_instance.example,
on main.tf line 14, in resource "aws_instance" "example":
14: resource "aws_instance" "example" {

As workaround, I have added the required resources manually.

sidpalas commented 2 years ago

I think I created an EC2 instance via the web UI before setting up terraform, which created the default VPC/subnets.

Adding new VPC + subnets within the terraform configuration would be a great addition. Any interest in creating a pull request with that?

Apurva14A commented 1 year ago

Also there is need to provide the private key ,as it is required for instance creation.

tzujui commented 3 weeks ago

I think I created an EC2 instance via the web UI before setting up terraform, which created the default VPC/subnets.

Adding new VPC + subnets within the terraform configuration would be a great addition. Any interest in creating a pull request with that?

Hi Sid, I created a PR to fix this error!