You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to leverage plugins that modify variables, like serverless-plugin-ifelse
For bug reports:
What went wrong?
It appears that the plugin is executing prior to other plugins that may modify the state.. for example I am using serverless-plugin-ifelse
What did you expect should have happened?
I am expecting any modifications done by this plugin to have changed the variables used for annotating the step function yml
What was the config you used?
This is a child serverless.yml that inherits definitions from above (irrelevant)
service: ${file(./serverless.yml):custom.service}package: ${file(../../../../serverless.shared.yml):package}plugins:
- serverless-dotenv-plugin
- serverless-prune-plugin
- serverless-plugin-ifelse
- serverless-step-functions
- serverless-plugin-lambda-insights
- serverless-stack-outputcustom:
# This is to make a service suffix used for review branches and stages alikesuffix: ${sls:stage}serverlessIfElse:
- If: '"${env:REVIEW_BRANCH_HASH, ""}" !== ""'Set:
custom.suffix: ${env:REVIEW_BRANCH_HASH, ''}-${sls:stage}output:
file: stack-output.tomlprovider:
name: ${file(./serverless.yml):provider.name}runtime: ${file(./serverless.yml):provider.runtime}architecture: ${file(./serverless.yml):provider.architecture}region: ${env:AWS_REGION}memorySize: ${file(./serverless.yml):provider.memorySize}timeout: ${file(./serverless.yml):provider.timeout}stepFunctions:
stateMachines:
TestSFN:
id: TestSFNname: ${self:service}-${sls:stage}role: arn:aws:iam::${aws:accountId}:role/${file(./serverless.yml):custom.service}-step-function-roledefinition:
StartAt: AccessStates:
Access:
Type: TaskResource: "arn:aws:lambda:${aws:region}:${aws:accountId}:function:my-lambda-name-${self:custom.suffix}"Parameters:
Payload.$: "$"Catch:
- ErrorEquals: ["States.ALL"]Next: ConcludeNext: WaitWait:
Type: WaitTimestampPath: "$.job.expiryDate"Next: ConcludeConclude:
Type: TaskResource: "arn:aws:lambda:${aws:region}:${aws:accountId}:function:my-other-lambda-name-${self:custom.suffix}"Parameters:
Payload.$: "$"End: true
What stacktrace or error message from your provider did you see?
$ sls print --config $SLS_CONFIG_YML --stage $SLS_DEPLOY_STAGE
Running "serverless" from node_modules
DOTENV: Loading environment variables from .env.dev:
- PROVISIONED_CONCURRENCY
- RESERVED_CONCURRENCY
service: my-service-stack-cc8c5cd
configValidationMode: error
package:
artifact: >-
dist/package.zip
artifactsS3KeyDirname: serverless/my-service-stack-cc8c5cd/dev/code-artifacts
plugins:
- serverless-dotenv-plugin
- serverless-deployment-bucket
- serverless-prune-plugin
- serverless-plugin-ifelse
- serverless-step-functions
- serverless-stack-output
useDotenv: true
custom:
workspace: my-workspace
project: my-project
dist: ./dist
service: my-service-stack
suffix: dev
serverlessIfElse:
- If: '"-cc8c5cd" !== ""'
Set:
custom.suffix: '-cc8c5cd-dev'
dotenv:
v4BreakingChanges: true
output:
file: stack-output.toml
provider:
name: aws
runtime: nodejs20.x
architecture: arm64
memorySize: 512
timeout: 20
region: us-east-1
stackTags:
Env: dev
Name: my-service-stack-cc8c5cd
Repository: >-
https://gitlab.com/....
Stage: dev
Version: 0906e6c7
environment:
APP_NAME: my-service-stack-cc8c5cd
NODE_ENV: dev
STAGE: dev
NO_COLOR: 'true'
LOG_LEVEL: info
PROVISIONED_CONCURRENCY: '1'
RESERVED_CONCURRENCY: '2'
deploymentBucket: my-deployment-bucket-us-east-1
iam:
role: >-
arn:aws:iam::XXXXXXXXXXXX:role/my-service-stack-lambda-role
stage: dev
versionFunctions: true
deploymentBucketObject:
name: my-deployment-bucket-us-east-1
stepFunctions:
stateMachines:
TestSFN:
id: TestSFN
name: my-service-stack-cc8c5cd-dev
role: >-
arn:aws:iam::XXXXXXXXXXXX:role/my-service-stack-step-function-role
definition:
StartAt: Access
States:
Access:
Type: Task
Resource: >-
arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:my-lambda-name-dev
Parameters:
Payload.$: $
Catch:
- ErrorEquals:
- States.ALL
Next: Conclude
Next: Wait
Wait:
Type: Wait
TimestampPath: $.job.expiryDate
Next: Conclude
Conclude:
Type: Task
Resource: >-
arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:my-other-lambda-name-dev
Parameters:
Payload.$: $
End: true
$ sls deploy --config $SLS_CONFIG_YML --stage $SLS_DEPLOY_STAGE --verbose
Running "serverless" from node_modules
DOTENV: Loading environment variables from .env.dev:
- PROVISIONED_CONCURRENCY
- RESERVED_CONCURRENCY
Deploying my-service-stack-cc8c5cd to stage dev (us-east-1)
Using deployment bucket 'my-deployment-bucket-us-east-1'
serverless-plugin-ifelse - ("-cc8c5cd" !== "") Condition true.
serverless-plugin-ifelse - Value Changed for : custom.suffix to: -cc8c5cd-dev
Uploading CloudFormation file to S3
Uploading State file to S3
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Executing created change set
UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - my-service-stack-cc8c5cd-dev
UPDATE_IN_PROGRESS - AWS::StepFunctions::StateMachine - TestSFN
UPDATE_COMPLETE - AWS::StepFunctions::StateMachine - TestSFN
UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - my-service-stack-cc8c5cd-dev
UPDATE_COMPLETE - AWS::CloudFormation::Stack - my-service-stack-cc8c5cd-dev
Removing old service artifacts from S3
✔ Service deployed to stack my-service-stack-cc8c5cd-dev (17s)
Stack Outputs:
TestSFNArn: arn:aws:states:us-east-1:XXXXXXXXXXXX:stateMachine:my-service-stack-cc8c5cd-dev
ServerlessDeploymentBucketName: my-deployment-bucket-us-east-1
TLDR The Issue
The key point here is that the ARN of the lambda function Resources does not seem to be honoring the modified self:custom.suffix that is being updated by the if-else plugin (see the logs)
What it is: arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:my-other-lambda-name-dev
What it should be: arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:my-other-lambda-name-cc8c5cd-dev
For feature proposals:
What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
This would allow for more control of the names of the resources used in the stack.. in this case - a hashed resource name scheme is to be used for MR branches, hence the hashes (xxxxxx-dev) differentiating them from the final (dev) environment
If there is additional config how would it look
Additional Data
Serverless Framework Core Version you're using:
3.38.0
The Plugin Version you're using:
3.21.0
Operating System:
Ubuntu
Stack Trace:
Above
Provider Error messages:
Above
The text was updated successfully, but these errors were encountered:
This is a (Bug Report / Feature Proposal)
Description
I am unable to leverage plugins that modify variables, like
serverless-plugin-ifelse
For bug reports:
What went wrong?
It appears that the plugin is executing prior to other plugins that may modify the state.. for example I am using
serverless-plugin-ifelse
What did you expect should have happened?
I am expecting any modifications done by this plugin to have changed the variables used for annotating the step function yml
What was the config you used?
This is a child serverless.yml that inherits definitions from above (irrelevant)
TLDR The Issue
The key point here is that the ARN of the lambda function Resources does not seem to be honoring the modified self:custom.suffix that is being updated by the if-else plugin (see the logs)
What it is:
arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:my-other-lambda-name-dev
What it should be:
arn:aws:lambda:us-east-1:XXXXXXXXXXXX:function:my-other-lambda-name-cc8c5cd-dev
For feature proposals:
What is the use case that should be solved. The more detail you describe this in the easier it is to understand for us.
This would allow for more control of the names of the resources used in the stack.. in this case - a hashed resource name scheme is to be used for MR branches, hence the hashes
(xxxxxx-dev)
differentiating them from the final(dev)
environmentIf there is additional config how would it look
Additional Data
Serverless Framework Core Version you're using:
3.38.0
The Plugin Version you're using:
3.21.0
Operating System:
Ubuntu
Stack Trace:
Above
Provider Error messages:
Above
The text was updated successfully, but these errors were encountered: