Skip to content

Commit

Permalink
Revert serverless changes back
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed May 10, 2024
1 parent aaf3a63 commit 42babd2
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 49 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ jobs:
run: npx sls package
env:
SLS_DEBUG: '*'
AWS_ACCESS_KEY_ID:
AWS_SECRET_ACCESS_KEY:
test_worker:
runs-on: ubuntu-latest
timeout-minutes: 20
Expand Down
84 changes: 39 additions & 45 deletions backend/env.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
---
dev:
DUMMY:
RESOURCE_POLICY:
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*
ENDPOINT_TYPE: REGIONAL
VPC_ENDPOINT: dummy


staging:
REGION: us-east-1
ENDPOINT_TYPE: REGIONAL
RESOURCE_POLICY:
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*
COGNITO_URL: https://cognito-idp.us-east-1.amazonaws.com
BACKEND_DOMAIN: https://api.staging-cd.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-east-1
Expand Down Expand Up @@ -68,6 +77,11 @@ staging:
prod:
REGION: us-east-1
ENDPOINT_TYPE: REGIONAL
RESOURCE_POLICY:
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*
COGNITO_URL: https://cognito-idp.us-east-1.amazonaws.com
BACKEND_DOMAIN: https://api.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-east-1
Expand Down Expand Up @@ -120,6 +134,18 @@ prod:
staging-lz:
REGION: us-gov-east-1
ENDPOINT_TYPE: PRIVATE
RESOURCE_POLICY:
- Effect: Deny
Principal: '*'
Action: 'execute-api:Invoke'
Resource: 'execute-api:/${self:provider.stage}/*/*'
Condition:
StringNotEquals:
'aws:sourceVpce': ${file(env.yml):${self:provider.stage}.VPC_ENDPOINT, ''}
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*
COGNITO_URL: https://cognito-idp.us-gov-west-1.amazonaws.com
BACKEND_DOMAIN: https://api.staging.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-gov-west-1
Expand Down Expand Up @@ -179,6 +205,18 @@ staging-lz:
prod-lz:
REGION: us-gov-east-1
ENDPOINT_TYPE: PRIVATE
RESOURCE_POLICY:
- Effect: Deny
Principal: '*'
Action: 'execute-api:Invoke'
Resource: 'execute-api:/${self:provider.stage}/*/*'
Condition:
StringNotEquals:
'aws:sourceVpce': ${file(env.yml):${self:provider.stage}.VPC_ENDPOINT, ''}
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*
COGNITO_URL: https://cognito-idp.us-gov-west-1.amazonaws.com
BACKEND_DOMAIN: https://api.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-gov-west-1
Expand Down Expand Up @@ -266,47 +304,3 @@ prod-lz-vpc:
staging-ecs-cluster: ${ssm:/crossfeed/staging/WORKER_CLUSTER_ARN}

prod-ecs-cluster: ${ssm:/crossfeed/prod/WORKER_CLUSTER_ARN}

dev-rp:
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/dev/*/*

staging-rp:
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*

prod-rp:
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*

staging-lz-rp:
- Effect: Deny
Principal: '*'
Action: 'execute-api:Invoke'
Resource: 'execute-api:/${self:provider.stage}/*/*'
Condition:
StringNotEquals:
'aws:sourceVpce': ${file(env.yml):${self:provider.stage}.VPC_ENDPOINT, ''}
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*

prod-lz-rp:
- Effect: Deny
Principal: '*'
Action: 'execute-api:Invoke'
Resource: 'execute-api:/${self:provider.stage}/*/*'
Condition:
StringNotEquals:
'aws:sourceVpce': ${file(env.yml):${self:provider.stage}.VPC_ENDPOINT, ''}
- Effect: Allow
Principal: '*'
Action: execute-api:Invoke
Resource: execute-api:/${self:provider.stage}/*/*
4 changes: 2 additions & 2 deletions backend/serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ provider:
timeout: 30
stage: ${opt:stage, 'dev'}
environment: ${file(env.yml):${self:provider.stage}, ''}
vpc: ${file(env.yml):${self:provider.stage}, ''}
vpc: ${file(env.yml):${self:provider.stage}-vpc, ''}
vpcEndpointIds:
- ${file(env.yml):${self:provider.stage}.VPC_ENDPOINT, ''}
apiGateway:
binaryMediaTypes:
- image/*
- font/*
resourcePolicy: ${file(env.yml):${self:provider.stage}-rp, ''}
resourcePolicy: ${file(env.yml):${self:provider.stage}.RESOURCE_POLICY, ''}
logs:
restApi: true
deploymentBucket:
Expand Down

0 comments on commit 42babd2

Please sign in to comment.