Skip to content

Commit

Permalink
fix(cli): cleanup .terraform directory before upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMSchmidt committed Jun 23, 2021
1 parent 9bd3275 commit 34bdd73
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/cdktf-cli/bin/cmds/ui/models/terraform-cloud.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ export class TerraformCloud implements Terraform {

this.configurationVersionId = version.id

this.removeLocalTerraformDirectory()

const zipBuffer = await zipDirectory(this.workDir)
if (!zipBuffer) throw new Error("Couldn't upload directory to Terraform Cloud");

Expand Down Expand Up @@ -323,4 +325,8 @@ export class TerraformCloud implements Terraform {
await Promise.race([ready(), timeout()]);
logger.debug('Configuration Version is ready in Terraform Cloud');
}

private removeLocalTerraformDirectory() {
fs.rmdirSync(path.resolve(this.stack.synthesizedStackPath, ".terraform"), {recursive: true});
}
}

0 comments on commit 34bdd73

Please sign in to comment.