Skip to content

Commit 3ebe40d

Browse files
Merge pull request #228 from getlift/exported-type-fix
Exported type fix
2 parents 9a5bc53 + 59c7bd0 commit 3ebe40d

File tree

4 files changed

+44
-3
lines changed

4 files changed

+44
-3
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ constructs:
149149

150150
More constructs are coming soon! Got suggestions? [Open and upvote drafts](https://github.com/getlift/lift/discussions/categories/constructs).
151151

152+
## Lift-specific configuration
153+
154+
Lift default behaviors can be override and configured as per your likings using the `lift` property at the root of your `serverless.yml` file. This property is optional as well as all the [configurable options within](docs/configuration.md). Configurations specified at this level affect all constructs defined within the same service file.
155+
152156
## Ejecting
153157

154158
You can eject from Lift at any time: Lift is based on CloudFormation. That allows anyone to kickstart a project with Lift, and fallback to CloudFormation if you ever grow out of it.

docs/configuration.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Lift-specific configuration
2+
3+
This documentation describes all available properties that can specified in the `lift` property at the root of your service file. All options defined here affect all the constructs defined in the same service file
4+
5+
## Automatic permissions
6+
7+
Each construct ships with a pre-defined list of IAM permissions that will be added to the IAM role used by all Lambda functions defined in the same service file and provisionned using the Serverless Framework capabilities. This is to ensure new-comers don't struggle with finding the correct permission sets to interact with the deployed constructs.
8+
9+
For exemple, the [`storage` construct](storage.md) will happen the following permissions to the IAM role provisionned by the Serverless Framework and used by all Lambda functions within the same service file:
10+
11+
- `s3:PutObject`
12+
- `s3:GetObject`
13+
- `s3:DeleteObject`
14+
- `s3:ListBucket`
15+
16+
You can use the `automaticPermissions` options if you want to opt out of this default behavior. This can be especially useful for production environment where you want to provision fined-grained permissions based on your actual usage of the construct - i.e. you may want to only read from the bucket provisionned uisng the `storage` construct.
17+
18+
Here is an exemple `serverless.yml` service file disabling automatic permission for a `storage` construct:
19+
20+
```yaml
21+
service: my-app
22+
provider:
23+
name: aws
24+
25+
lift:
26+
automaticPermissions: false
27+
28+
constructs:
29+
avatars:
30+
type: storage
31+
32+
plugins:
33+
- serverless-lift
34+
```

docs/serverless-types.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Lift TypeScript definitions
1+
# Lift-specific configuration
22

33
While YAML remains the most popular declarative syntax for Serverless service file definition - a.k.a `serverless.yml` - you can also use Javascript/TypeScript definitions - i.e. `serverless.js` and `serverless.ts`. You can find more information on using JS/TS service file in the [Serverless official documentation](https://www.serverless.com/framework/docs/providers/aws/guide/intro#services).
44

@@ -15,6 +15,9 @@ const serverlessConfiguration: AWS & Lift = {
1515
service: 'myService',
1616
frameworkVersion: '2',
1717
plugins: ['serverless-lift'],
18+
lift: {
19+
automaticPermissions: false,
20+
},
1821
constructs: {
1922
avatars: {
2023
type: 'storage',

src/plugin.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,10 @@ class LiftPlugin {
496496
}
497497
}
498498

499-
export type Lift = {
499+
export type Lift = Partial<{
500500
constructs: FromSchema<typeof CONSTRUCTS_DEFINITION>;
501501
lift: FromSchema<typeof LIFT_CONFIG_SCHEMA>;
502-
};
502+
}>;
503503

504504
LiftPlugin.registerProviders(AwsProvider, StripeProvider);
505505

0 commit comments

Comments
 (0)