Skip to content

Instantly share code, notes, and snippets.

@lukehoban
Created June 20, 2019 00:25
Show Gist options
  • Save lukehoban/b7e4b01bb172b496e3b1f74cb658599e to your computer and use it in GitHub Desktop.
Save lukehoban/b7e4b01bb172b496e3b1f74cb658599e to your computer and use it in GitHub Desktop.
Passing credentials to a Pulumi dynamic provider
import * as splunk from "./splunk"
async function getSecretValue(): Promise<string> {
return "abcd"
}
getSecretValue().then(secret => {
splunk.setAuth(secret);
new splunk.SavedSearch("foo", {});
});
import * as pulumi from "@pulumi/pulumi"
let auth: string | undefined;
export function setAuth(secret: string) {
auth = secret;
}
export interface SavedSearchInput { }
const provider: pulumi.dynamic.ResourceProvider = {
async create(): Promise<pulumi.dynamic.CreateResult> {
console.log(auth);
return { id: "id", outs: {} }
},
async delete() {
console.log(auth);
},
}
export class SavedSearch extends pulumi.dynamic.Resource {
public readonly name: pulumi.Output<string>;
constructor(name: string, props: SavedSearchInput, opts?: pulumi.CustomResourceOptions) {
super(provider, name, props, opts);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment