Skip to content

fix(provisioning): enrich Events Connection/ApiDestination Arn so ApiDestination deploys - #922

Merged
go-to-k merged 3 commits into
mainfrom
fix-events-connection-arn
Jun 21, 2026
Merged

fix(provisioning): enrich Events Connection/ApiDestination Arn so ApiDestination deploys#922
go-to-k merged 3 commits into
mainfrom
fix-events-connection-arn

Conversation

@go-to-k

@go-to-k go-to-k commented Jun 21, 2026

Copy link
Copy Markdown
Owner

Summary

Found via /hunt-bugs. A standard events.Connection + events.ApiDestination pair (the daily webhook pattern) was undeployable — the ApiDestination CREATE failed with Model validation failed (#/ConnectionArn: failed validation constraint for keyword [pattern]).

AWS::Events::Connection is Cloud-Control-provisioned (no SDK provider) and its primaryIdentifier is Name, so cdkd's physicalId for a Connection is the connection name, not the ARN. Its readOnly Arn attribute was not populated by enrichResourceAttributes, so an AWS::Events::ApiDestination whose ConnectionArn is Fn::GetAtt(Connection, 'Arn') (the canonical CDK shape) received the bare name and AWS rejected the invalid ConnectionArn. The full connection ARN carries a random unique suffix (.../connection/<name>/<uuid>), so it cannot be string-constructed from account + region + name. Same systemic enrichment-gap bug class as #844 / #864 / #865 / #866.

Fix

src/provisioning/cloud-control-provider.ts: add two enrichResourceAttributes cases (mirroring the existing Kinesis / Lambda::Url / RDS branches, best-effort try/catch):

  • AWS::Events::ConnectionArn + SecretArn via DescribeConnection; ArnForPolicy derived from the full ARN by stripping the trailing /<uuid> segment (the SDK does not return it).
  • AWS::Events::ApiDestinationArn via DescribeApiDestination; ArnForPolicy derived likewise.

A failed Describe leaves the CC attribute shape unchanged and never fails the deploy.

Both types are pure-CC (no SDK provider, no cached CFn schema fixture — per the established pattern that keeps tests/fixtures/cfn-schemas/ 1:1 with registered SDK providers, enforced by the no stale fixture files for unregistered types test). They join docs/_generated/enrichment-coverage.json's enrichedWithoutCachedSchema list alongside the other enriched pure-CC types (ElastiCache::ReplicationGroup / Redshift::Cluster / OpenSearchService::Domain).

Test plan

  • 6 new unit tests in cloud-control-provider.test.ts: Connection Arn/SecretArn/ArnForPolicy overlay + the DescribeConnection({Name: physicalId}) command shape (the load-bearing check for the bug class); already-present-attrs short-circuit (no call, no overwrite); per-field-independence partial overlay (CC returned SecretArn but not Arn); best-effort failure; ApiDestination Arn/ArnForPolicy overlay + command shape; ApiDestination best-effort failure.
  • New real-AWS eventbridge-api-destination integ fixture: deploys Connection + ApiDestination + a Rule whose target is the ApiDestination, asserts the resolved ConnectionArn AND the Rule's target Arn reaching AWS are real ARNs (not bare names), then destroys clean.
  • Verified end-to-end against real AWS: the previously-undeployable ApiDestination now deploys (ConnectionArn resolved to arn:aws:events:...:connection/<name>/<uuid>); destroy clean, 0 orphans.
  • Full suite: 6097 unit tests pass; enrichment-coverage + integ-coverage + scenario-coverage matrices regenerated.

Notes for review

  • cloud-control-provider.ts is not under src/provisioning/providers/** nor any integ-broad / integ-local scope, so those integ gates do not apply; the destroy path was nonetheless exercised cleanly by the new integ.
  • 1 independent code reviewer ran on this diff: CLEAN, no blockers, no nits.

go-to-k added 3 commits June 22, 2026 03:21
…Destination deploys

AWS::Events::Connection is CC-API-provisioned with primaryIdentifier=Name, so
its cdkd physicalId is the connection name, not the ARN. Its readOnly Arn
attribute was not enriched, so an AWS::Events::ApiDestination whose ConnectionArn
is Fn::GetAtt(Connection, 'Arn') (the canonical CDK shape) received the bare name
and the ApiDestination CREATE failed CC model validation
(#/ConnectionArn: failed validation constraint for keyword [pattern]) — the whole
webhook pattern was undeployable.

Add enrichResourceAttributes cases for AWS::Events::Connection (Arn/SecretArn via
DescribeConnection; ArnForPolicy derived by stripping the ARN's unique suffix)
and AWS::Events::ApiDestination (Arn via DescribeApiDestination; ArnForPolicy
derived likewise), best-effort. Same enrichment-gap bug class as #844/#864/#865/#866.

- 5 new unit tests in cloud-control-provider.test.ts
- new real-AWS eventbridge-api-destination integ fixture (Connection +
  ApiDestination + Rule target; asserts resolved ConnectionArn + target Arn are
  real ARNs, deploy/destroy clean)
- regenerated enrichment-coverage (both types join enrichedWithoutCachedSchema,
  the pure-CC pattern) + integ/scenario-coverage matrices
- changelog entry

Found by /hunt-bugs.
…tion enrichment

Address pr-test-reviewer nit on #922: pin the partial-overlay path where CC
already returned SecretArn but not Arn — the outer guard still fires and the
per-field !enriched[x] guards fill Arn/ArnForPolicy while keeping the
CC-returned SecretArn. Update changelog test count 5 -> 6.
@go-to-k
go-to-k merged commit f49a154 into main Jun 21, 2026
6 checks passed
@go-to-k
go-to-k deleted the fix-events-connection-arn branch June 21, 2026 18:36
github-actions Bot pushed a commit that referenced this pull request Jun 21, 2026
## [0.230.3](v0.230.2...v0.230.3) (2026-06-21)

### Bug Fixes

* **provisioning:** enrich Events Connection/ApiDestination Arn so ApiDestination deploys ([#922](#922)) ([f49a154](f49a154))
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 0.230.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

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.

1 participant