-
Notifications
You must be signed in to change notification settings - Fork 247
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
go: How to map Condition function return to specific type #2798
Comments
Hey @xrn, I believe your issue is related to the usage of CFN intrinsics within L2s. This is unrelated to downcasting #2819 I believe. As you said UserPoolName: awscdk.Fn_Sub(aws.String("${Environment}-SC-Pool"), nil),
// should be
UserPoolName: aws.String(fmt.Sprintf("%s-SC-Pool", Environment)), If you give an example of the condition you're using we may be able to give some more examples. |
Normal If will not work here because I need that If in template which will be deployed on multiple env with different parameters. And condition will be cloudformation.condition - https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/conditions-section-structure.html like for example
and then
From pure cloudformation yaml/json my example is correct I am using it already with goFormation |
Example from working Cloudformation template Conditions:
CreateWithPreAuthTrigger:
Fn::Or:
- Fn::Equals:
- Ref: Environment
- PROD
- Fn::Equals:
- Ref: Environment
- STG
UserPool:
Properties:
AutoVerifiedAttributes:
- email
DeviceConfiguration:
DeviceOnlyRememberedOnUserPrompt: true
EmailVerificationMessage: Your verification code is {####}.
EmailVerificationSubject: Your verification code
LambdaConfig:
Fn::If:
- CreateWithPreAuthTrigger
- PreAuthentication:
Fn::Sub: arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${Environment}-PreAuthentication-Lambda
- {}
MfaConfiguration: "OFF"
Policies:
PasswordPolicy:
MinimumLength: 8
RequireLowercase: true
RequireNumbers: true
TemporaryPasswordValidityDays: 7
UserPoolName:
Fn::Sub: ${Environment}-SC-Pool
UsernameAttributes:
- email
Type: AWS::Cognito::UserPool My team is using conditions on objects in few other places like this |
@MrArnoldPalmer any chance for help with this? |
@xrn I'll have to spend some time working through your specific examples which I don't have at the moment, but I would encourage you again to forget about what your existing cloudformation templates look like and just treat your CDK app like a normal program, and not a static template. You can pass in your environment to your cdk app and then switch, if/else, etc based on that value and change what resources are created and how. I don't think this is a go specific problem, but I'll look into it more when I have time available so we can provide language specific guidance here if CFN intrinsics are required. Have you tried using the L1 constructs instead? |
Tbh I am not sure what it mean |
@xrn sorry for the jargon 😄 . The L1s are the lower level constructs, ones named Additionally there are escape hatches that allow you to access the L1's from the L2's and edit any property however you want. There are some issues with these in go that we are currently working on though. |
Hi @MrArnoldPalmer I used
It is not perfect user experience and there is lack of materials - but at least I was able to generate
|
@xrn gonna close this for now as it's not a JSII or language specific issue. Reopen in aws/aws-cdk if you want to continue the discussion. Glad you got it resolved for now though! |
|
Affected Languages
Go
General Information
The Question
I spent this long time and can not find an answer anywhere because go in still in development preview. I have code like
Which from perspective Cloudfroamtion should work - I can create if statement for the whole object. But
Fn_ConditionIf
returns typeICfnConditionExpression
and I am expecting&awscognito.UserPoolTriggers
- digging in code we can find sth from ts but I am not sure how to map this in goThe text was updated successfully, but these errors were encountered: