AWS has best practices for CDK in place, which state that it's better to use generated names for resources instead of physical ones, see section "Use generated resource names, not physical names".
Consider the following Construct
:
from aws_cdk import aws_timestream
from constructs import Construct
class MyConstruct(Construct):
def __init__(self, scope, id_):
super().__init__(scope, id_)
my_database = aws_timestream.CfnDatabase(self, "MyTimestreamDatabase")
my_table = aws_timestream.CfnTable(
scope=self,
id="MyTimestreamTable",
database_name=my_database.database_name,
retention_properties={...}
)
my_table.add_depends_on(my_database)
Running cdk synth
involving an instance of this class throws
TypeError: type of argument database_name must be str; got NoneType instead
Question: How do I create an Amazon Timestream database with AWS CDK v2 without assigning a physical name to it?