Skip to content

Commit

Permalink
Fixed using {} instead of undefined and to use Fn.select on Fn.getAZs (
Browse files Browse the repository at this point in the history
  • Loading branch information
adwhalen committed Mar 15, 2023
1 parent 0eb207e commit 2b6393b
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/synthesizer/typescript_synthesizer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ pub fn to_string_ir(resource_value: &ResourceIr) -> Option<String> {
ResourceIr::If(bool_expr, true_expr, false_expr) => {
let bool_expr = pretty_name(bool_expr);
let true_expr = match to_string_ir(true_expr) {
None => String::from("{}"),
None => String::from("undefined"),
Some(x) => x,
};
let false_expr = match to_string_ir(false_expr) {
Expand Down Expand Up @@ -417,7 +417,12 @@ pub fn to_string_ir(resource_value: &ResourceIr) -> Option<String> {
}
ResourceIr::Select(index, obj) => {
let str = to_string_ir(obj.as_ref()).unwrap();
Option::Some(format!("{}[{}]", str, *index))
match obj as &ResourceIr {
ResourceIr::GetAZs(_) => {
Option::Some(format!("cdk.Fn.select({}, {})", *index, str))
}
_ => Option::Some(format!("{}[{}]", str, *index)),
}
}
ResourceIr::Cidr(ip_block, count, cidr_bits) => {
let ip_block_str = to_string_ir(ip_block.as_ref()).unwrap();
Expand Down

0 comments on commit 2b6393b

Please sign in to comment.