-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: issue making it impossible to use stack references (#162)
Turns out putting the stack reference function in `index.ts` was a bad idea. Now, when importing it, the full Pulumi instructions from that project get included in the parent project as well. Really bad. This splits it out in a separate file. Do you think it looks OK? Not sure if this is how to do it.
- Loading branch information
Showing
2 changed files
with
15 additions
and
16 deletions.
There are no files selected for viewing
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
15 changes: 15 additions & 0 deletions
15
packages/pulumi/src/generators/init/files/stack-reference.ts.template
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import * as pulumi from '@pulumi/pulumi'; | ||
|
||
type ExportTypes = typeof import('./pulumi'); | ||
type ExportTypesKey = keyof ExportTypes; | ||
type ExportTypesValue<TKey extends ExportTypesKey> = ExportTypes[TKey]; | ||
|
||
type StrongTypedStackReference = Omit<pulumi.StackReference, 'getOutput' | 'requireOutput'> & { | ||
getOutput<T extends ExportTypesKey>(name: pulumi.Input<T>): ExportTypesValue<T>; | ||
requireOutput<T extends ExportTypesKey>(name: pulumi.Input<T>): ExportTypesValue<T>; | ||
}; | ||
|
||
export function getStackReference() { | ||
const stack = pulumi.getStack(); | ||
return new pulumi.StackReference(`organization/<%= name %>/${stack}`) as StrongTypedStackReference; | ||
} |