diff --git a/packages/pulumi/src/generators/init/files/index.ts.template b/packages/pulumi/src/generators/init/files/index.ts.template index 5fa794ab..5d0da025 100644 --- a/packages/pulumi/src/generators/init/files/index.ts.template +++ b/packages/pulumi/src/generators/init/files/index.ts.template @@ -15,19 +15,3 @@ register({ import './pulumi' export * from './pulumi' - -import * as pulumi from '@pulumi/pulumi'; - -type ExportTypes = typeof import('./pulumi'); -type ExportTypesKey = keyof ExportTypes; -type ExportTypesValue = ExportTypes[TKey]; - -type StrongTypedStackReference = Omit & { - getOutput(name: pulumi.Input): ExportTypesValue; - requireOutput(name: pulumi.Input): ExportTypesValue; -}; - -export function getStackReference() { - const stack = pulumi.getStack(); - return new pulumi.StackReference(`organization/<%= name %>/${stack}`) as StrongTypedStackReference; -} diff --git a/packages/pulumi/src/generators/init/files/stack-reference.ts.template b/packages/pulumi/src/generators/init/files/stack-reference.ts.template new file mode 100644 index 00000000..94b9fdf0 --- /dev/null +++ b/packages/pulumi/src/generators/init/files/stack-reference.ts.template @@ -0,0 +1,15 @@ +import * as pulumi from '@pulumi/pulumi'; + +type ExportTypes = typeof import('./pulumi'); +type ExportTypesKey = keyof ExportTypes; +type ExportTypesValue = ExportTypes[TKey]; + +type StrongTypedStackReference = Omit & { + getOutput(name: pulumi.Input): ExportTypesValue; + requireOutput(name: pulumi.Input): ExportTypesValue; +}; + +export function getStackReference() { + const stack = pulumi.getStack(); + return new pulumi.StackReference(`organization/<%= name %>/${stack}`) as StrongTypedStackReference; +}