Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions packages/deploy-aws/src/seagull_stack.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { App, Secret, SecretParameter, Stack, StackProps } from '@aws-cdk/cdk'
import { App, RemovalPolicy, SecretParameter, Stack, StackProps } from '@aws-cdk/cdk'

import { LambdaIntegration, RestApi } from '@aws-cdk/aws-apigateway'
import * as CM from '@aws-cdk/aws-certificatemanager'
Expand Down Expand Up @@ -39,8 +39,8 @@ export class SeagullStack extends Stack {
return new LogGroup(this, `${this.id}-${logGroupName}`, props)
}

addS3(bucketName: string, role?: IAM.IPrincipal) {
const s3Props = { bucketName }
addS3(bucketName: string, role?: IAM.IPrincipal, removalPolicy?: RemovalPolicy) {
const s3Props = { bucketName, removalPolicy }
const bucket = new S3.Bucket(this, `${this.id}-${bucketName}`, s3Props)
// tslint:disable-next-line:no-unused-expression
role && bucket.grantReadWrite(role)
Expand Down
2 changes: 1 addition & 1 deletion packages/deploy-aws/src/templates/seagull_pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class SeagullPipeline {
]
}

async createPipeline() {
async createPipeline(): Promise<SeagullApp> {
setCredsByProfile(this.profile)
// preparations for deployment
const isTest = this.stage === 'test'
Expand Down
3 changes: 2 additions & 1 deletion packages/deploy-aws/src/templates/seagull_project.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { RemovalPolicy } from '@aws-cdk/cdk'
import { FS } from '@seagull/commands-fs'
import { SDK } from 'aws-cdk'
import * as dotenv from 'dotenv'
Expand Down Expand Up @@ -87,7 +88,7 @@ export class SeagullProject {
const role = app.stack.addIAMRole('role', 'lambda.amazonaws.com', actions)
app.role = role
const env = await getEnv(name, this.appPath, this.stage, logBucketName)
const logBucket = app.stack.addS3(logBucketName, role)
const logBucket = app.stack.addS3(logBucketName, role, RemovalPolicy.Destroy)
const lambda = app.stack.addLambda('lambda', this.appPath, role, env)
const apiGW = app.stack.addUniversalApiGateway('apiGW', lambda, this.stage)
const cloudfrontConfig = { aliasConfig, apiGateway: apiGW, logBucket }
Expand Down