-
Notifications
You must be signed in to change notification settings - Fork 9
Discover BCM Data Exports CUR 2.0 buckets for IAM policy #110
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
Open
silvexis
wants to merge
6
commits into
develop
Choose a base branch
from
feature/discovery-cur2-data-exports
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
30ac467
Discover BCM Data Exports CUR 2.0 buckets for IAM policy
silvexis 50c9b31
Isolate per-export GetExport failures and cover pagination
khill2018 5b0c9e0
Flatten connected-account stack and modernize custom resources
silvexis 0f5f29c
Address PR review: redact sensitive logs, harden BCM error handling
silvexis 82983fd
Fix remaining CodeQL clear-text-logging alerts
silvexis 963e74f
Drop CUR-format log line that trips CodeQL false positive
silvexis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # [1.0.101](https://github.com/Cloudzero/provision-account/compare/1.0.100...1.0.101) (2026-06-15) | ||
|
|
||
| > Discover BCM Data Exports (CUR 2.0) S3 buckets and add them to the master-payer IAM policy | ||
|
|
||
| ## New Features | ||
|
|
||
| ### CUR 2.0 Bucket Discovery | ||
| * **Discovery now calls `bcm-data-exports:ListExports` + `bcm-data-exports:GetExport`** — AWS is migrating customers from the classic CUR to BCM Data Exports. `list_exports` only returns export ARNs, so each export is resolved with `get_export` to read its `DestinationConfigurations.S3Destination.S3Bucket`. | ||
| * **Type-agnostic bucket access, `COST_AND_USAGE_REPORT`-only ingest** — CloudZero only ingests exports of type `COST_AND_USAGE_REPORT` (CUR 2.0), but the IAM policy is intentionally granted access to the destination bucket of *every* export regardless of type. This mirrors the existing schema-agnostic behavior for classic CUR: a bucket referenced by any export is legitimate billing storage, and the customer can switch export configurations without redeploying this stack. | ||
| * **CUR 2.0 buckets are folded into `MasterPayerBillingBucketArns`** — `get_all_local_cur_bucket_names` now unions the classic CUR report buckets with the BCM Data Exports destination buckets, keeping only those owned locally. The master-payer role gains `s3:Get*`/`s3:List*` on the export buckets the same way it already covers classic CUR buckets. | ||
| * **Graceful degradation** — if the account cannot call BCM Data Exports (e.g. `AccessDeniedException`), discovery logs a warning and falls back to the classic CUR buckets rather than failing. | ||
|
|
||
| ### Template | ||
| * **`DiscoveryFunction` execution role gains `bcm-data-exports:ListExports` and `bcm-data-exports:GetExport`** — required for the discovery Lambda to enumerate CUR 2.0 export destinations. (The cross-account role policies already grant `bcm-data-exports:Get*/List*`.) | ||
|
|
||
| ## Files Modified | ||
|
|
||
| - `services/discovery/src/app.py` | ||
| - `services/discovery/template.yaml` | ||
| - `services/discovery/tests/unit/test_app.py` | ||
|
|
||
| ## Deployment Notes | ||
|
|
||
| * No customer action required. On the next stack update, the discovery Lambda begins enumerating BCM Data Exports destinations and the master-payer IAM policy's billing-bucket statement gains `Resource:` entries for any local CUR 2.0 / FOCUS export buckets. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # [1.0.102](https://github.com/Cloudzero/provision-account/compare/1.0.101...1.0.102) (2026-06-16) | ||
|
|
||
| > Flatten the connected-account stack to a single nested stack, move CUR creation to native CloudFormation, and remove the deprecated audit / cloudtrail-owner account types | ||
|
|
||
| ## Breaking / Behavioral Changes | ||
|
|
||
| ### Master-payer CUR creation now requires `us-east-1` | ||
| * The Cost and Usage Report for a payer account is now created with the native | ||
| **`AWS::CUR::ReportDefinition`** resource (plus `AWS::S3::Bucket` + `AWS::S3::BucketPolicy`), | ||
| replacing the inline `Custom::CostAndUsageReport` Lambda. AWS only supports this resource in | ||
| `us-east-1`, so **payer accounts that need a new CUR must be onboarded from `us-east-1`**. | ||
| Launched elsewhere on such an account, the cross-account role is still created but the CUR is | ||
| skipped; the stack's new `MasterPayerCurStatus` output reports why. Payer accounts that | ||
| already have a CUR are unaffected by region. The CUR bucket uses `DeletionPolicy: Retain`, so | ||
| billing data is never deleted on stack removal (matching the prior Lambda behavior). | ||
|
|
||
| ### Audit and CloudTrail-owner account types removed | ||
| * The deprecated **audit** and **cloudtrail-owner** roles/features are gone: their templates, | ||
| the discovery Lambda's CloudTrail/audit detection, and the `cloudtrail:DescribeTrails` | ||
| discovery permission have all been removed. | ||
| * The reactor notification payload contract is **unchanged** — the `links.audit`, | ||
| `links.cloudtrail_owner`, and `discovery.*cloudtrail*` / `is_audit_account` / | ||
| `is_cloudtrail_owner_account` fields remain in the payload and are now always `null` / `false`. | ||
|
|
||
| ## New Features | ||
|
|
||
| ### Single nested stack (was 6) | ||
| * `connected_account.yaml` now **inlines** the Discovery and Notification Lambdas (as native | ||
| `AWS::Lambda::Function` + `AWS::IAM::Role`) and provisions account resources through one | ||
| nested `AccountResources` stack (`services/account_type/account_resources.yaml`, merging the | ||
| former resource_owner + master_payer templates). The discovery, notification, resource_owner, | ||
| cloudtrail_owner, audit, and master_payer nested templates are no longer used as nested stacks. | ||
| * The notification Lambda no longer scrapes sibling CloudFormation stack outputs at runtime; it | ||
| receives every value it needs as direct resource properties, and its execution role drops | ||
| `AWSCloudFormationReadOnlyAccess`. | ||
|
|
||
| ### `Stage` parameter | ||
| * Both `connected_account.yaml` and `connected_account_dev.yaml` now carry a `Stage` parameter | ||
| (`prod` / `dev`) selecting the `CallbackConfiguration` mapping, so the two files differ only | ||
| by the `Stage` default instead of diverging across every resource. | ||
|
|
||
| ### Code clarity | ||
| * The discovery and notification Lambda handlers were rewritten from the `toolz`-pipeline / | ||
| decorator-coeffect style into straightforward, auditable procedural flows. | ||
|
|
||
| ## Files Modified | ||
|
|
||
| - `services/connected_account.yaml`, `services/connected_account_dev.yaml` | ||
| - `services/account_type/account_resources.yaml` (new; replaces the four account-type templates) | ||
| - `services/discovery/src/app.py`, `services/discovery/template.yaml`, discovery tests | ||
| - `services/notification/src/app.py`, notification tests | ||
| - `README.md` | ||
|
|
||
| ## Files Removed | ||
|
|
||
| - `services/account_type/resource_owner.yaml` | ||
| - `services/account_type/master_payer.yaml` | ||
| - `services/account_type/audit.yaml` | ||
| - `services/account_type/cloudtrail_owner.yaml` | ||
|
|
||
| ## Deployment Notes | ||
|
|
||
| * On the next stack update, existing customer stacks delete the old per-account-type nested | ||
| stacks and create the single `AccountResources` stack; the cross-account IAM roles are | ||
| recreated (trust is by ExternalId and role path/names are stable, so CloudZero access | ||
| continues). Validate on a stack *update* in a test account, including the master-payer paths. | ||
| * **Follow-up:** `policies/` and `terraform/` still carry audit / cloudtrail-owner definitions to | ||
| clean up in a separate change. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
The version (
1.0.101) and date (2026-06-15) are hardcoded here. The compare-URL format suggests releases may be auto-generated (semantic-release style) — if so, a hand-written release file could conflict with or duplicate the generated one. Worth confirming this is the intended workflow for the repo.