Skip to content

Commit

Permalink
chore(cli): remove isSpeculative
Browse files Browse the repository at this point in the history
  • Loading branch information
ansgarm committed Nov 21, 2022
1 parent c3ad5fd commit e5cae30
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions packages/@cdktf/cli-core/src/lib/cdktf-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ export type StackApprovalUpdate = {
async function getTerraformClient(
abortSignal: AbortSignal,
stack: SynthesizedStack,
_isSpeculative: boolean, // TODO: remove
createTerraformLogHandler: (
phase: string
) => (message: string, isError?: boolean) => void
Expand Down Expand Up @@ -191,15 +190,10 @@ export class CdktfStack {
});
}

private async initalizeTerraform({
isSpeculative,
}: {
isSpeculative: boolean;
}) {
private async initalizeTerraform() {
const terraform = await getTerraformClient(
this.options.abortSignal,
this.options.stack,
isSpeculative,
this.createTerraformLogHandler.bind(this)
);

Expand Down Expand Up @@ -292,7 +286,7 @@ export class CdktfStack {
public async diff(refreshOnly?: boolean, terraformParallelism?: number) {
await this.run(async () => {
this.updateState({ type: "planning", stackName: this.stack.name });
const terraform = await this.initalizeTerraform({ isSpeculative: true });
const terraform = await this.initalizeTerraform();

const plan = await terraform.plan(
false,
Expand All @@ -307,7 +301,7 @@ export class CdktfStack {
public async deploy(refreshOnly?: boolean, terraformParallelism?: number) {
await this.run(async () => {
this.updateState({ type: "planning", stackName: this.stack.name });
const terraform = await this.initalizeTerraform({ isSpeculative: false });
const terraform = await this.initalizeTerraform();

const plan = await terraform.plan(
false,
Expand Down Expand Up @@ -352,7 +346,7 @@ export class CdktfStack {
public async destroy(terraformParallelism?: number) {
await this.run(async () => {
this.updateState({ type: "planning", stackName: this.stack.name });
const terraform = await this.initalizeTerraform({ isSpeculative: false });
const terraform = await this.initalizeTerraform();

const plan = await terraform.plan(true);
this.updateState({ type: "planned", stackName: this.stack.name, plan });
Expand All @@ -377,7 +371,7 @@ export class CdktfStack {

public async fetchOutputs() {
await this.run(async () => {
const terraform = await this.initalizeTerraform({ isSpeculative: false });
const terraform = await this.initalizeTerraform();

const outputs = await terraform.output();
const outputsByConstructId = getConstructIdsForOutputs(
Expand Down

0 comments on commit e5cae30

Please sign in to comment.