Skip to content

CP-42872: trust the dedicated CloudZero connections account on provisioned roles#109

Merged
khill2018 merged 4 commits into
developfrom
CP-42872-connectors-account-id
Jun 10, 2026
Merged

CP-42872: trust the dedicated CloudZero connections account on provisioned roles#109
khill2018 merged 4 commits into
developfrom
CP-42872-connectors-account-id

Conversation

@khill2018

@khill2018 khill2018 commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

What

Adds the ConnectorsAccountId / connectors_account_id trust principal (the dedicated CloudZero connections account) as a second principal — alongside the existing reactor principal — on the cross-account roles created by the account-onboarding templates. Mirrors the existing reactor principal one-for-one across CloudFormation and Terraform.

Prod uses 559846027439; the dev parent template (connected_account_dev.yaml) uses the dev connections account (483772923246).

Why

The dedicated connections account (where the AWS connector runs) needs to assume the customer cross-account role to read billing/CUR data. This wires that trust into the onboarding templates so new customer onboards pick it up automatically.

Scope / files

  • CloudFormation account-type templates: master_payer.yaml, resource_owner.yaml
  • CloudFormation parent templates: connected_account.yaml, connected_account_dev.yaml
  • Terraform: cloudzero-aws (variable + role policy), cloudzero-payer, cloudzero-resource
  • Release note: docs/releases/1.0.100.md

The deprecated audit.yaml and cloudtrail_owner.yaml account-type templates are intentionally left unchanged.

Notes

  • Backward compatible: re-deploying with no parameter changes picks up the default automatically.
  • Lineage: the second trust principal was added in 1.0.98 (CP-42080) and reverted in 1.0.99 (CP-42815); this re-introduces it pointing at the dedicated connections account.
  • Existing customers trust only the reactor principal until their connected-account stacks are updated to the new ConnectorsAccountId — that StackSet rollout (and the latest/Discovery-Lambda refresh + BillingReportFormat consideration from CP-42796) is a separate effort, not this PR.

🤖 Generated with Claude Code

…d roles

Add the ConnectorsAccountId / connectors_account_id trust principal
(483772923246) to the account-onboarding CloudFormation templates and the
Terraform modules, matching the existing reactor principal one-for-one, so the
dedicated CloudZero connections account can assume the cross-account role. The
dev parent template uses the dev connections account (618300337335).

CP-42872

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@khill2018 khill2018 requested a review from a team as a code owner June 9, 2026 16:20
Comment thread terraform/cloudzero-payer/main.tf

@silvexis silvexis left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Audit and cloud trail policies are depreciated and not used, no changes should be made to these policies

@khill2018 khill2018 requested a review from silvexis June 10, 2026 02:17
@Cloudzero Cloudzero deleted a comment from greptile-apps Bot Jun 10, 2026
…ted stacks, align release notes

- Remove ConnectorsAccountId param pass to the deprecated cloudtrail_owner
  and audit nested stacks in connected_account.yaml / connected_account_dev.yaml
  (those templates were reverted and don't declare the param, which would
  break every CloudFormation deploy)
- Align release notes account IDs with the code (prod 559846027439, dev
  483772923246) and drop audit.yaml / cloudtrail_owner.yaml from the
  modified-files list

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@Cloudzero Cloudzero deleted a comment from greptile-apps Bot Jun 10, 2026
@khill2018

Copy link
Copy Markdown
Contributor Author

@greptile

@greptile-apps

greptile-apps Bot commented Jun 10, 2026

Copy link
Copy Markdown

Greptile Summary

This PR re-introduces the dedicated CloudZero connections account (559846027439) as a second trust principal on every cross-account IAM role created by the account-onboarding templates, mirroring the reactor principal one-for-one across all active CloudFormation and Terraform modules. All changes are backward compatible via defaults, and the sts:ExternalId condition is correctly preserved for both principals in every template.

  • CloudFormation: ConnectorsAccountId added as a parameter (with default) in master_payer.yaml and resource_owner.yaml, mapped in both parent templates and passed through to the nested stacks; the dev parent uses the dev connections account (483772923246).
  • Terraform: connectors_account_id added as a variable with default in cloudzero-aws, and as a local in cloudzero-payer / cloudzero-resource, inserted as a second principal in each module's trust policy.
  • Deprecated audit.yaml and cloudtrail_owner.yaml templates are intentionally excluded from this change.

Confidence Score: 5/5

Safe to merge — the change is a narrow, well-scoped trust-principal addition that is backward compatible and does not alter any permission boundaries.

The new principal is added inside the existing trust-policy statement, so the sts:ExternalId condition guards it exactly as it guards the reactor principal. Defaults are set everywhere so re-deploying with no parameter changes produces no user-facing impact. The dev template correctly uses the dev connections account ID, the deprecated templates are explicitly left alone, and the Terraform and CloudFormation changes are consistent with each other. No logic paths were modified — only the list of trusted principals was extended.

No files require special attention.

Important Files Changed

Filename Overview
services/account_type/master_payer.yaml Adds ConnectorsAccountId parameter (default 559846027439) and includes it as a second trust principal alongside ReactorAccountId, with sts:ExternalId condition preserved for both.
services/account_type/resource_owner.yaml Mirrors master_payer.yaml — adds ConnectorsAccountId parameter with default and wires it as a second trust principal; sts:ExternalId condition is correctly inherited by both principals.
services/connected_account.yaml Adds ConnectorsAccountId: '559846027439' to the CallbackConfiguration.prod mapping and passes it to ResourceOwnerAccount and MasterPayerAccount nested stacks; deprecated stacks intentionally unchanged.
services/connected_account_dev.yaml Same pattern as connected_account.yaml but uses the dev connections account ID (483772923246) in the CallbackConfiguration.dev mapping.
terraform/cloudzero-aws/main.tf Adds connectors_account_id as a second principal in the aws_iam_policy_document.assume_role data source; uses the proper HCL data-source approach and preserves the sts:ExternalId condition.
terraform/cloudzero-aws/variables.tf Declares connectors_account_id variable with type string, default 559846027439, and a clear description; consistent with the existing cloudzero_account_id variable style.
terraform/cloudzero-payer/main.tf Adds connectors_account_id local (following the existing cz_account_id pattern) and inserts it as a second principal in the inline jsonencode trust policy; sts:ExternalId condition unchanged.
terraform/cloudzero-resource/main.tf Identical change to cloudzero-payer/main.tf — adds connectors_account_id local and second principal; fully consistent with payer module.
docs/releases/1.0.100.md New release note accurately describes the change, lists all modified files, and notes the intentional exclusion of deprecated templates.

Reviews (6): Last reviewed commit: "docs: drop "override only if directed" g..." | Re-trigger Greptile

Comment thread terraform/cloudzero-aws/variables.tf Outdated
variable "connectors_account_id" {
type = string
default = "483772923246"
description = "Additional CloudZero AWS account ID that will assume the cross-account role. Override only if directed by CloudZero support."

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just remove this detail? We would never ask a customer to override this and the other new account

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I remove this for all btw? happy to do it! But want to be consistent!

…ields

We would never direct a customer to override the dedicated connections
account, so remove that sentence from the ConnectorsAccountId /
connectors_account_id descriptions. The existing cloudzero_account_id
variable is left unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@khill2018 khill2018 merged commit 92bcd6a into develop Jun 10, 2026
5 checks passed
@khill2018 khill2018 deleted the CP-42872-connectors-account-id branch June 10, 2026 16:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants