fauna-labs / serverless-fauna

MIT No Attribution
18 stars 3 forks source link

unrecognized property 'deletion_policy' #61

Closed jrr closed 1 year ago

jrr commented 1 year ago

It looks like deletion_policy on collections isn't recognized as valid configuration:

Warning: Invalid configuration encountered
  at 'fauna.collections.logs': unrecognized property 'deletion_policy'

Learn more about configuration validation here: http://slss.io/configuration-validation
Fauna: FQL v4 schema update in progress...
Fauna: collection `logs` was updated

1 deprecation found: run 'serverless doctor' for more details

This happens with yml based on the readme:

service: foo
provider:
  name: aws
  runtime: nodejs18.x

plugins:
  - "@fauna-labs/serverless-fauna"

fauna:
  deletion_policy: retain
  client:
    secret: ${env:FAUNA_ADMIN_KEY}
    port: ${env:FAUNADB_PORT}
    domain: ${env:FAUNADB_DOMAIN}
    scheme: ${env:FAUNADB_SCHEME}
  collections:
    Movies:
      name: Movies
    logs:
      name: logs
      deletion_policy: destroy

With the latest serverless and serverless-fauna:

> yarn why serverless
└─ foo@workspace:.
   └─ serverless@npm:3.32.2 (via npm:3.32.2)
> yarn why @fauna-labs/serverless-fauna
└─ foo@workspace:.
   └─ @fauna-labs/serverless-fauna@npm:0.4.0 [11f9b] (via npm:^0.4.0 [11f9b])
pnwpedro commented 1 year ago

Looks like the readme syntax is incorrect. Thanks for reporting!

You can specify the deletion policy on a resource like so:

  collections:
    Movies:
      name: Movies
    logs:
      name: logs
      data:
        deletion_policy: destroy

I do think it'd be nice to declare it on the top level of the resource config, though. It would feel more like a first-class feature. For now, though, we'll update the readme example. https://github.com/fauna-labs/serverless-fauna/pull/62

Thanks again!