-
Notifications
You must be signed in to change notification settings - Fork 19
fix: override certain incorrect primary identifiers #2328
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
fix: override certain incorrect primary identifiers #2328
Conversation
There are a number of primary identifiers in the Registry Schema that
don't agree with what the `{ Ref }` intrinsic of CloudFormation is
returning.
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.
However, certain resources in CloudFormation already had a certain
behavior, and perhaps the `{ Ref }` returned a value that wasn't unique
enough; like the name of a policy inside another resource: unique
*enough* in the context of a CloudFormation template, but not unique
enough for CCAPI.
Since the behavior of CloudFormation cannot be changed, this leads to
the inescapable conclusion that the primary identifiers of CCAPI and
CloudFormation can be different.
CDK needs to account for this difference, so we do, introducing two
kinds of primary identifiers: a CCAPI-level one and a CFN-level one.
We will do most of our codegen work off of the CFN identifier, but
we'll have the other one in our back pocket.
This list is not subject to maintenance (modulo things that Kiro and
myself have missed for whatever reason, I didn't do all of this work by
myself because that would have been crazy) because going forward for new
resources the schema must agree with the behavior of `{ Ref }`.
|
@aws-cdk/aws-service-spec: Model database diff detected |
|
@aws-cdk/aws-service-spec: Model database diff detected |
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.
Should not be committed right ?
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.
Yes you are right
|
|
||
| export type UsesType = Relationship<Resource, TypeDefinition>; | ||
|
|
||
| export interface ResourceIdentifier extends Entity { |
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.
We are removing this because we were not using it in the first place right ?
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.
Yes
| * value that other resources in the same service expect to see as the way to | ||
| * reference this resource (name or ARN or Id). | ||
| * | ||
| * Generally the same as the `ccApiPrimaryIdentifier`, but can be different |
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.
Generally the same as primaryIdentifier or is ccApiPrimaryIdentifier something else ?
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.
Ah yes, I had this the other way around first.
|
@aws-cdk/aws-service-spec: Model database diff detected |
|
nit: even if we don't plan on updating the source, might be good to have it in the diff ? |
|
@aws-cdk/aws-service-spec: Model database diff detected |
|
Noticed there was no unit test, can you add a small unit test like the arn templates one and I am good to approve |
|
Added a test |
Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
@aws-cdk/aws-service-spec: Model database diff detected |
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).
…FN (#36493) 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*
There are a number of primary identifiers in the Registry Schema that don't agree with what the
{ Ref }intrinsic of CloudFormation is returning.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.
However, certain resources in CloudFormation already had a certain behavior, and perhaps the
{ Ref }returned a value that wasn't unique enough; like the name of a policy inside another resource: unique enough in the context of a CloudFormation template, but not unique enough for CCAPI.Since the behavior of CloudFormation cannot be changed, this leads to the inescapable conclusion that the primary identifiers of CCAPI and CloudFormation can be different.
CDK needs to account for this difference, so we do, introducing two kinds of primary identifiers: a CCAPI-level one and a CFN-level one.
We will do most of our codegen work off of the CFN identifier, but we'll have the other one in our back pocket.
This list is not subject to maintenance (modulo things that Kiro and myself have missed for whatever reason, I didn't do all of this work by myself because that would have been crazy) because going forward for new resources the schema must agree with the behavior of
{ Ref }.