Skip to content

Commit

Permalink
feat: add support for region params and id
Browse files Browse the repository at this point in the history
  • Loading branch information
ohoareau committed Sep 2, 2024
1 parent c286e8b commit 9094839
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/utils/generateEnvLayerFromFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,14 @@ export const generateEnvLayerFromFile = async (
existsSync(targetDir) || mkdirSync(targetDir, {recursive: true});

const defaultRegion = layerConfig.defaultRegion;
const regions: layer_region_config = layerConfig.regions || {};
const regions: Record<string, layer_region_config> =
layerConfig.regions || {};

const mappedRegions = Object.entries(regions || {[defaultRegion]: {}}).map(
([rCode, r]) =>
const mappedRegions = Object.entries(
regions ||
({[defaultRegion]: {}} as Record<string, layer_region_config>),
).map(
([rCode, r]: [string, layer_region_config]) =>
[
r,
`${targetDir}/main${(r?.id || rCode) === defaultRegion ? '' : `_${rCode.replace(/-/g, '_')}`}.tf`,
Expand Down

0 comments on commit 9094839

Please sign in to comment.