Skip to content

Commit

Permalink
add cloudflare
Browse files Browse the repository at this point in the history
  • Loading branch information
thdxr committed Jan 8, 2024
1 parent 80db565 commit 104a869
Show file tree
Hide file tree
Showing 7 changed files with 60 additions and 15 deletions.
3 changes: 0 additions & 3 deletions examples/test/api.ts

This file was deleted.

27 changes: 17 additions & 10 deletions examples/test/sst.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,24 @@ export default $config({
};
},
async run() {
const item = new sst.Bucket("Item2", {
nodes: {
bucket: {
bucket: "foo",
},
},
const ws = new cloudflare.WorkerScript("WorkerScript", {
module: true,
name: "my_worker",
content: `
export default {
async fetch(request) {
return new Response("Hello, world!");
}
}
`,
accountId: "15d29c8639fd3733b1b5486a2acfd968",
});
// throw new Error("lol");

return {
bucket: item.nodes.bucket.bucket,
};
/*
new cloudflare.WorkerRoute("WorkerRoute", {
scriptName: ws.name,
pattern: "*",
})
*/
},
});
17 changes: 17 additions & 0 deletions internal/components/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions internal/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"@aws-sdk/client-sts": "3.478.0",
"@aws-sdk/middleware-retry": "3.374.0",
"@pulumi/aws": "6.15.0",
"@pulumi/cloudflare": "5.17.0",
"@pulumi/pulumi": "3.98.0",
"@pulumi/random": "4.15.0",
"@smithy/smithy-client": "2.1.18",
Expand Down
4 changes: 4 additions & 0 deletions internal/components/src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import "@types/node";
import "@pulumi/aws";
import "@pulumi/pulumi";
import "@pulumi/cloudflare";
import "./components/index";
import { $config, App } from "./config";

Expand All @@ -12,6 +13,9 @@ declare global {
// @ts-expect-error
export import aws = require("@pulumi/aws");

// @ts-expect-error
export import cloudflare = require("@pulumi/cloudflare");

// @ts-expect-error
export import util = require("@pulumi/pulumi");

Expand Down
9 changes: 8 additions & 1 deletion internal/components/src/shim/run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import * as aws from "@pulumi/aws";
import * as cloudflare from "@pulumi/cloudflare";
import * as util from "@pulumi/pulumi";
import * as sst from "../components/";
import { $config } from "../config";

export { aws as "aws", util as "util", sst as "sst", $config as "$config" };
export {
aws as "aws",
util as "util",
sst as "sst",
$config as "$config",
cloudflare as "cloudflare",
};
14 changes: 13 additions & 1 deletion pkg/global/global.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,19 @@ func InstallPlugins() error {
slog.Info("installing plugins")
cmd := exec.Command("pulumi", "plugin", "install", "resource", "aws")
cmd.Env = append(os.Environ(), "PULUMI_HOME="+configDir)
return cmd.Run()
err := cmd.Run()
if err != nil {
return err
}

cmd = exec.Command("pulumi", "plugin", "install", "resource", "cloudflare")
cmd.Env = append(os.Environ(), "PULUMI_HOME="+configDir)
err = cmd.Run()
if err != nil {
return err
}

return nil
}

func NeedsPulumi() bool {
Expand Down

0 comments on commit 104a869

Please sign in to comment.