Hi everyone! I am currently migrating my projects ...
# sst
k
Hi everyone! I am currently migrating my projects to sst v1.0.4 and I would like to tag my stacks and all resources in them. In the previous version it was possible with Tags.of(stack).add('tag', 'value')
Copy code
Tags.of(stack).add('tag', 'value')
Is there a way to do it in sst v1.0.4. with the new functional stacks?
s
I'm using the same format in SST 1.x. The
Tags
construct is an AWS CDK construct, not SST. SST is what introduces the functional style. I suppose you could make a Tags function, and move all of your CDK Tag creation into that construct 🤷
Copy code
export function MyTags({ stack, app }: StackContext) {
  Tags.of(stack).add('tag1', 'value')
  Tags.of(stack).add('tag2', 'value')
  Tags.of(stack).add('tag3', 'value')
}
and in your index.ts
Copy code
import {MyTags} from "./MyTags"

export default function main(app: App) {
  app.stack(MyTags)
}
but that might not be what you're looking for
t
yeah you should be able to move the tags call into your function and pass
stack
as the first arg
We also did add an
app.getStack(func)
function if you want to get the stack in the main file
k
@Seth Geoghegan Thanks, this is exactly what I was looking for!