This message was deleted.
# typescript
s
This message was deleted.
w
Sure thing - you can fo something like
let failover = undefined; if (something) { failover = ...  } new Record(... { failover: failover });
g
how about something like this?
Copy code
function Record(type: string, record: string, failoverRoutingPolicies?: RecordFailoverRoutingPolicy[]) { return new aws.route53.Record(record, {
    records: [record],
    ttl: 300,
    type: "A",
    zoneId: aws_route53_zone_primary.zoneId,
});}
This then can be used like this:
Copy code
Record('A', '1.2.3.4');
Record('CNAME', '<http://foo.com|foo.com>');
Record('CNAME', '<http://blabla.com|blabla.com>', {somepolicy});
obviously my example isn't very useful in itself. but you get the idea: create a function which only accepts as args the 'non-common' things and hardcode the common things inside the function body.
if the failoverpolicy is the same across most entries, you can simply create it as const outside the function via
const policy = {mypolicy}
and then pass it to the function
p
many thanks! I'm gonna try it