Skip to content

Commit 648438b

Browse files
committed
OJ-3625: Add OAuthCommon but not use yet
We need to add OAuthCommon and the suppport OAuthCommon SSM parameters to ready us migrating from common-lambdas. This will ensure the tables exist, and the table names and CMK ID can be retrieved by common-lambdas so we can then enable the stream. Note: The SSM parameters have hardcoded paths so they can only be deployed once per account, hence the IsNotLocalDevEnvironment condition.
1 parent 40a1f39 commit 648438b

3 files changed

Lines changed: 70 additions & 3 deletions

File tree

.github/workflows/deploy-branch.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ jobs:
2424
uses: aws-actions/setup-sam@d78e1a4a9656d3b223e59b80676a797f20093133
2525

2626
- name: Build SAM application
27-
uses: govuk-one-login/github-actions/sam/build-application@e6b6ed890b35904e1be79f7f35ffec983fa4d9db
27+
uses: govuk-one-login/github-actions/sam/build-application@4c76410195b5fcb1804fc7c183ed20704252830f
2828
id: build
2929
with:
3030
template: infrastructure/template.yaml
3131
cache-name: check-hmrc-api
3232
pull-repository: true
3333
source-dir: lambdas
34+
aws-role-arn: ${{ vars.DEPLOYMENT_ROLE_ARN }}
3435

3536
deploy:
3637
name: Deploy stack
@@ -50,7 +51,7 @@ jobs:
5051
stack-name: ${{ steps.deploy.outputs.stack-name }}
5152
steps:
5253
- name: Deploy stack
53-
uses: govuk-one-login/github-actions/sam/deploy-stack@e6b6ed890b35904e1be79f7f35ffec983fa4d9db
54+
uses: govuk-one-login/github-actions/sam/deploy-stack@4c76410195b5fcb1804fc7c183ed20704252830f
5455
id: deploy
5556
with:
5657
sam-deployment-bucket: ${{ vars.DEPLOYMENT_ARTIFACTS_BUCKET }}

deploy.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ sam deploy --stack-name "$stack_name" \
2323
--resolve-s3 \
2424
--s3-prefix "$stack_name" \
2525
--region "${AWS_REGION:-eu-west-2}" \
26-
--capabilities CAPABILITY_IAM \
26+
--capabilities CAPABILITY_IAM CAPABILITY_AUTO_EXPAND \
2727
--tags \
2828
cri:component=ipv-cri-check-hmrc-api \
2929
cri:stack-type=localdev \

infrastructure/template.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ Conditions:
5050
UsePermissionsBoundary: !Not [!Equals [!Ref PermissionsBoundary, ""]]
5151
IsDevEnvironment: !Equals [!Ref Environment, dev]
5252
IsLocalDevEnvironment: !Equals [!Ref Environment, localdev]
53+
IsNotLocalDevEnvironment: !Not
54+
- !Condition IsLocalDevEnvironment
5355
IsIntEnvironment: !Equals [!Ref Environment, integration]
5456
IsProdEnvironment: !Equals [!Ref Environment, production]
5557
IsDevLikeEnvironment: !Or [!Condition IsLocalDevEnvironment, !Condition IsDevEnvironment]
@@ -128,21 +130,33 @@ Mappings:
128130
EnvironmentConfiguration:
129131
localdev:
130132
DOMAINNAME: review-hc.localdev.account.gov.uk
133+
VcDomain: review-hc.dev.account.gov.uk
134+
ServiceDomain: review-hc.localdev.account.gov.uk
131135
HealthcheckSSMClientId: ipv-core-stub-aws-prod
132136
dev:
133137
DOMAINNAME: review-hc.dev.account.gov.uk
138+
VcDomain: review-hc.dev.account.gov.uk
139+
ServiceDomain: review-hc.dev.account.gov.uk
134140
HealthcheckSSMClientId: ipv-core-stub-aws-prod
135141
build:
136142
DOMAINNAME: review-hc.build.account.gov.uk
143+
VcDomain: review-hc.build.account.gov.uk
144+
ServiceDomain: review-hc.build.account.gov.uk
137145
HealthcheckSSMClientId: ipv-core-stub-aws-prod
138146
staging:
139147
DOMAINNAME: review-hc.staging.account.gov.uk
148+
VcDomain: review-hc.staging.account.gov.uk
149+
ServiceDomain: review-hc.staging.account.gov.uk
140150
HealthcheckSSMClientId: ipv-core-stub-aws-prod
141151
integration:
142152
DOMAINNAME: review-hc.integration.account.gov.uk
153+
VcDomain: review-hc.integration.account.gov.uk
154+
ServiceDomain: review-hc.integration.account.gov.uk
143155
HealthcheckSSMClientId: ipv-core
144156
production:
145157
DOMAINNAME: review-hc.production.account.gov.uk
158+
VcDomain: review-hc.production.account.gov.uk
159+
ServiceDomain: review-hc.production.account.gov.uk
146160
HealthcheckSSMClientId: ipv-core
147161

148162
Globals:
@@ -192,6 +206,31 @@ Globals:
192206
- !Ref AWS::NoValue
193207

194208
Resources:
209+
OAuth:
210+
Type: AWS::Serverless::Application
211+
Properties:
212+
Location:
213+
ApplicationId: arn:aws:serverlessrepo:eu-west-2:667736788427:applications/di-ipv-cri-oauth-common
214+
SemanticVersion: 0.4.0
215+
Parameters:
216+
AuditEventNamePrefix: IPV_HMRC_RECORD_CHECK_CRI
217+
CriIdentifier: di-ipv-cri-check-hmrc-api
218+
CriAudience: !Sub
219+
- "https://${domain}"
220+
- domain: !FindInMap [EnvironmentConfiguration, !Ref Environment, VcDomain]
221+
CriVcIssuer: !Sub
222+
- "https://${domain}"
223+
- domain: !FindInMap [EnvironmentConfiguration, !Ref Environment, VcDomain]
224+
CriPrivateApiGwName: !Sub ${AWS::StackName}-private
225+
CriPublicApiGwName: !Sub ${AWS::StackName}-public
226+
Environment: !If
227+
- IsLocalDevEnvironment
228+
- dev
229+
- !Ref Environment
230+
IPVCoreRedirectURI: https://identity.staging.account.gov.uk/credential-issuer/callback?id=nino
231+
IPVCoreStubJwksEndpoint: https://test-resources.review-hc.dev.account.gov.uk/.well-known/jwks.json
232+
LambdaVpcConfiguration: di-devplatform-deploy
233+
195234
JWKSBucketRole:
196235
Type: "AWS::IAM::Role"
197236
Properties:
@@ -1535,6 +1574,33 @@ Resources:
15351574
Value: !Ref CommonStackName
15361575
Description: The stack currently used for OAuth (common-lambdas or oauth-common). Only required for test-resources.
15371576

1577+
OAuthSessionTableName:
1578+
Type: AWS::SSM::Parameter
1579+
Condition: IsNotLocalDevEnvironment
1580+
Properties:
1581+
Name: !Sub "/common-cri/oauth-common/OAuthSessionTableName"
1582+
Value: !GetAtt OAuth.Outputs.DbSessionTableName
1583+
Type: String
1584+
Description: The OAuthSessionTableName for configuring the DynamoDB Stream table from common-lambdas
1585+
1586+
OAuthPersonIdentityTableName:
1587+
Type: AWS::SSM::Parameter
1588+
Condition: IsNotLocalDevEnvironment
1589+
Properties:
1590+
Name: !Sub "/common-cri/oauth-common/OAuthPersonIdentityTableName"
1591+
Value: !GetAtt OAuth.Outputs.DbPersonIdentityTableName
1592+
Type: String
1593+
Description: The OAuthPersonIdentityTableName for configuring the DynamoDB Stream table from common-lambdas
1594+
1595+
OAuthCustomerManagedKeyId:
1596+
Type: AWS::SSM::Parameter
1597+
Condition: IsNotLocalDevEnvironment
1598+
Properties:
1599+
Name: !Sub "/common-cri/oauth-common/OAuthCustomerManagedKeyId"
1600+
Value: !GetAtt OAuth.Outputs.DbCustomerManagedKeyID
1601+
Type: String
1602+
Description: The OAuthCustomerManagedKeyId for configuring the DynamoDB Stream table from common-lambdas
1603+
15381604

15391605
##################################################################
15401606
# #

0 commit comments

Comments
 (0)