Skip to content

Commit

Permalink
fix(pulumi): prevent existing pulumi configs from being overwritten (#…
Browse files Browse the repository at this point in the history
…6526)

* fix: issue with existing pulumi config being overwritten

* refactor: remove TODO comment in plugins/pulumi/src/helpers.ts
  • Loading branch information
BraedonLeonard authored Oct 10, 2024
1 parent 28a3828 commit dcfef40
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugins/pulumi/src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,10 +258,11 @@ export async function applyConfig(params: PulumiParams & { previewDirPath?: stri
let stackConfigFileExists: boolean
try {
const fileData = await readFile(stackConfigPath)
stackConfig = await loadAndValidateYaml(
const stackConfigDocs = await loadAndValidateYaml(
fileData.toString(),
`${basename(stackConfigPath)} in directory ${dirname(stackConfigPath)}`
)[0].toJS()
)
stackConfig = stackConfigDocs[0].toJS()
stackConfigFileExists = true
} catch (err) {
log.debug(`No pulumi stack configuration file for action ${action.name} found at ${stackConfigPath}`)
Expand Down Expand Up @@ -310,10 +311,9 @@ export async function applyConfig(params: PulumiParams & { previewDirPath?: stri
`)
} else {
log.debug(`merged config (written to ${stackConfigPath}): ${JSON.stringify(stackConfig, null, 2)}`)
await dumpYaml(stackConfigPath, stackConfig)
}

await dumpYaml(stackConfigPath, stackConfig)

return stackConfigPath
}

Expand Down

0 comments on commit dcfef40

Please sign in to comment.