0
votes

I’m learning Terraform course ‘Learn DevOps: Infrastructure Automation With Terraform’ from Udemy. As per the exercise 'First steps in terraform - Spinning up an instance’ when i’m running ‘instance.tf’ i’m getting the below error.

Error: Error launching source instance: Unsupported: The requested configuration is currently not supported. Please check the documentation for supported configurations.
    status code: 400, request id: cbfbb2e8-35bd-4527-8da3-b59506c55b81

  on instance.tf line 7, in resource "aws_instance" "example":
   7: resource "aws_instance" "example" {

Here is my instance.tf file.

provider "aws" {
  access_key = "XXXXXXXXXXXXXXXXXX"
  secret_key = "XXXXXXXXXXXXXXXXXXXXXXXXXX"
  region     = "ap-south-1"
}

resource "aws_instance" "example" {
  ami           = "ami-0e175be6acf8b637d"
  instance_type = "t2.micro"
}

Please help.

3
For those coming here from google, this error usually means some resource option that you selected isn't available. In my case the selected region didn't have a "t2.micro" instance size.cawwot

3 Answers

3
votes

The code looks fine.

Please check if this AMI ami-0e175be6acf8b637d is exist in Asia Pacific region (Mumbai)

If not, you will get above error.

0
votes

You can resolve this issue after correct AMI details.

0
votes

Check the instance type on the region. On my case it did fail first but when i check the instance type I choose on the script, the instance type was not available on the region I specified. After changing the instance type it did work. Try it out

instance_type = "t3.micro" }