Skip to content

Commit

Permalink
fix: aws.XxxRef creates unneeded terraform resources (#7013)
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr authored Aug 12, 2024
1 parent a636e08 commit 46c65c1
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 1,485 deletions.
7 changes: 5 additions & 2 deletions libs/wingsdk/src/shared-aws/bucket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Construct } from "constructs";
import { AwsInflightHost } from "./inflight-host";
import { calculateBucketPermissions } from "./permissions";
import { cloud, ui } from "..";
import { InflightClient, LiftMap, lift } from "../core";
import { App, InflightClient, LiftMap, lift } from "../core";
import { INFLIGHT_SYMBOL } from "../core/types";
import { IInflightHost, Node, Resource } from "../std";

Expand Down Expand Up @@ -87,7 +87,10 @@ export class BucketRef extends Resource {
this.bucketName = bucketName;
this.bucketArn = `arn:aws:s3:::${bucketName}`;

this.addUserInterface();
const target = App.of(this)._target;
if (target === "sim") {
this.addUserInterface();
}
}

public onLift(host: IInflightHost, ops: string[]): void {
Expand Down
7 changes: 5 additions & 2 deletions libs/wingsdk/src/shared-aws/function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Construct } from "constructs";
import { AwsInflightHost, IAwsInflightHost } from "./inflight-host";
import { isValidArn } from "./util";
import { FunctionInflightMethods, IFunctionClient } from "../cloud";
import { InflightClient, lift, LiftMap } from "../core";
import { App, InflightClient, lift, LiftMap } from "../core";
import { INFLIGHT_SYMBOL } from "../core/types";
import { IInflightHost, Node, Resource } from "../std";
import * as ui from "../ui";
Expand Down Expand Up @@ -159,7 +159,10 @@ export class FunctionRef extends Resource {

this.functionArn = functionArn;

this.addUserInterface();
const target = App.of(this)._target;
if (target === "sim") {
this.addUserInterface();
}
}

public onLift(host: IInflightHost, ops: string[]): void {
Expand Down
7 changes: 5 additions & 2 deletions libs/wingsdk/src/shared-aws/queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AwsInflightHost } from "./inflight-host";
import { calculateQueuePermissions } from "./permissions";
import { isValidArn } from "./util";
import { cloud, ui } from "..";
import { lift, LiftMap, InflightClient } from "../core";
import { lift, LiftMap, InflightClient, App } from "../core";
import { INFLIGHT_SYMBOL } from "../core/types";
import { IInflightHost, Node, Resource } from "../std";

Expand Down Expand Up @@ -94,7 +94,10 @@ export class QueueRef extends Resource {

this.queueArn = queueArn;

this.addUserInterface();
const target = App.of(this)._target;
if (target === "sim") {
this.addUserInterface();
}
}

public onLift(host: IInflightHost, ops: string[]): void {
Expand Down
Loading

0 comments on commit 46c65c1

Please sign in to comment.