Skip to content

Commit

Permalink
Initial commit from pulumi new output. Successfully deploys a Googl…
Browse files Browse the repository at this point in the history
…e Cloud Function.
  • Loading branch information
0xJem committed Oct 21, 2022
1 parent ab91029 commit 5705c0f
Show file tree
Hide file tree
Showing 9 changed files with 2,817 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"hashicorp.terraform",
"rvest.vs-code-prettier-eslint",
"dbaeumer.vscode-eslint",
"mquandalle.graphql",
"gruntfuggly.todo-tree",
"redhat.vscode-yaml"
]
}
9 changes: 9 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"eslint.alwaysShowStatus": true,
"eslint.packageManager": "yarn",
"eslint.format.enable": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"typescript.format.enable": false,
}
2 changes: 2 additions & 0 deletions Pulumi.dev.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config:
gcp:project: utility-descent-365911
3 changes: 3 additions & 0 deletions Pulumi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name: subgraph-cache
description: Caches records from subgraphs in Google Cloud Storage
runtime: nodejs
31 changes: 31 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";
import { handler } from "./src";

const GCP_REGION = "us-central1";
const BUCKET_NAME = `olympusdao-subgraph-cache-${pulumi.getStack()}`;

/**
* Define required resources
*/

// Create a bucket to store the cached results
const storageBucket = new gcp.storage.Bucket(BUCKET_NAME, {
location: GCP_REGION,
uniformBucketLevelAccess: true,
versioning: { enabled: false },
});

// Export the DNS name of the bucket
export const storageBucketName = storageBucket.url;

// Create a function
const tokenHolderFunction = new gcp.cloudfunctions.HttpCallbackFunction("token-holders", {
runtime: "nodejs14",
region: GCP_REGION,
callback: (_req: Express.Request, res: Express.Response) => {
handler();
},
});

export const functionUrl = tokenHolderFunction.httpsTriggerUrl;
Loading

0 comments on commit 5705c0f

Please sign in to comment.