serverless: DeploymentBucket parameters not being replaced
I’ve noticed that when I try and do parameter replacement for the provider.deploymentBucket or provider.deploymentBucket.name property I am getting errors.
I receive these error with and without the serverless-psuedo-parameters plugin.
Configuration: (Same error when nesting name or omitting it or using Fn::Sub)
deploymentBucket:
name: !Sub 'development-team-deployment-bucket-${AWS::AccountId}'
Result:
Configuration warning at 'provider.deploymentBucket.name': should be string
Configuration:
deploymentBucket: ${self:provider.stage}-brandzooka-deployment-bucket-#{AWS::AccountId}
Result:
Configuration warning at 'provider.deploymentBucket': should match pattern "(?!^(\d{1,3}\.){3}\d{1,3}$)(^(([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])\.)*([a-z0-9]|[a-z0-9][a-z0-9-]*[a-z0-9])$)"
Configuration Where ${self:custom.accountId} = ${AWS::AccountId}
deploymentBucket:
name: !Sub ${self:provider.stage}-brandzooka-deployment-bucket-${self:custom.accountId}
Result
This is what wound up in the .serverless/serverless-state.json file which looks like it should work BUT I get a fatal error from serverless Could not locate deployment bucket. Error: str.indexOf is not a function
"deploymentBucket": {
"Fn::Sub": "development-brandzooka-deployment-bucket-${AWS::AccountId}"
},
However this works, so I believe the issue lies in the recent integration of serverless pseudo parameters.
${self:provider.stage}-brandzooka-deployment-bucket-413466xxxxxx
Framework Core: 2.23.0 (local) Plugin: 4.4.2 SDK: 2.3.2 Components: 3.6.2
Command used to run sls deploy --stage development --region us-east-1 --aws-profile me
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 20 (11 by maintainers)
Hello @mcshiz 👋 Thanks a lot for reporting and sorry to hear that you’ve run into trouble with it. At the moment, we’re not supporting
SubfordeploymentBucketas we’re relying on resolved name during the deployment process andSubwill be resolved by CloudFormation. So for this particular case, you’ll need to supply AccountID in some other way.