title: AWS API Gateway and static HTML: "Execution failed due to configuration error: statusCode should be an integer which defined in request template"
body: <p>I am trying to serve a static content using AWS API Gateway.
  When I attempt to invoke the URL, both from the test page and from <code>curl</code>, I get the error:  </p>
  
  <blockquote>
    <p>"Execution failed due to configuration error: statusCode should be an integer which defined in request template".</p>
  </blockquote>
  
  <p>This is my configuration on Terraform:</p>
  
  <pre><code>resource "aws_api_gateway_rest_api" "raspberry_api" {
    name        = "raspberry_api"
  }
  
  resource "aws_acm_certificate" "raspberry_alexa_mirko_io" {
    domain_name       = "raspberry.alexa.mirko.io"
    validation_method = "DNS"
  
    lifecycle {
      create_before_destroy = true
    }
  }
  
  resource "aws_route53_record" "raspberry_alexa_mirko_io_cert_validation" {
    name    = aws_acm_certificate.raspberry_alexa_mirko_io.domain_validation_options.0.resource_record_name
    type    = aws_acm_certificate.raspberry_alexa_mirko_io.domain_validation_options.0.resource_record_type
    zone_id = var.route53_zone_id
    records = [aws_acm_certificate.raspberry_alexa_mirko_io.domain_validation_options.0.resource_record_value]
    ttl     = 60
  }
  
  resource "aws_route53_record" "raspberry_alexa_mirko_io" {
    zone_id = var.route53_zone_id
    name = aws_acm_certificate.raspberry_alexa_mirko_io.domain_name
    type = "A"
    alias {
      name = aws_api_gateway_domain_name.raspberry_alexa_mirko_io.cloudfront_domain_name
      zone_id = aws_api_gateway_domain_name.raspberry_alexa_mirko_io.cloudfront_zone_id
      evaluate_target_health = true
    }
  }
  
  resource "aws_acm_certificate_validation" "raspberry_alexa_mirko_io" {
    certificate_arn         = aws_acm_certificate.raspberry_alexa_mirko_io.arn
    validation_record_fqdns = [aws_route53_record.raspberry_alexa_mirko_io_cert_validation.fqdn]
    provider = aws.useast1
  }
  
  resource "aws_api_gateway_domain_name" "raspberry_alexa_mirko_io" {
    certificate_arn = aws_acm_certificate_validation.raspberry_alexa_mirko_io.certificate_arn
    domain_name     = aws_acm_certificate.raspberry_alexa_mirko_io.domain_name
  }
  
  resource "aws_api_gateway_base_path_mapping" "raspberry_alexa_mirko_io_base_path_mapping" {
    api_id      = aws_api_gateway_rest_api.raspberry_api.id
    domain_name = aws_api_gateway_domain_name.raspberry_alexa_mirko_io.domain_name
  }
  
  resource "aws_api_gateway_resource" "home" {
    rest_api_id = aws_api_gateway_rest_api.raspberry_api.id
    parent_id   = aws_api_gateway_rest_api.raspberry_api.root_resource_id
    path_part   = "login"
  }
  
  resource "aws_api_gateway_method" "login" {
    rest_api_id   = aws_api_gateway_rest_api.raspberry_api.id
    resource_id   = aws_api_gateway_resource.home.id
    http_method   = "GET"
    authorization = "NONE"
  }
  
  resource "aws_api_gateway_integration" "integration" {
    rest_api_id             = aws_api_gateway_rest_api.raspberry_api.id
    resource_id             = aws_api_gateway_resource.subscribe_raspberry.id
    http_method             = aws_api_gateway_method.subscribe.http_method
    integration_http_method = "POST"
    type                    = "AWS_PROXY"
    uri                     = aws_lambda_function.raspberry_lambda.invoke_arn
    # This was just a failed attempt. It did not fix anything
    request_templates = {
      "text/html" = "{\"statusCode\": 200}"
    }
  }
  
  resource "aws_api_gateway_integration" "login_page" {
    rest_api_id          = aws_api_gateway_rest_api.raspberry_api.id
    resource_id          = aws_api_gateway_resource.home.id
    http_method          = aws_api_gateway_method.login.http_method
    type                 = "MOCK"
    timeout_milliseconds = 29000
  }
  
  resource "aws_api_gateway_method_response" "response_200" {
    rest_api_id = aws_api_gateway_rest_api.raspberry_api.id
    resource_id = aws_api_gateway_resource.home.id
    http_method = aws_api_gateway_method.login.http_method
    status_code = "200"
  }
  
  resource "aws_api_gateway_integration_response" "login_page" {
    rest_api_id = aws_api_gateway_rest_api.raspberry_api.id
    resource_id = aws_api_gateway_resource.home.id
    http_method = aws_api_gateway_method.login.http_method
    status_code = aws_api_gateway_method_response.response_200.status_code
    response_templates = {
      "text/html" = data.template_file.login_page.rendered
    }
  }
  
  resource "aws_api_gateway_deployment" "example" {
    depends_on = [
      aws_api_gateway_integration.login_page
    ]
    rest_api_id = aws_api_gateway_rest_api.raspberry_api.id
    stage_name  = "production"
  }
  
  </code></pre>
  
  <p>I have followed the instructions as in <a href="https://blog.it-playground.eu/display-html-page-using-only-api-gateway/" rel="noreferrer">this blog</a>, with no success.</p>