Skip to content

Conversation

@rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Dec 24, 2025

This is the change in CDK that consumes the spec update cdklabs/awscdk-service-spec#2328.

This accounts for { Ref } not always returning what the schema says that the primary identifier of a resource is. This is not unexpected or wrong: the Registry Schema describes the behavior of Cloud Control API, and the identifier uniquely identifies a resource in an account. We do need to account for the differences though.

What we will do is:

  • Retain the CC-API fields in the reference interface if we hvae the values.
  • Fall back to the (smaller) CFN identifier fields if we don't have the values.
  • Make the CFN identifier fields win if the identifiers are equal size (in which case we probably a Name vs ARN distinction).

This brings in a new version of service-spec so it also adds a new service.


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

This is the change in CDK that consumes the spec update cdklabs/awscdk-service-spec#2328.

This accounts for `{ Ref }` not always returning what the schema says
that the primary identifier of a resource is. This is not unexpected or
wrong: the Registry Schema describes the behavior of Cloud Control API,
and the identifier uniquely identifies a resource in an account. We do
need to account for the differences though.

What we will do is:

- Retain the CC-API fields in the reference interface if we hvae the
  values.
- Fall back to the (smaller) CFN identifier fields if we don't have the
  values.
- Make the CFN identifier fields win if the identifiers are equal
  size (in which case we probably a Name vs ARN distinction).
@rix0rrr rix0rrr requested review from a team December 24, 2025 11:21
@github-actions github-actions bot added the p2 label Dec 24, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team December 24, 2025 11:21
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Dec 24, 2025
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

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

(This review is outdated)

@rix0rrr rix0rrr added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Dec 24, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review December 24, 2025 12:34

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@rix0rrr rix0rrr force-pushed the huijbers/cfn-identifiers branch from 2134694 to ddfb1a0 Compare December 29, 2025 10:58
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 29, 2025
export function findNonIdentifierArnProperty(resource: Resource) {
return findArnProperty(resource, (name) => !resource.primaryIdentifier?.includes(name));
const refIdentifier = resource.cfnRefIdentifier ?? resource.primaryIdentifier;
return findArnProperty(resource, (name) => !refIdentifier?.includes(name));
Copy link
Contributor

Choose a reason for hiding this comment

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

i know you didn't add in the !, but if we're confident primaryIdentifier always exists, then why is the property typed as optional in the first place?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we're confident that it exists here, not that it exists in general?

The property is probably optional because we added it later.

* the `Arn`. We will just use the CFN value as leading.
*
* We will identify the difference between these 2 cases by the length of the primary
* identifier: equal length = aliasing, different length = specificity.
Copy link
Contributor

Choose a reason for hiding this comment

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

by length you mean length of the identifier array and not length of their string value, correct? i was slightly confused here at how we are identifying the difference between the two cases. this also means that we are certain that there is no case where the CC-API identifier is simply different than the CFN identifier (not aliased). we are certain this is the case?

also, are we using 'unique identifier' and 'primary identifier' interchangably?

Copy link
Contributor Author

@rix0rrr rix0rrr Dec 29, 2025

Choose a reason for hiding this comment

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

length of the identifier array and not length of their string value

Yes.

CC-API identifier is simply different than the CFN identifier (not aliased)

Well, "aliased" is probably a wrong name here but I couldn't think of a better one. I'm thinking of [Name] <-> [Arn]. That is indeed "different", but it's a different kind of different from [StageName] <-> [ApiId, StageName].

also, are we using 'unique identifier' and 'primary identifier' interchangably?

I guess so. I'm trying to put the distinction on CCAPI identifier vs CFN identifier, the other words are not different on purpose.

Comment on lines 6 to 8
// actual = actual.split('\n').map(x => x.trim()).join('\n');
// subset = subset.split('\n').map(x => x.trim()).join('\n');
// console.log(actual);
Copy link
Contributor

Choose a reason for hiding this comment

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

accident?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah.

Removed commented-out code for trimming and logging.
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Dec 29, 2025
@mergify
Copy link
Contributor

mergify bot commented Dec 29, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Dec 29, 2025

Merge Queue Status

✅ The pull request has been merged at a071b05

This pull request spent 29 minutes 53 seconds in the queue, including 29 minutes 42 seconds running CI.
The checks were run in-place.

Required conditions to merge

@mergify
Copy link
Contributor

mergify bot commented Dec 29, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 3b06942 into main Dec 29, 2025
17 of 18 checks passed
@mergify mergify bot deleted the huijbers/cfn-identifiers branch December 29, 2025 15:13
@github-actions
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants