aws / aws/amazon-ssm-agent

Session freezes when trying to exit after running Terraform commands using the CLI

Open
#393 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.2k
Forks
357
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm using SSM Session Manager through the CLI to connect to a bastion host I issue Terraform commands from. Every time after I run a `terraform init` command, I'm unable to exit the session, the console just freezes after executing `exit` and I have to either kill the session manually or wait until it expires. If I exit the session after connecting to the instance or after running git commands for example there is no problem.

Environment:
Bastion: EC2 instance using a golden image built with AWS Image Builder from the latest Amazon Linux 2 AMI and with the latest SSM agent version. Rebuilt every week.
Local: MacBook Pro. macOS Big Sur.
SSM Manager Plugin version: 1.2.205.0
AWS CLI version: 2.2.18

I tried tailing the logs from a session opened through the AWS console while executing the `exit` command on a terminal through the SSM Manager plugin. When I exit the session without executing a Terraform command, I can see a bunch of logs appearing. Doing the same thing after executing a Terraform command, I see nothing in the logs.
I execute the CLI command to connect to the instance without any document associated.

Contributor guide

Open the contributing guide

Research direction

Start by reproducing an SSM Session Manager CLI session on the described Amazon Linux 2 bastion, run `terraform init`, and compare the agent logs with a session that exits normally. Done means the CLI session exits without freezing after Terraform commands, with the behavior verified against the stated AWS CLI and Session Manager Plugin versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, terraform
Domain
cli, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.