Skip to content

Instantly share code, notes, and snippets.

@mgjam
Created October 21, 2021 06:45
Show Gist options
  • Save mgjam/2bf6a55475b633246f109b7b731dbc58 to your computer and use it in GitHub Desktop.
Save mgjam/2bf6a55475b633246f109b7b731dbc58 to your computer and use it in GitHub Desktop.
export class ExportingStack extends Stack {
public readonly bucket: Bucket;
constructor(scope: Construct, id: string, props: StackProps) {
super(scope, id, props);
this.bucket = new Bucket(this, 'ExportedBucket');
}
}
export interface ImportingStackProps extends StackProps { bucket: Bucket }
export class ImportingStack extends Stack {
public readonly output: CfnOutput;
constructor(scope: Construct, id: string, props: ImportingStackProps) {
super(scope, id, props);
this.output = new CfnOutput(this, 'bucketDomainName', {
value: props.bucket.bucketDomainName
});
}
}
const exportingStack = new ExportingStack(app, 'exp', {});
const importingStack = new ImportingStack(app, 'imp', {
bucket: exportingStack.bucket
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment