Conditionals #5727
Replies: 2 comments 1 reply
-
Conditional support is provided by Composition Functions, and is one of the main reasons they were developed. However in this case I don't think you need the conditional, since the code is either creating a list of one element from the zero-th element of another list, or creating a list of two elements from the first two elements of another list. Why not just copy the list in it's entirety regardless of the value of
|
Beta Was this translation helpful? Give feedback.
-
Individual Composition Function implementations may provide different levels of conditional support, or none at all. |
Beta Was this translation helpful? Give feedback.
-
I am still somewhat new to crossplane, but know my way around Terraform, CloudFormation and even a bit of CDK.
The thing I haven't really found an equivalent for yet, is conditionals/ternary operators.
For example in a Amazon MQ, if it is single instance, you need to provide it with one subnet, if it is multi az you need to provide it with two. You typically have and lookup 3 AZs/subnets.
In terraform that just means you do a
And similar in CloudFormation you just use Fn::If
In crossplane I can certainly select only one subnet, as well as provide the deployment mode from a parameter as patches to in this case a apiVersion: mq.aws.upbound.io/v1beta1, kind: Broker, but similar things apply with a lot of resource types.
But how would I provide a second subnet conditionally on what the deployment mode is? Or more general, how would I add any condition to what patch either gets applied at all, or what the value of the patch is taken from?
Conditions are basically everywhere in other IaC languages.
Beta Was this translation helpful? Give feedback.
All reactions