Adding "tags" to "provider" in serverless.yml

I would like a certain set of tags applied to every resource that supports them, and do not want to have to repeat them for each one. For example, I’d like the SLS stage, service name, and a few other custom tags added to my functions, APIGW resources, and DynamoDB tables (the first two created automatically by SLS, and the latter created by my Resources section). Is this currently supported? I don’t want to have to copy and paste the list of tags to each of the functions, etc.

1 Like

use provider.stackTags
example:

provider:
  name: aws
  runtime: nodejs6.10
  stackTags:
    STACK: "${self:service}"
    REGION: "${self:custom.region}"

Stage is included by default. The above adds stack and region.
This includes Resources as long as they are created after adding the stack tags to the provider.
I don’t see any place to set tags on APIGW resources even through the AWS console, so can’t help you there. But this handles everything else.

3 Likes

Do you mean that you have to run deploy twice before this works? Or do you just mean that you of course need to already have these tags in the yml before deploying?

Also, are STACK and REGION reserved words or can we place any tag name globally on all resources this way?