Comments (6)
Ah I see. Sorry, I miss read your code.
If we made stage
available in the Stack
object, would that work for you? So inside your SubStack
, you can do this.stage
instead of props.stage
.
from sst.
@justindra I'm working on supporting stack.stage
in PR #240
I'm going to change the title for this issue to this. And I opening a discussion for this instead https://github.com/serverless-stack/serverless-stack/discussions/244
from sst.
While you are looking at this, would it be possible to add the stage into the Stack? Atm I have to pass in the stage into my custom resources as a prop. It would be nice to be able to acces it from the Stack
itself instead of having to repetitively pass it in as a prop.
import { Stack, App, StackProps } from '@serverless-stack/resources';
export class MyStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
super(scope, id, props);
new SubStack(this, id, { stage: scope.stage }); // <-- be nice if we can just get the stage from `this`
new CustomResource1(this, id, { stage: scope.stage });
new CustomResource2(this, id, { stage: scope.stage });
}
}
// vs
export class MyStack extends Stack {
constructor(scope: App, id: string, props?: StackProps) {
super(scope, id, props);
new SubStack(this, id);
new CustomResource1(this, id);
new CustomResource2(this, id);
}
}
Currently I've got my custom Stack object that does this, but might be nice to have it as part of the framework.
from sst.
Hi @justindra, are you creating a nested stack?
from sst.
@fwang Not at the moment, its just custom TS Classes to tidy up and make some resources more re-usable. E.g. I have a Table class that creates a DDB Table, Lambda Hooks and CFn Outputs. But possibly some nested stacks in the future too.
from sst.
Yep @fwang that would be perfect!
from sst.
Related Issues (20)
- SvelteKit adapter: Incorrect Content-Type header for __data.json HOT 2
- Option to pass `buildOutputPath` to OpenNext when using the NextjsSite construct
- Is top-level await really necessary? HOT 4
- Caching issue when using custom hook built with Context HOT 1
- How to get long running job status and result
- Certificate Requestor still failing in Node v18 HOT 1
- ApiLambdaAuthorizer fails if not an async function HOT 1
- Cannot deploy Python container using Service construct HOT 3
- PFR: automatically add `awsApplication` tag to all resources created by SST to enable new "myApplications" AWS feature HOT 3
- NextJs Site getting error "Cannot find module 'next/dist\client\components\static-generation-async-storage.external.js'" HOT 2
- Cloudformation Termination Protection and Confusion with setDefaultRemovalPolicy HOT 3
- Typescript suddenly incompatible between SST and CDK constructs HOT 6
- Support Astro v4
- Deployment of Astro Starlight sites is broken
- CommonJS in Node runtime
- How to get node-canvas layer working with live lambda HOT 1
- SST prisma example is broken HOT 1
- HTTP_PROXY support via global-agent is broken HOT 4
- Support Node 20 (Update fast-jwt, EBADENGINE for <20) HOT 1
- FeatureRequest: Provide a way to use TypeBox as scheme provider for EventBus HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sst.