Skip to content
This repository has been archived by the owner on Nov 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #15 from microsoft/edaena-scaffold
Browse files Browse the repository at this point in the history
Scaffold shows which values have defaults
  • Loading branch information
edaena authored Apr 16, 2020
2 parents c5ecda6 + 9faa9dd commit 2de5eb5
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/commands/infra/scaffold.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ export const generateClusterDefinition = (
vartfData: string
): { [key: string]: string | { [key: string]: string } } => {
const fields = parseVariablesTf(vartfData);
const defaultVariables: string[] = [];
// map of string to string or map of string to string
const def: { [key: string]: string | { [key: string]: string } } = {
name: values.name,
Expand All @@ -252,9 +253,18 @@ export const generateClusterDefinition = (
Object.keys(fieldDict).forEach((key) => {
if (fieldDict[key] !== DEFAULT_VAR_VALUE) {
delete fieldDict[key];
defaultVariables.push(key);
}
});
def.variables = fieldDict;

if (defaultVariables.length > 0) {
logger.info(
`Default values will be used for these variables:\n${defaultVariables.join(
"\n"
)}. \nCustom values can be set for these variables in the definition.yaml file.`
);
}
}
return def;
};
Expand Down

0 comments on commit 2de5eb5

Please sign in to comment.