feat: generate dynamic credentials via ephemeral resources #123
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.45) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.45 · 431 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.363
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #123"
general
weight: 0.35
sdahal-bt
What
Adds two ephemeral resources that generate dynamic credentials from the AWS and Azure dynamic secret definitions the provider already manages:
beyondtrust_workload_credentials_aws_dynamic_secret— STS assume-role sessionbeyondtrust_workload_credentials_azure_dynamic_secret— service principal passwordThey reuse the managed resource type names, following the existing
static_secretprecedent. The framework's duplicate-name check is per-registry, so the two coexist.Why
The provider could already define dynamic secrets but had no way to generate from one, leaving the feature half-finished: you could declare "mint me an STS session from this role" and then had to leave Terraform to get one.
POST /dynamic/{name}/generatewas unimplemented, andprovider.gostill carried commented-out placeholders where that work was meant to land.Generated credentials are returned exactly once and never stored server-side, so an ephemeral resource is the only Terraform primitive that fits.
Design notes
The two types are deliberately asymmetric.
| | AWS | Azure |
|---|---|---|
| Implements
Close| No | Yes ||
revoke_on_close| Absent | Present, defaults true ||
expiration| Present | Absent |AWS gets no
Close: an assumed-role lease is never revocable, so it would spend a guaranteed-failing DELETE plus acan_revoke_leasecheck the caller may not hold, on every apply, to swallow an error. Azure gets noexpiration: the generate response carries none, and fabricating one would mean a second request into the lease-durability window or a client-side guess. Neither setsRenewAt— there is no renew endpoint.Two behaviours that look like bugs and aren't, both documented prominently:
depends_ondoes not help, because the open precedes it.Permissions. Generating needs
GenerateDynamicCredentialon the dynamic secret.Owneron the secret or its folder does not include it, so anyone other than a product admin needs a direct grant. The docs cover this with an example policy.Testing
make test-unit) cover both resources: request shapes, schema, the revoke retry, and a full Open then Close against a fake API, includingrevoke_on_close = false.GenerateDynamicCredentialthrough the admin API, opens the ephemeral resource, and checks that an STS session came back. It runs there because the grant is written on the admin site. It generates from an existing dynamic secret (BEYONDTRUST_TEST_AWS_DYNAMIC_SECRET), because AWS credentials cannot be revoked early and a dynamic secret cannot be deleted while it has active leases;docs/TESTING_AWS.mdhas the setup.test/add_azure_acc_tests. They are waiting on a service-side fix: generating twice in quick succession, which every Terraform apply does, currently fails for Azure. Azure revocation here is covered by the round-trip tests and was verified end to end by hand.SMOP-1467
🤖 Generated with Claude Code