Skip to content

account: add PrimaryContact managed resource - #2181

Merged
jonasz-lasut merged 3 commits into
crossplane-contrib:mainfrom
davemac30:add/account-primary-contact
Aug 3, 2026
Merged

account: add PrimaryContact managed resource#2181
jonasz-lasut merged 3 commits into
crossplane-contrib:mainfrom
davemac30:add/account-primary-contact

Conversation

@davemac30

Copy link
Copy Markdown
Contributor

Description of your changes

Adds the PrimaryContact managed resource to the account family, corresponding to the Terraform aws_account_primary_contact resource.

This is a rework of #2172 (reverted in #2180). The generated files have been regenerated from scratch on top of the current main (crossplane-runtime ≥2.3) to eliminate the stale generated output that caused the revert.

aws_account_primary_contact is a singleton resource — there is exactly one primary contact per AWS account — so it uses config.IdentifierFromProvider.

External name behaviour (documented in the example manifests):

  • When forProvider.accountId is omitted (managing the account the provider credentials belong to), the Terraform provider uses "default" as the resource ID, so the external name will be "default".
  • When forProvider.accountId is set explicitly, the external name is the target AWS account ID. Cross-account management requires the caller's IAM identity to have account:GetContactInformation and account:PutContactInformation permissions scoped to the target account.
  • For managementPolicies: [Observe] or import, set crossplane.io/external-name to "default" (current-account) or the explicit account ID, matching how the resource was originally created.

Fixes #2165

I have:

  • Read and followed Crossplane's contribution process.
  • Run make generate and committed the results (ideally in a separate commit).
  • Not made any manual changes to generated files, and verified this with make check-diff.

How has this code been tested

Tested manually against live AWS accounts using a local provider binary connected to a kind cluster.

Two scenarios were tested:

Scenario A — current-account management (member account managing itself, no accountId)

Apply, UpToDate, Import and Delete all confirmed working. External name "default" is correctly assigned.

Scenario B — cross-account management (management account targeting member account via accountId)

forProvider.accountId and crossplane.io/external-name both set to the member account ID. status.atProvider correctly reflects the member account's contact data (not the management account's), confirming account_id is correctly propagated to the AWS API.

Full test report was posted as a comment on #2172.

Adds support for aws_account_primary_contact via the account family
provider. Uses config.IdentifierFromProvider as the external name
since the resource is a singleton identified by the AWS account ID.

For Observe-only or import scenarios, the crossplane.io/external-name
annotation must be set to the AWS account ID before applying.

Signed-off-by: Dave McNeill <dave.mcneill@gmail.com>
…tion

Signed-off-by: Dave McNeill <dave.mcneill@gmail.com>
Signed-off-by: Dave McNeill <dave.mcneill@gmail.com>

@jonasz-lasut jonasz-lasut left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thank you @davemac30 LGTM!

@jonasz-lasut
jonasz-lasut merged commit 31a5894 into crossplane-contrib:main Aug 3, 2026
8 checks passed
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.

Add PrimaryContact resource to provider-aws-account

2 participants