Not able to deploy the ec2 instances using modules getting the error like below

Error: error collecting instance settings: InvalidAMIID.NotFound: The image id ‘[ami-0202869bdd0fc8c75]’ does not exist
│ status code: 400, request id: cfb2e241-1ed5-45e2-b0ce-5353135efa14

│ with module.Ireland-ec2-1.aws_instance.LSFMASTER_M[0],
│ on modules\ec2\ec2-UR.tf line 1, in resource “aws_instance” “LSFMASTER_M”:
│ 1: resource “aws_instance” “LSFMASTER_M” {



│ Error: error collecting instance settings: InvalidAMIID.NotFound: The image id ‘[ami-0202869bdd0fc8c75]’ does not exist
│ status code: 400, request id: 333b0bac-6dba-44ff-a066-6a1762e6d9c8

│ with module.Ireland-ec2-2.aws_instance.LSFMASTER_M[0],
│ on modules\ec2\ec2-UR.tf line 1, in resource “aws_instance” “LSFMASTER_M”:
│ 1: resource “aws_instance” “LSFMASTER_M” {



│ Error: error creating Security Group (ec2_security): InvalidVpcID.NotFound: The vpc ID ‘vpc-07cd5a105544d08cc’ does not exist
│ status code: 400, request id: 8e434891-3db1-42dc-8182-9392c59ffe99

│ with module.dev_sg.aws_security_group.allow_all,
│ on modules\sg\sg-UR.tf line 1, in resource “aws_security_group” “allow_all”:
│ 1: resource “aws_security_group” “allow_all” {

But actually VPC and AMI’s are availble , why terraform modules not picking up those??, pls help ASAP its urgent.

Thanks,
Jagadeesh.

Hello Jagadeesh

Is it possible to enable and share the trace run logs?
You can enable and save them by setting the following environment variables and do a new run.

TF_LOG - Enables detailed logs to appear on stderr which is useful for debugging. For example:

export TF_LOG=trace

TF_LOG_PATH - This specifies where the log should persist its output to. Note that even when TF_LOG_PATH is set, TF_LOG must be set in order for any logging to be enabled. For example, to always write the log to the directory you’re currently running terraform from:

export TF_LOG_PATH=./terraform.log

With this log we can trace every step took by terraform and it should help understand your issue.

Best Regards,
Kiril Krastev

Hello Jagadeesh,

Just a note, please review the logs for sensitive data and remove it.

Best Regards,
Kiril