title: How to create EC2 instance on LocalStack with terraform?
body: <p>I am trying to run EC2 instance on LocalStack using Terraform.</p>
  
  <p>After 50 minutes of trying to create the instance
  I got this response from terraform apply:</p>
  
  <blockquote>
    <p>Error: error getting EC2 Instance (i-cf4da152ddf3500e1) Credit
    Specifications: SerializationError: failed to unmarshal error message
      status code: 500, request id:  caused by: UnmarshalError: failed to
    unmarshal error message caused by: expected element type &lt;Response&gt;
    but have &lt;title&gt;</p>
    
    <p>on main.tf line 34, in resource "aws_instance" "example":   34:
    resource "aws_instance" "example" {</p>
  </blockquote>
  
  <p>For LocalStack and Terraform v0.12.18 I use this configuration:</p>
  
  <pre><code>provider "aws" {
    access_key                  = "mock_access_key"
    region                      = "us-east-1"
    s3_force_path_style         = true
    secret_key                  = "mock_secret_key"
    skip_credentials_validation = true
    skip_metadata_api_check     = true
    skip_requesting_account_id  = true
  
    endpoints {
      apigateway     = "http://localhost:4567"
      cloudformation = "http://localhost:4581"
      cloudwatch     = "http://localhost:4582"
      dynamodb       = "http://localhost:4569"
      es             = "http://localhost:4578"
      firehose       = "http://localhost:4573"
      iam            = "http://localhost:4593"
      kinesis        = "http://localhost:4568"
      lambda         = "http://localhost:4574"
      route53        = "http://localhost:4580"
      redshift       = "http://localhost:4577"
      s3             = "http://localhost:4572"
      secretsmanager = "http://localhost:4584"
      ses            = "http://localhost:4579"
      sns            = "http://localhost:4575"
      sqs            = "http://localhost:4576"
      ssm            = "http://localhost:4583"
      stepfunctions  = "http://localhost:4585"
      sts            = "http://localhost:4592"
      ec2            = "http://localhost:4597"
    }
  }
  
  resource "aws_instance" "example" {
    ami           = "ami-0c55b159cbfafe1f0"
    instance_type = "t2.micro"
  }
  </code></pre>
  
  <p>When I run LocalStack with docker-compose up directly from newest github (<a href="https://github.com/localstack/localstack" rel="nofollow noreferrer">https://github.com/localstack/localstack</a>)
  From logs I have seen that EC2 related endpoint was setup.</p>
  
  <p>I appreciate any advice that would help me to run EC2 on LocalStack.</p>