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

feature request: Having a namespace in front of the ssm /service/ path. #128

Open
maartenvanderhoef opened this issue Sep 5, 2018 · 9 comments
Milestone

Comments

@maartenvanderhoef
Copy link
Contributor

maartenvanderhoef commented Sep 5, 2018

Hi there!

What are the thoughts of having an ENV VAR SSM_PATH_NAMESPACE or SSM_PATH_PREPEND which prepends a string in front of the /service/lookupvar . This to make it easier to organize SSM a bit when it's not only docker applications looking up SSM. For example I'm currently using /applications/service/lookupvar.

@emmanuel
Copy link

emmanuel commented Sep 6, 2018

Just trying out Chamber for the first time after reading the post on the AWS blog. Thanks for the tool (and the article), you helped me quickly get up to speed with effective patterns for using Parameter Store.

However, I support the request in this issue. Namely: Chamber doesn't support using path-based organization of my parameters, which I take to be recommended practice (based on the Parameter Store docs and examples I've seen on AWS).

In the meantime, I've got a systemd unit that does the basic version. In other words, the below fetches all parameters within a path and upcases the final segment of the path key then outputs an environment file (in the format "PATH_SEGMENT_ENV_VAR=decrypted_value"):

[Unit]
Description=Fetch app startup config from AWS Parameter Store

[Service]
Type=oneshot
Environment="PARAMETER_STORE_PATH=/this/is/my/nested/path/in/parameter_store"
Environment="RAW_PARAMETER_OUTPUT=/tmp/parameter_output.json"
Environment="PARAMETER_ENV_FILE=/run/parameter_store.env"
Environment="AWS_DEFAULT_REGION=${AWS_REGION}"
ExecStartPre=/bin/bash -c 'aws ssm get-parameters-by-path --path="${PARAMETER_STORE_PATH}" --with-decryption > ${RAW_PARAMETER_OUTPUT}'
ExecStart=/bin/bash -c 'jq -r \'.Parameters | map((.Name | split("/")[-1] | ascii_upcase) +"="+ (.Value))[]\' ${RAW_PARAMETER_OUTPUT} > ${PARAMETER_ENV_FILE}'
ExecStartPost=/usr/bin/shred -u ${RAW_PARAMETER_OUTPUT}

@AndreyMarchuk
Copy link

+1 to prefix (namespace) or at least allow '/' in service name. Currently using '/' gives an error:

Error: Failed to validate service: Failed to validate service name 'namespace/env/service'. Only alphanumeric, dashes, and underscores are allowed for service names

@AndreyMarchuk
Copy link

This might be resolved by #118

@maartenvanderhoef
Copy link
Contributor Author

@AndreyMarchuk Ah thanks for pointing me out!

@darend
Copy link

darend commented Sep 25, 2018

@maartenvanderhoef I submitted #140 as a way to add support

@nickatsegment nickatsegment modified the milestones: v3.0, v3.x Mar 6, 2019
@nickatsegment
Copy link
Contributor

I think this would be a useful feature, but probably requires a change to the model, so targeting for v3.x

@stale
Copy link

stale bot commented May 6, 2019

This issue has been automatically marked stale because it has not had any activity in the last 60 days. If no further activity occurs within 7 days, it will be closed. Closed does not mean "never", just that it has no momentum to get accomplished any time soon.
See CONTRIBUTING.md for more info.

@stale stale bot added the stale label May 6, 2019
@stale
Copy link

stale bot commented May 13, 2019

Closing due to staleness. Closed does not mean "never", just that it has no momentum to get accomplished any time soon.
See CONTRIBUTING.md for more info.

@hongkongkiwi
Copy link

hongkongkiwi commented Oct 15, 2020

I too would like this very much to have this.

Ideally I would just like to set my own prefix in front of /service, and then I can set it via an environment variable and done. For example, it would be nice to have CHAMBER_PREFIX="/mycompany/dev" and it will do "/mycompany/dev/service".

That being said, I just wanted to add that this can kind of be done already in an awkward way by using slashes in a service name. e.g. chamber write "mycompany/dev" "foo" "bar". This appears to work well giving a /mycompany/dev/foo key in Param Store.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants