Repository navigation
[Python] Add AwsSecret to the Secret utility - #40558
Conversation
d7e9c73 to
2ed751d
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #40558 +/- ##
=============================================
+ Coverage 56.16% 79.90% +23.74%
=============================================
Files 1124 488 -636
Lines 178336 82502 -95834
Branches 1489 0 -1489
=============================================
- Hits 100170 65927 -34243
+ Misses 75645 16575 -59070
+ Partials 2521 0 -2521
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Read secrets from AWS Secrets Manager with Secret.from_json(spec, 'AwsSecretsManager') or 'type:awssecret;name:...'. Credentials and connection settings come from the --aws_* options, passed through a new Secret.apply_pipeline_options() hook (also used for --gbek). A spec can override non-credential settings such as region_name or endpoint_url.
2ed751d to
2780090
Compare
7b73c91 to
bc846b3
Compare
|
Assigning reviewers: R: @damccorm for label python. This pull request likely touches a core component ("core" label). Please review with scrutiny. Note: If you would like to opt out of this review, comment Available commands:
The PR bot will only process comments in the main thread (not review comments). |
There was a problem hiding this comment.
📋 Review Summary
This pull request adds AwsSecret to Apache Beam's Python Secret utility to enable retrieving secrets from AWS Secrets Manager (AwsSecretsManager / type:awssecret). It also introduces Secret.apply_pipeline_options() for lazy resolution of AWS credentials and defaults from AwsOptions on workers, and prevents circular configuration where AwsSecretsManager is used as --aws_credentials_secret_manager.
🔍 General Feedback
- The design cleanly separates secret construction from pipeline option resolution (
apply_pipeline_options), ensuring that secret objects remain picklable and resolve credentials lazily on workers. - Per-secret connection overrides and validation against inline credentials integrate well with
client_options. - Unit test coverage is thorough, covering string/binary secret retrieval, caching, pickling, option overrides, and invalid configurations.
💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.
damccorm
left a comment
There was a problem hiding this comment.
Thanks! Generally LGTM - had 2 suggestions, but feel free to merge after addressing
Descriptipon
Adds
AwsSecretto retrieve secrets from AWS Secrets Manager viaSecret.from_json(spec, 'AwsSecretsManager')orSecret.parse_secret_option('type:awssecret;name:...').Changes
AwsSecret: acceptssecret_id/name/arn,version_id/version,version_stage/stage, plus any non-credentialAwsOptionssetting (e.g.region_name,endpoint_url) as a per-secret override.Secret.apply_pipeline_options(options): passed fromfrom_json()/parse_secret_option()(and--gbek).AwsSecretuses it to pull credentials and defaults fromAwsOptionslazily on workers.client_options: rejectsAwsSecretsManageras--aws_credentials_secret_manager.Part of #40528. Builds on #40547.