Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: settings for ALB and ECS in template files are overwritten by LocalStack on deploy #10766

Open
1 task done
mciver-pk opened this issue May 3, 2024 · 3 comments
Open
1 task done
Labels
area: integration/terraform Issues related to HashiCorp Terraform status: backlog Triaged but not yet being worked on type: bug Bug report

Comments

@mciver-pk
Copy link

mciver-pk commented May 3, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Deploy Terraform stack to fresh LocalStack instance with tflocal apply. Run a tflocal plan|apply directly after, and observe listing of proposed changes to infrastructure despite no changes to template files.

Expected Behavior

Deploy Terraform stack to fresh LocalStack instance with tflocal apply. Run a tflocal plan|apply directly after, and observe that no change is needed and no resources are updated.

How are you starting LocalStack?

With the localstack script

Steps To Reproduce

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

LS_DEBUG=trace localstack start -d

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

I've attached an archive with example template files that reproduce this behavior.

  1. LS_DEBUG=trace localstack start -d
  2. unzip Archive.zip, cd to it
  3. terraform init
  4. tflocal apply
  5. tflocal apply/plan
  6. observe several recommended changes

Archive.zip

Environment

- OS: MacOS Ventura 13.4.1
- LocalStack: 3.2.0
- Docker: 26.0.0

Anything else?

It's unclear if this is intended behavior. If it is, there is a lack of documentation on what infrastructure configurations are typically overwritten on a deploy to LocalStack. It is also worth noting that after running a subsequent tflocal apply after the initial successful one, the application breaks and no new tasks start in the ECS service.

Observed logs from LocalStack container when ECS service crashes:

2024-05-03 14:40:27 2024-05-03T21:40:27.025  INFO --- [198 (worker)] l.s.e.t.docker             : Stopping Docker container ls-ecs-REDACTED_cluster-localstack-89c86db7-5075-47a4-9e8b-e1a92f70fb1d-0-5079e5dd for ECS task arn:aws:ecs:us-east-1:000000000000:task/REDACTED_cluster-localstack/89c86db7-5075-47a4-9e8b-e1a92f70fb1d
2024-05-03 14:40:37 2024-05-03T21:40:37.291  WARN --- [   asgi_gw_6] l.aws.protocol.serializer  : Response object TaskSet contains a member which is not specified: regionName
2024-05-03 14:40:37 2024-05-03T21:40:37.292  WARN --- [   asgi_gw_6] l.aws.protocol.serializer  : Response object TaskSet contains a member which is not specified: clientToken
2024-05-03 14:40:37 2024-05-03T21:40:37.305  WARN --- [   asgi_gw_2] l.aws.protocol.serializer  : Response object Service contains a member which is not specified: clusterName
2024-05-03 14:40:37 2024-05-03T21:40:37.306  WARN --- [   asgi_gw_2] l.aws.protocol.serializer  : Response object Service contains a member which is not specified: regionName
2024-05-03 14:40:37 2024-05-03T21:40:37.306  WARN --- [   asgi_gw_2] l.aws.protocol.serializer  : Response object Service contains a member which is not specified: enableEcsManagedTags
@mciver-pk mciver-pk added status: triage needed Requires evaluation by maintainers type: bug Bug report labels May 3, 2024
@localstack-bot
Copy link
Collaborator

Welcome to LocalStack! Thanks for reporting your first issue and our team will be working towards fixing the issue for you or reach out for more background information. We recommend joining our Slack Community for real-time help and drop a message to LocalStack Pro Support if you are a Pro user! If you are willing to contribute towards fixing this issue, please have a look at our contributing guidelines and our contributing guide.

@mciver-pk
Copy link
Author

mciver-pk commented May 6, 2024

running awslocal ecs describe-services after a subsequent (breaking) apply shows the service as having a runningCount and desiredCount of 2, but when running awslocal list-tasks and describe-tasks i can see that there is one task and it is in the STOPPED state.

@mciver-pk
Copy link
Author

adjusted terraform templates to always replace the ecs cluster + service + task definition and still unable to bring up the service, seeing this in the localstack container logs:

2024-05-06 15:34:48 Exception in thread Thread-191:
2024-05-06 15:34:48 Traceback (most recent call last):
2024-05-06 15:34:48   File "/usr/local/lib/python3.11/threading.py", line 1045, in _bootstrap_inner
2024-05-06 15:34:48     self.run()
2024-05-06 15:34:48   File "/usr/local/lib/python3.11/threading.py", line 1401, in run
2024-05-06 15:34:48     self.function(*self.args, **self.kwargs)
2024-05-06 15:34:48   File "/opt/code/localstack/.venv/lib/python3.11/site-packages/localstack_ext/services/ecs/provider.py.enc", line 193, in I
2024-05-06 15:34:48 KeyError: 'arn:aws:ecs:us-east-1:000000000000:cluster/REDACTED_cluster-localstack'

@MarcelStranak MarcelStranak added area: integration/terraform Issues related to HashiCorp Terraform status: backlog Triaged but not yet being worked on and removed status: triage needed Requires evaluation by maintainers labels May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: integration/terraform Issues related to HashiCorp Terraform status: backlog Triaged but not yet being worked on type: bug Bug report
Projects
None yet
Development

No branches or pull requests

3 participants