Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform in automation mode #343

Merged
merged 2 commits into from
Aug 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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