Created
June 20, 2019 00:25
-
-
Save lukehoban/b7e4b01bb172b496e3b1f74cb658599e to your computer and use it in GitHub Desktop.
Passing credentials to a Pulumi dynamic provider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as splunk from "./splunk" | |
async function getSecretValue(): Promise<string> { | |
return "abcd" | |
} | |
getSecretValue().then(secret => { | |
splunk.setAuth(secret); | |
new splunk.SavedSearch("foo", {}); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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