-
Notifications
You must be signed in to change notification settings - Fork 9
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
fix: add an FTL tag and filter ASM secrets #1888
Conversation
15ba666
to
20c9f9e
Compare
23da737
to
b170a92
Compare
LGTM 👍 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice!
common/configuration/asm_leader.go
Outdated
@@ -149,6 +155,9 @@ func (l *asmLeader) store(ctx context.Context, ref Ref, value []byte) (*url.URL, | |||
_, err := l.client.CreateSecret(ctx, &secretsmanager.CreateSecretInput{ | |||
Name: aws.String(ref.String()), | |||
SecretString: aws.String(string(value)), | |||
Tags: []types.Tag{ | |||
{Key: aws.String("_ftl"), Value: aws.String(ref.Module.Default("_"))}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason for the _
?
common/configuration/asm_leader.go
Outdated
@@ -54,6 +54,9 @@ func (l *asmLeader) sync(ctx context.Context, secrets *xsync.MapOf[Ref, cachedSe | |||
out, err := l.client.ListSecrets(ctx, &secretsmanager.ListSecretsInput{ | |||
MaxResults: aws.Int32(100), | |||
NextToken: nextToken.Ptr(), | |||
Filters: []types.Filter{ | |||
{Key: types.FilterNameStringTypeTagKey, Values: []string{"_ftl"}}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's pull the tag value out into a constant.
common/configuration/asm_leader.go
Outdated
@@ -149,6 +155,9 @@ func (l *asmLeader) store(ctx context.Context, ref Ref, value []byte) (*url.URL, | |||
_, err := l.client.CreateSecret(ctx, &secretsmanager.CreateSecretInput{ | |||
Name: aws.String(ref.String()), | |||
SecretString: aws.String(string(value)), | |||
Tags: []types.Tag{ | |||
{Key: aws.String("ftl"), Value: aws.String(ref.Module.Default("_"))}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can the value not be empty? _
is actually a valid module name, so if it can't be empty it should at least be -
which is not a valid identifier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can be empty, pushing a fix
9c4190c
to
2930b2c
Compare
nice! and much needed. Most AWS accounts will have many secrets in many formats |
Fixes #1876