sidpalas / devops-directive-terraform-course

Companion repo for complete Terraform course
1.05k stars 1.69k forks source link

main example bugs - InvalidAMIID.NotFound and subnets in the same Availability Zone #27

Open inspiraller opened 2 months ago

inspiraller commented 2 months ago

Great demo. I notice when going over the first example - there are some bugs to tidy up.

using file: https://github.com/sidpalas/devops-directive-terraform-course/blob/main/03-basics/web-app/main.tf

terraform apply

Error launching source instance: InvalidAMIID.NotFound: The image id '[ami-011899242bb902164]' does not exist │ status code: 400, request id: 49825571-43a7-4e3c-9bdf-a5791485af2e │ │ with aws_instance.instance_2, │ on main.tf line 25, in resource "aws_instance" "instance_2": │ 25: resource "aws_instance" "instance_2" {

error creating application Load Balancer: InvalidConfigurationRequest: A load balancer cannot be attached to multiple subnets in the same Availability Zone │ status code: 400, request id: cc1296fe-9fc3-4759-94cd-e911975f3c69 │ │ with aws_lb.load_balancer, │ on main.tf line 150, in resource "aws_lb" "load_balancer": │ 150: resource "aws_lb" "load_balancer" {

ujwalchangappa commented 2 months ago

Please provide a valid AMI ID while creating instance. Click on launch instance and below you will find AMI id, use that ami id in your main.tf

inspiraller commented 2 months ago

@ujwalchangappa Hi thanks for reply. Yes I changed the AMI id which clears that error, but I still get the other error: error creating application Load Balancer: InvalidConfigurationRequest: A load balancer cannot be attached to multiple subnets in the same Availability Zone │ status code: 400, request id: cc1296fe-9fc3-4759-94cd-e911975f3c69 │ │ with aws_lb.load_balancer, │ on main.tf line 150, in resource "aws_lb" "load_balancer": │ 150: resource "aws_lb" "load_balancer" {