ArticCon 2022 (continued)
Rather than plumb in all of those changes, remapping them explicitly when we declare a resource like this
new ComputeSubnetwork(this, subnet, {
name: subnet,
cidrBlock: i[vpc][subnet].config..cidr
gatewayAddress: i[vpc][subnet].config.gateway
// there are a total of 23 potential arguments for this resource alone
})
It would be easier to transform our data into datastructure that’s easier to program with so we can just hand off the configuration as a single variable
new ComputeSubnetwork(this, subnet, i[vpc][subnet].config)
And any extra arguments can still be added by destructuring or spreading depending on your language of choice
new ComputeSubnetwork(this, subnet, {
...i[vpc][subnet].config,
anyExtraArgs: canStillBeAdded
})