无法在本地堆栈中执行“地形破坏”

时间:2019-10-23 05:35:32

标签: terraform localstack

在通过Terraform在localstack上创建api_gateway之后,我试图销毁它,但是当运行terraform destroy时,我陷入了

aws_api_gateway_deployment.api_deployment: Still destroying... [id=r2zycnye6q, 6m40s elapsed]

localstack出现此错误

localstack_1  | 2019-10-23 05:33:05,261:API: Error on request:
localstack_1  | Traceback (most recent call last):
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/werkzeug/serving.py", line 304, in run_wsgi
localstack_1  |     execute(self.server.app)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/werkzeug/serving.py", line 292, in execute
localstack_1  |     application_iter = app(environ, start_response)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/moto/server.py", line 132, in __call__
localstack_1  |     return backend_app(environ, start_response)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 2309, in __call__
localstack_1  |     return self.wsgi_app(environ, start_response)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 2295, in wsgi_app
localstack_1  |     response = self.handle_exception(e)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
localstack_1  |     return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 1741, in handle_exception
localstack_1  |     reraise(exc_type, exc_value, tb)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
localstack_1  |     raise value
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 2292, in wsgi_app
localstack_1  |     response = self.full_dispatch_request()
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 1815, in full_dispatch_request
localstack_1  |     rv = self.handle_user_exception(e)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
localstack_1  |     return cors_after_request(app.make_response(f(*args, **kwargs)))
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 1718, in handle_user_exception
localstack_1  |     reraise(exc_type, exc_value, tb)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/_compat.py", line 35, in reraise
localstack_1  |     raise value
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 1813, in full_dispatch_request
localstack_1  |     rv = self.dispatch_request()
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/flask/app.py", line 1799, in dispatch_request
localstack_1  |     return self.view_functions[rule.endpoint](**req.view_args)
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/moto/core/utils.py", line 140, in __call__
localstack_1  |     result = self.callback(request, request.url, {})
localstack_1  |   File "/opt/code/localstack/.venv/lib/python3.6/site-packages/moto/apigateway/responses.py", line 154, in stages
localstack_1  |     return 200, {}, json.dumps(stage_response)
localstack_1  | UnboundLocalError: local variable 'stage_response' referenced before assignment

每当我要重新创建实例时,都必须手动删除tfstate文件。

如果您知道什么,请帮助我

非常感谢。

0 个答案:

没有答案