-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Implement Physical Names throughout the library #2283
Description
Requirements:
-
If a resource is provided a physical name upon creation, its attributes should not be intrinsic functions (should be resolved during synthesis and not during deployment).
-
It should be possible to request that a physical name will be allocated for the resource without explicitly specifying the name (e.g. autoName: true)
-
When we create a sub-resource for a customer implicitly (popular example: IAM Roles), and the parent resource is used in a way that forces the sub-resource to have a physical name (i.e., in a cross-environment manner), we should automatically assign a physical name to that sub-resource.
-
Automatically add a CDK/CFN metadata key “aws:cdk:physical-name” to annotate if physical name is available.
-
This resolved ARN/name version should be returned when invoking XxxArn and maybe we should also include a property that can be used to ensure that the result is static (e.g. “staticFunctionArn”).
Idea: use ResourceName as a the prop type for physical names.
interface BucketProps {
/**
* @default byCloudFormation
*/
bucketName?: ResourceName;
}
new Bucket(this, 'foo', {
bucketName: ResourceName.byCloudFormation()
bucketName: ResourceName.byFramework()
bucketName: ResourceName.userDefined('')
});Also, see #1829 for initial discussion.
- Add relevant API to
cdk.IResource