-
Notifications
You must be signed in to change notification settings - Fork 4k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
[Core] support complex types in Fn.conditionIf #8396
Comments
I am dealing with a similar issue. Code before the change:
Code after the change:
Template before the change:
Template after the change:
Notice that the template after the change incorrectly uses |
We don't support this and I don't see us supporting it anytime soon. |
I will reopen this issue for reference but I will reiterate that the happy path for CDK is writing |
@rix0rrr Thanks for reconsidering. A reminder that the use case presented in the ticket description is using Cfn* resources to generate a CloudFormation template final deliverable and the suggested happy path of doing |
@bollig what is the workaround mechanism here? I want to set |
See
https://github.com/aws-samples/no-tears-cluster/blob/31d881b9a7fc864bf01538fb05266978cb8562c6/pcluster/pcluster_stack.py#L140
for the working solution and full context.
Cheers,
-E
On Wed, Jun 9, 2021 at 5:07 AM Martynas Jusevičius ***@***.***> wrote:
@bollig <https://github.com/bollig> what is the workaround mechanism here?
I want to set NetworkLoadBalancedEc2Service.domainZone() if HostedZone is
provided, but not sure how to do it with Fn.conditionIf() since it
provides a string and not an object :/
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#8396 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABNWQXKL3JY2ZZCX76LJHTTR44MRANCNFSM4NTNH76A>
.
--
-Evan Bollig
***@***.***
***@***.***
|
@rix0rrr Any chance of getting this one addressed? We are also using CDK to generate CloudFormation templates to be manually deployed in other environments so using This seems to be a valid use case. |
@rix0rrr We are having the same problem with DynamoDB. Depending on the input parameter value, we need to set sse_specification. It generates the cloudformation yaml file, but the output is camelCase yaml attributes, and it errors out. sse_specification = cdk.Fn.condition_if(
"NotEncryptedSearchTable",
aws_dynamodb.CfnTable.SSESpecificationProperty(
sse_enabled = False
),
aws_dynamodb.CfnTable.SSESpecificationProperty(
sse_enabled = True,
kms_master_key_id=inputParams.EncryptionKeyArn,
sse_type="KMS"
)
) Here is the yaml output, which is invalid. SSESpecification:
Fn::If:
- NotEncryptedSearchTable
- sseEnabled: false
- kmsMasterKeyId:
Ref: EncryptionKeyArn
sseEnabled: true
sseType: KMS |
@rix0rrr Can we get an official decision on the validity of this use case? Is using |
Thank you for submitting this feature request! After closer examination of the issue by CDK product and development team, there are no plans to implement this in the near feature. I am moving this to a GitHub discussion so the information in this thread can continue to be accessible, and people can find the helpful workaround posted here. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
I am using the CDK to output a raw CloudFormation template as a final deliverable and am using primarily Cfn* resource constructs. We have a CfnPipeline object where I want to conditionally add a stage depending on a CfnParameter value. I have the following code:
Which produces the following output in my CloudFormation template:
The keys of the CfnPipeline.StageDeclarationProperty and its children (CfnPipeline.ActionDeclarationProperty and CfnPipeline.ActionTypeIdProperty) are printed in camelCase, making for invalid CloudFormation objects on submission. I've also tried by wrapping the conditional statement in core.Token.as_any() with the same result.
I have resorted to using the following code:
which fixes my issue and proves that my conditional is valid in CloudFormation, but it feels messy and like the Cfn* properties should be supported in conditionals (IResolvable?).
Feels like this is a bug, but might be a feature request -- perhaps something is missing in the translation layer between nodejs and the Python API? If I'm supposed to be using the API differently, please advise.
Reproduction Steps
Run the above code patterns and inspect the cloudformation template in cdk.out
Error Log
CloudFormation complains of invalid object syntax.
Environment
Other
https://github.com/ordinaryexperts/aws-marketplace-oe-patterns-drupal/blob/f0201c49583a553832d72267ba07850b1bbe4aca/cdk/drupal/drupal_stack.py#L1870
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: