10000 bug: LocalStack crashes trying to run simple terraform script with terraform-local · Issue #6788 · localstack/localstack · GitHub
[go: up one dir, main page]

Skip to content
bug: LocalStack crashes trying to run simple terraform script with terraform-local #6788
Closed
@fabio-blanco

Description

@fabio-blanco

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When I try to create a simple ec2 instance with a terraform file by using terraform-local, localstack crashes and displays the following error message:

TypeError: Ec2Api.run_instances() got an unexpected keyword argument 'disable_api_stop'

Expected Behavior

The ec2 instance simulation should be successfully created in LocalStack and tflocal should return successful message.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

version: "3.8"

services:
  localstack:
    container_name: locastack
    hostname: localstack
    image: localstack/localstack
    ports:
      - "127.0.0.1:4510-4559:4510-4559"  # external service port range
      - "127.0.0.1:4566:4566"            # LocalStack Edge Proxy
    environment:
      - DEBUG=${DEBUG-}
      - DATA_DIR=${DATA_DIR-}
      - LAMBDA_EXECUTOR=${LAMBDA_EXECUTOR-}
      - HOST_TMP_FOLDER=${TMPDIR:-/tmp/}localstack
      - DOCKER_HOST=unix:///var/run/docker.sock
      - HOSTNAME=localstack
      - HOSTNAME_EXTERNAL=localstack
      - AWS_DEFAULT_REGION=us-west-2
    volumes:
      - "${TMPDIR:-/tmp}/localstack:/tmp/localstack"
      - "/var/run/docker.sock:/var/run/docker.sock"
    healthcheck:
      test: [ "CMD", "curl", "-f", "http://localhost:4566/health" ]
      interval: 5s
      timeout: 10s
      start_period: 10s
docker compose up

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

main.tf

terraform {
  required_providers {
    aws = {
      source  = "hashicorp/aws"
      version = "~> 4.16"
    }
  }

  required_version = ">= 1.2.0"
}

provider "aws" {
  region = "us-west-2"
}

resource "aws_instance" "app_server" {
  ami           = "ami-830c94e3"
  instance_type = "t2.micro"

  tags = {
    Name = "ExampleAppServerInstance"
  }
}
tflocal init
tflocal apply

Environment

- OS:Ubuntu 20.04.5 LTS
- LocalStack:latest
- Terraform v1.2.8
- provider registry.terraform.io/hashicorp/aws v4.28.0

Anything else?

Log:

locastack  | 2022-08-31T02:53:37.941:WARNING:localstack.utils.server.http2_server: Error in proxy handler for request POST http://localhost:4566/: Ec2Api.run_instances() got an unexpected keyword argument 'disable_api_stop' Traceback (most recent call last):
locastack  |   File "/opt/code/localstack/localstack/utils/server/http2_server.py", line 185, in index
locastack  |     result = await run_sync(handler, request, data)
locastack  |   File "/opt/code/localstack/localstack/utils/asyncio.py", line 85, in run_sync
locastack  |     return await loop.run_in_executor(thread_pool, copy_context().run, func_wrapped)
locastack  |   File "/opt/code/localstack/localstack/utils/threads.py", line 39, in run
locastack  |     result = self.func(self.params, **kwargs)
locastack  |   File "/opt/code/localstack/localstack/utils/asyncio.py", line 30, in _run
locastack  |     return fn(*args, **kwargs)
locastack  |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 992, in handler
locastack  |     return modify_and_forward(
locastack  |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 534, in wrapper
locastack  |     value = func(*args, **kwargs)
locastack  |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 614, in modify_and_forward
locastack  |     listener_result = listener.forward_request(
locastack  |   File "/opt/code/localstack/localstack/services/edge.py", line 170, in forward_request
locastack  |     result = do_forward_request(api, method, path, data, headers, port=port)
locastack  |   File "/opt/code/localstack/localstack/services/edge.py", line 225, in do_forward_request
locastack  |     result = do_forward_request_inmem(api, method, path, data, headers, port=port)
locastack  |   File "/opt/code/localstack/localstack/services/edge.py", line 249, in do_forward_request_inmem
locastack  |     response = modify_and_forward(
locastack  |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 534, in wrapper
locastack  |     value = func(*args, **kwargs)
locastack  |   File "/opt/code/localstack/localstack/services/generic_proxy.py", line 614, in modify_and_forward
locastack  |     listener_result = listener.forward_request(
locastack  |   File "/opt/code/localstack/localstack/http/adapters.py", line 51, in forward_request
locastack  |     response = self.request(request)
locastack  |   File "/opt/code/localstack/localstack/aws/proxy.py", line 42, in request
locastack  |     return self.skeleton.invoke(context)
locastack  |   File "/opt/code/localstack/localstack/aws/skeleton.py", line 153, in invoke
locastack  |     return self.dispatch_request(context, instance)
locastack  |   File "/opt/code/localstack/localstack/aws/skeleton.py", line 165, in dispatch_request
locastack  |     result = handler(context, instance) or {}
locastack  |   File "/opt/code/localstack/localstack/aws/forwarder.py", line 57, in _call
locastack  |     return handler(context, req)
locastack  |   File "/opt/code/localstack/localstack/aws/skeleton.py", line 117, in __call__
locastack  |     return self.fn(*args, **kwargs)
locastack  |   File "/opt/code/localstack/localstack/aws/api/core.py", line 95, in operation_marker
locastack  |     return fn(*args, **kwargs)
locastack  | TypeError: Ec2Api.run_instances() got an unexpected keyword argument 'disable_api_stop'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0