I just use CDK v2 for template generation. When I try to recreate Conditions with Enums I get an error.
Expected enum value, got {"$jsii.byref":"aws-cdk-lib.Intrinsic@10012"}
Example code:
param_enableDeletionProtection = CfnParameter(self, "EnableDeletionProtection",
type="String",
allowed_values=['True','False'],
description="Whether critical services (like RDS) get provisioned with deletion protection or not")
condition_enable_deletion_protection = CfnCondition(self, "DeletionProtectionEnabled",
expression=Fn.condition_equals(param_enableDeletionProtection.value_as_string, 'True')
)
cond_removal_policy=Fn.condition_if(condition_enable_deletion_protection.logical_id,
RemovalPolicy.RETAIN,
RemovalPolicy.DESTROY
)
s3_Bucket = s3.Bucket(self, "MyBucket",
bucket_name="my-bucket-name",
removal_policy=cond_removal_policy
)
Am I doing something wrong? Or is this not supported?