Skip to content

Commit

Permalink
Merge pull request #343 from hashicorp/no-input
Browse files Browse the repository at this point in the history
Terraform in automation mode
  • Loading branch information
skorfmann authored Aug 24, 2020
2 parents 4c4dd9c + 9f0946a commit 2495f45
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/cdktf-cli/bin/cmds/ui/models/terraform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ export class Terraform {

public async init(): Promise<void> {
await this.setUserAgent()
await exec(terraformBinaryName, ['init'], { cwd: this.workdir, env: process.env })
await exec(terraformBinaryName, ['init', '-input=false'], { cwd: this.workdir, env: process.env })
}

public async plan(destroy = false): Promise<TerraformPlan> {
const planFile = path.join(this.workdir, 'plan')
const options = ['plan', '-out', planFile, ...this.stateFileOption]
const options = ['plan', '-input=false', '-out', planFile, ...this.stateFileOption]
if (destroy) {
options.push('-destroy')
}
Expand All @@ -102,12 +102,12 @@ export class Terraform {
public async deploy(planFile: string, stdout: (chunk: Buffer) => any): Promise<void> {
const relativePlanFile = path.relative(this.workdir, planFile);
await this.setUserAgent()
await exec(terraformBinaryName, ['apply', '-auto-approve', ...this.stateFileOption, relativePlanFile], { cwd: this.workdir, env: process.env }, stdout);
await exec(terraformBinaryName, ['apply', '-auto-approve', '-input=false', ...this.stateFileOption, relativePlanFile], { cwd: this.workdir, env: process.env }, stdout);
}

public async destroy(stdout: (chunk: Buffer) => any): Promise<void> {
await this.setUserAgent()
await exec(terraformBinaryName, ['destroy', '-auto-approve', ...this.stateFileOption], { cwd: this.workdir, env: process.env }, stdout);
await exec(terraformBinaryName, ['destroy', '-auto-approve', '-input=false', ...this.stateFileOption], { cwd: this.workdir, env: process.env }, stdout);
}

public async version(): Promise<string> {
Expand Down

0 comments on commit 2495f45

Please sign in to comment.