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

ECS support JSON key and version for secrets #2358

Merged
merged 1 commit into from
Feb 18, 2020
Merged

ECS support JSON key and version for secrets #2358

merged 1 commit into from
Feb 18, 2020

Conversation

jy19
Copy link
Contributor

@jy19 jy19 commented Feb 13, 2020

Summary

This pull request is for our roadmap item: aws/containers-roadmap#385

This change allows customers to specify parameters such as json-key, version-stage, or version-id along with the AWS Secrets Manager ARN they are already inputting for a more specific secret value.

Implementation details

Agent will continue to take in an AWS Secrets Manager ARN, but will now parse the ARN into the parameters it expects. Some string manipulation and arn.Parse is involved. Existing secrets without these additional parameters has the same behavior.

Testing

Manually tested on an EC2 instance with local agent. New and existing unit tests and integration tests pass.

New tests cover the changes: yes

Description for the changelog

Adding enhancement to secretsmanager secret specified in ECS.

Licensing

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

agent/taskresource/asmsecret/asmsecret.go Outdated Show resolved Hide resolved
agent/asm/asm.go Show resolved Hide resolved
agent/asm/asm.go Outdated Show resolved Hide resolved
agent/asm/asm_test.go Outdated Show resolved Hide resolved
agent/taskresource/asmsecret/asmsecret.go Show resolved Hide resolved
@jy19 jy19 changed the title Roadmap385 ECS support JSON key and version for secrets Feb 14, 2020
CHANGELOG.md Outdated Show resolved Hide resolved
agent/asm/asm_test.go Outdated Show resolved Hide resolved
@jy19 jy19 force-pushed the roadmap385 branch 2 times, most recently from 71b1169 to c7ebb43 Compare February 14, 2020 20:30
agent/asm/asm_test.go Outdated Show resolved Hide resolved
agent/asm/asm.go Outdated

secretValue, ok := secretMap[jsonKey]
if !ok {
err = errors.New(fmt.Sprintf("Retrieved secret from Secrets Manager did not contain json key %s", jsonKey))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error should start with lower case for golang.

Copy link
Contributor

@yumex93 yumex93 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can go ahead and merge the pr once you resolve the last comment.

for roadmap issue aws#385
aws/containers-roadmap#385
this commit adds the ability for customers to add parameters
to the secretsmanager ARN specified in containers. agent will be
able to retrieve secret by version or retrieve part of a secret
by json key.
this commit also fixes a minor issue breaking go vet in an unrelated test.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants