diff --git a/docs/providers/spotinst/cli-reference/stage.md b/docs/providers/spotinst/cli-reference/stage.md index e26da0f55..479708f51 100644 --- a/docs/providers/spotinst/cli-reference/stage.md +++ b/docs/providers/spotinst/cli-reference/stage.md @@ -12,14 +12,30 @@ layout: Doc # Spotinst Functions - Stage Variables -You are able to set a stage variable in your function to distinguish between the multiple stages that your function maybe going through. The function is initially set to 'dev' for development but there are two ways you can change the stage if you so need. +Serverless allows you to specify different stages to deploy your project to. Changing the stage will change the environment your function is running on, which is helpful when you wish to keep production code partitioned from your development environment. -## Through Serverless Framwork +Your function's stage is set to 'dev' by default. You can update the stage when deploying the function, either from the command line using the serverless framework, or by modifying the serverless.yml in your project. When utilizing this feature, remember to include a config file that holds the environment IDs associated with your stages. An example config.json would look something like this: +```json +{ + "dev": "env-abcd1234", + "prod": "env-defg5678" +} +``` + +## Through Serverless Framework To change the stage through the serverless framework you simply need to enter the command ```bash serverless deploy --stage #{Your Stage Name} ``` +You will also need to update the environment parameter to point to the config.json: +```yaml + spotinst: + environment: ${file(./config.json):${opt:stage, self:provider.stage, 'dev'}} +``` +Note that while I am using 'dev' as the default stage, you may change this parameter to a custom default stage. + + ## Through the .yml File @@ -32,4 +48,5 @@ provider: spotinst: environment: #{Your Environment ID} ``` +Be sure to also modify your environment ID when you change the stage if you are not working with a config file. diff --git a/lib/plugins/create/templates/spotinst-java8/serverless.yml b/lib/plugins/create/templates/spotinst-java8/serverless.yml index d4eff03c4..d6281ff8b 100644 --- a/lib/plugins/create/templates/spotinst-java8/serverless.yml +++ b/lib/plugins/create/templates/spotinst-java8/serverless.yml @@ -15,9 +15,9 @@ service: spotinst-java8 provider: name: spotinst - #stage: #Optional setting. By default it is set to 'dev' + #stage: #Optional. Defaults to 'dev', see https://help.spotinst.com/hc/en-us/articles/115005893409 spotinst: - #environment: # NOTE: Remember to add the environment ID + environment: # Required. functions: hello: diff --git a/lib/plugins/create/templates/spotinst-nodejs/serverless.yml b/lib/plugins/create/templates/spotinst-nodejs/serverless.yml index 6fb1a26ee..257f12de0 100644 --- a/lib/plugins/create/templates/spotinst-nodejs/serverless.yml +++ b/lib/plugins/create/templates/spotinst-nodejs/serverless.yml @@ -15,9 +15,9 @@ service: spotinst-nodejs # NOTE: update this with your service name provider: name: spotinst - #stage: #Optional setting. By default it is set to 'dev' + #stage: #Optional. Defaults to 'dev', see https://help.spotinst.com/hc/en-us/articles/115005893409 spotinst: - #environment: # NOTE: Remember to add the environment ID + environment: # Required. functions: hello: diff --git a/lib/plugins/create/templates/spotinst-python/serverless.yml b/lib/plugins/create/templates/spotinst-python/serverless.yml index 78308ba50..94ce1ee49 100644 --- a/lib/plugins/create/templates/spotinst-python/serverless.yml +++ b/lib/plugins/create/templates/spotinst-python/serverless.yml @@ -15,9 +15,9 @@ service: spotinst-python # NOTE: update this with your service name provider: name: spotinst - #stage: #Optional setting. By default it is set to 'dev' + #stage: #Optional. Defaults to 'dev', see https://help.spotinst.com/hc/en-us/articles/115005893409 spotinst: - #environment: # NOTE: Remember to add the environment ID + environment: # Required. functions: hello: diff --git a/lib/plugins/create/templates/spotinst-ruby/serverless.yml b/lib/plugins/create/templates/spotinst-ruby/serverless.yml index 1ff0eb228..bd4464715 100644 --- a/lib/plugins/create/templates/spotinst-ruby/serverless.yml +++ b/lib/plugins/create/templates/spotinst-ruby/serverless.yml @@ -15,9 +15,9 @@ service: spotinst-ruby # NOTE: update this with your service name provider: name: spotinst - #stage: #Optional setting. By default it is set to 'dev' + #stage: #Optional. Defaults to 'dev', see https://help.spotinst.com/hc/en-us/articles/115005893409 spotinst: - #environment: # NOTE: Remember to add the environment ID + environment: # Required. functions: hello: