Repository navigation
Conversation
DescribeKey resolves a KMS key by key ID, key ARN, alias name or alias ARN to its metadata (notably the key ARN). Cloud Control's AWS::KMS::Alias lists every alias in the account and returns a key ID, not an ARN. ListCertificates reads all ACM certificate pages, matches the domainName filter exactly client-side, defaults to ISSUED, requests every key type (ACM's default silently drops all but RSA_1024/RSA_2048) and sorts newest notAfter first, ties by ARN. Cloud Control does not model ACM certificates and the Tagging API returns no domain names.
kaessert
marked this pull request as ready for review
December 4, 2026 22:18
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of your changes
Adds two read-only query types.
DescribeKeyresolves a KMS key to its metadata, notably the key ARN, fromparameters.keyId. KMS accepts a key ID, key ARN, alias name (alias/platform/eks) or alias ARN, so the alias is resolved server-side. It returns one object:{keyId, arn, keyState, enabled, keyManager, keyUsage, keySpec, description, creationDate}. Cloud Control is no substitute:AWS::KMS::Aliaslists every alias in the account and returns a key ID, not an ARN. A missing or emptykeyIdis fatal and the message namesparameters.keyId.ListCertificateslists ACM certificates and returns[{certificateArn, domainName, status, type, keyAlgorithm, inUse, notBefore, notAfter}]. Cloud Control does not model ACM certificates and the Tagging API returns no domain names, hence the direct call.domainName: an exact client-side match, values OR'd. Any other filter name is fatal. A wildcard certificate is matched as*.example.com; other subject alternative names are not matched.parameters.statuses(csv) defaults toISSUED.parameters.keyTypes(csv) defaults to every key type. ACM's own default returns onlyRSA_1024/RSA_2048and would silently hide an EC orRSA_4096certificate.notAfterfirst, ties broken by ARN, so[0]is the certificate to use mid-rotation and the output is stable across reconciles.Both require a region and wrap AWS errors with the operation name (
DescribeKeyalso with the key ID).Other changes:
queryTypeenum extended and thepackage/inputCRD regenerated withgo generate.kms:DescribeKey,acm:ListCertificates), and the parameter and filter docs. The README also explains that both follow AWS on every reconcile, and that astatus.*target withskipQueryWhenTargetHasData: truegives resolve-once semantics.composition-kms-key.yamlandcomposition-acm-certificates.yaml, withexample/Makefileandexample/README.mdentries.status.kmsKeyis declared inexample/definition.yaml, as an undeclared status target fails apply.package/crossplane.yamldescription updated.service/kms v1.63.0andservice/acm v1.52.0. They were chosen to match the already-pinnedaws-sdk-go-v2 v1.48.0core, so no core bump is pulled in.Testing
Unit tests in
aws_test.go, using the existing stub pattern:TestDescribeKey,TestDescribeKeyRequiresKeyIDTestListCertificates(pagination, exactdomainNamematch, ordering, defaults)TestListCertificatesRequest(defaultISSUEDstatus and all key types on the request;statuses/keyTypesnarrowing)TestListCertificatesRejectsUnknownFilterTestKMSACMAPIError, and both types added to the existingTestEc2RegionGuardtableTestRunFunctionKMSACMTargets(status.*andcontext.*targets)Run with
go test ./....The two types were also exercised with
crossplane renderagainst a local AWS emulator: an alias resolves to the seeded key ARN, and an*.example.comfilter returns only matching certificates, newest first. The emulator cannot show the ECDSA default, so that is covered only byTestListCertificatesRequest.For reviewers
queryIntervalMinutesonly applies tostatus.*targets. This is existing behaviour infn.go, and I left it unchanged. The tests check thatlastQueryTimeis set on status targets and do not assert its absence on context targets.domainNamematches the certificate's primary domain only, not its other subject alternative names.I have: