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

feat: add basic profile support #26

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,21 @@ steps:
SECRET_FROM_OTHER_REGION: my-secret-id
```

### For Secrets available to another AWS Profile

This plugin by default uses your current global AWS profile where your agent is running.
To use another profile for _all the secrets_ you can set it directly with the `profile` parameter.

```yml
steps:
- commands: 'echo \$SECRET_FROM_OTHER_REGION'
plugins:
- seek-oss/aws-sm#v2.3.1:
profile: profile-name
env:
SECRET_FROM_OTHER_PROFILE: my-secret-id
```

### For use with VPC Endpoints

You may want to specify a custom `endpoint-url` if you are using a [VPC endpoint](https://docs.aws.amazon.com/vpc/latest/userguide/vpc-endpoints.html)
Expand Down
2 changes: 2 additions & 0 deletions lib/shared.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

BUILDKITE_PLUGIN_AWS_SM_ENDPOINT_URL="${BUILDKITE_PLUGIN_AWS_SM_ENDPOINT_URL:-}"
BUILDKITE_PLUGIN_AWS_SM_REGION="${BUILDKITE_PLUGIN_AWS_SM_REGION:-}"
BUILDKITE_PLUGIN_AWS_SM_PROFILE="${BUILDKITE_PLUGIN_AWS_SM_PROFILE:-${AWS_PROFILE:-default}}"

function strip_quotes() {
echo "${1}" | sed "s/^[[:blank:]]*//g;s/[[:blank:]]*$//g;s/[\"']//g"
Expand Down Expand Up @@ -36,6 +37,7 @@ function get_secret_value() {
--version-stage AWSCURRENT \
$regionFlag \
$endpointUrlFlag \
--profile $BUILDKITE_PLUGIN_AWS_SM_PROFILE \
--output json \
--query '{SecretString: SecretString, SecretBinary: SecretBinary}')

Expand Down