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

session-manager-plugin support #48

Closed
123BLiN opened this issue Jul 20, 2022 · 5 comments
Closed

session-manager-plugin support #48

123BLiN opened this issue Jul 20, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@123BLiN
Copy link

123BLiN commented Jul 20, 2022

Expected Behavior

Be useful for AWS packer builds

Current Behavior

Not useful - forked

Dockerfile that works in my case:

FROM ubuntu:latest

RUN set -e;  \
    apt-get update && apt-get install -y curl apt-transport-https ca-certificates gnupg; \
    echo "deb [arch=amd64] https://apt.releases.hashicorp.com $(. /etc/lsb-release; echo "$DISTRIB_CODENAME") main" > /etc/apt/sources.list.d/hashicorp.list; \
    curl -fsSL https://apt.releases.hashicorp.com/gpg | apt-key add -; \
    apt-get update -o Dir::Etc::sourcelist=sources.list.d/hashicorp.list -o Dir::Etc::sourceparts=- -o APT::Get::List-Cleanup=0; \
    apt-get install -y packer; \
    curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb" -o /tmp/session-manager-plugin.deb; \
    dpkg -i /tmp/session-manager-plugin.deb; \
    apt-get autoremove -y curl apt-transport-https ca-certificates gnupg; \
    apt-get clean

COPY "entrypoint.sh" "/entrypoint.sh"

ENTRYPOINT ["/entrypoint.sh"]

Maybe it can be useful to allow to specify dockerfile content and override default one?

Steps to Reproduce

Try to build AMI in AWS with SSM session

Environment

AWS account with SSM session for connections

@123BLiN 123BLiN added the bug Something isn't working label Jul 20, 2022
@IdanYaffe
Copy link

IdanYaffe commented Jul 21, 2022

I also have a feeling the session manager plugin isn't working properly using this action.
Getting the following error when packer trying to connect to an EC2 instance via SSM:
"session-manager-plugin": executable file not found in $PATH

I didn't manage to workaround it by installing the AWS SSM plugin on the GH runner as part of another step within the same GH workflow job.

@123BLiN
Copy link
Author

123BLiN commented Jul 21, 2022

I think the only option may be to add it to the docker file like this aws/session-manager-plugin#12 (comment) - trying to evaluate it, or switch from packer:light to other docker, like ubuntu based but it seems this is not desired based on hashicorp/docker-hub-images#100

If the trick with docker RUN on alpine will work I will try to add a PR that will allow such steps, if not - only fork locally and adjust for your needs, also one more customisation I can think of is packer init support it is supported actually

@123BLiN
Copy link
Author

123BLiN commented Jul 21, 2022

This worked for my case - but only in fork of this repo, as I'm changing the base Docker image
https://github.com/skeggse/docker-packer-ssm/blob/main/Dockerfile

@ksatirli
Copy link
Member

ksatirli commented Jan 2, 2023

Thank you for reporting this @123BLiN.

In the legacy version of this Action, this wasn't supported. You should be able to use SSM (and similar tooling) with the latest version of this Action.

See #63

@123BLiN 123BLiN closed this as completed Jan 2, 2023
@psipher
Copy link

psipher commented Jul 12, 2023

Got the same error Getting the following error when packer trying to connect to an EC2 instance via SSM:
"session-manager-plugin": executable file not found in $PATH , while trying to use github actions. Previously had a stage defined for installing session mananger . At the end I added
RUN wget https://s3.amazonaws.com/session-manager-downloads/plugin/latest/ubuntu_64bit/session-manager-plugin.deb && dpkg -i session-manager-plugin.deb && rm session-manager-plugin.deb in my docker file and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants