serverless-cloudformation-changesets icon indicating copy to clipboard operation
serverless-cloudformation-changesets copied to clipboard

Taking stage and region from the provider and not from options

Open mavax opened this issue 6 years ago • 1 comments

I was having issues when I had serverless variables specified including stage, those were not being used.

Also, the error was not very clear:

  Serverless Error ---------------------------------------
 
  Missing required key 'Value' in params.Tags[0]

I'm not 100% sure this is the proper way to do this, but it seems to work for my case.

mavax avatar Mar 28 '18 09:03 mavax

trek10inc did you see this?

Mavax, you're largely correct. This plugin fails if you don't provide the optional command line argument 'stage'. That seems like bug territory. Though, ergh, this is such a painful topic. Mostly because the serverless team have been so painfully unopinionated about it. Their docs sometimes say to use

provider:
  stage: ${opt:stage, 'dev'}

but sometimes say to make a custom variable the single point of truth, and worse still in their default template they don't broach the issue at all. Thus I can see that pointing to provider.stage as not an appropriate solution for all.

Perhaps a more universal solution to this bug would be to employ the same logic in the code? i.e., look for opt.stage, and if not there, look for provider.stage. I imagine this is what other plugins do.

jamesoflol avatar Jul 11 '18 07:07 jamesoflol