Hello,
I have the following serverless.yml file.
service: s3-playground
resources:
Resources:
EshotBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}
LifecycleConfiguration:
Rules:
- Id: "Delayed csv expiration"
Status: "Enabled"
TagFilters:
- Key: "deleted-csv"
Value: "true"
ExpirationInDays: 1
EshotBucketLambdaPermission:
Type: "AWS::Lambda::Permission"
Properties:
FunctionName:
"Fn::GetAtt":
- s3-playground-${opt:stage}-status
- Arn
Principal: "s3.amazonaws.com"
Action: "lambda:InvokeFunction"
SourceAccount:
Ref: AWS::AccountId
SourceArn: "arn:aws:s3:::${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}"
EshotBucketPolicy:
Type: AWS::S3::BucketPolicy
Properties:
Bucket: ${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}
PolicyDocument:
Statement:
- Action:
- s3:putObject
Effect: "Allow"
Principal:
"AWS":
- "arn:aws:iam::#{AWS::AccountId}:root"
Resource:
- "arn:aws:s3:::${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}/*.xls"
- "arn:aws:s3:::${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}/*.csv"
- "arn:aws:s3:::${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}/*.tsv"
- "arn:aws:s3:::${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}/*.xlsx"
package:
exclude:
- ./**
include:
- ./status
provider:
name: aws
runtime: go1.x
iamRoleStatements:
- Effect: Allow
Action:
- s3:getObject
- s3:putObject
- s3:putBucketPolicy
- states:startExecution
Resource: "*"
stage: ${opt:stage}
region: ${file(./config.yml):${opt:stage}.REGION}
environment:
UPLOADS_BUCKET: ${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}
functions:
status:
handler: status
memorySize: 128
events:
- s3:
bucket: ${file(./config.yml):${opt:stage}.UPLOADS_BUCKET}
event: s3:ObjectCreated:*
timeout: 60
environment:
REGION: ${file(./config.yml):${opt:stage}.REGION}
what is the correct way to attach the status
to the resource bucket?
I get this error:
Serverless: Validating template...
Error --------------------------------------------------
The CloudFormation template is invalid: Template error: instance of Fn::GetAtt references undefined resource s3-playground-prod-status
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: linux
Node Version: 9.11.1
Serverless Version: 1.30.0
Makefile:18: recipe for target 'deploy' failed
make: *** [deploy] Error 1
https://github.com/serverless/serverless/issues/3034 - looks that the issue is still open