I'm trying to add an if
statement in add_resource
of troposphere, but I can't. Is there any workaround to do so?
s3_bucket = t.add_resource(Bucket(
"MyBucket",
if 2>1:
BucketName="bucket1",
else:
BucketName="bucket2",
CorsConfiguration=CorsConfiguration(
"CorsConfiguration",
CorsRules=[CorsRules(
"AllowOrganization",
AllowedMethods=["GET"],
AllowedOrigins=["*"],
)]
),
Tags=Tags(
Environment="aa",
)
))
Edit:
I tried to use ternary operators as well, but it didn't work.
BucketName= if 2 > 1: "bucket2" else: "bucket3",