Skip to content

Commit 14b00ea

Browse files
authored
Merge branch 'main' into AEA-6581-regression-filter-update
2 parents 0ab68d0 + 598db66 commit 14b00ea

9 files changed

Lines changed: 55 additions & 55 deletions

File tree

.github/instructions/languages/sam.instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Environment:
158158
SpinePublicCertificateARN: !ImportValue account-resources:SpinePublicCertificate
159159
# Service search
160160
TargetServiceSearchServer: !Ref TargetServiceSearchServer
161-
ServiceSearchApiKeyARN: !ImportValue account-resources:ServiceSearchApiKey
161+
ServiceSearch3ApiKeyARN: !ImportValue secrets-cdk:Secrets:ServiceSearch3ApiKey:Arn
162162
```
163163

164164
### Logging Configuration

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ It creates the following resources
145145
- SpineASID - used to store the spine ASID
146146
- SpinePartyKey - used to store the spine party key
147147
- SpineCAChain - used to store the spine CA chain
148-
- ServiceSearchApiKey - used to store the service search API key
149148
- JiraToken - used to store token for jira
150149
- ConfluenceToken - used to store token for confluence
151150
- ProxgenPrivateKey - used to store the private key for proxygen

SAMtemplates/lambda_resources_bootstrap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Globals:
1010
MemorySize: 256
1111
Architectures:
1212
- x86_64
13-
Runtime: nodejs20.x
13+
Runtime: nodejs24.x
1414
Environment:
1515
Variables:
1616
NODE_OPTIONS: "--enable-source-maps"

cloudformation/account_resources.yml

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,14 +1547,6 @@ Resources:
15471547
#endregion
15481548

15491549
#region Other Secrets
1550-
ServiceSearchApiKey:
1551-
DependsOn: SecretsKMSKeyKMSKeyAlias
1552-
Type: AWS::SecretsManager::Secret
1553-
Properties:
1554-
Description: API key for service search
1555-
KmsKeyId: alias/SecretsKMSKeyAlias
1556-
SecretString: ChangeMe
1557-
15581550
JiraToken:
15591551
DependsOn: SecretsKMSKeyKMSKeyAlias
15601552
Type: AWS::SecretsManager::Secret
@@ -1833,7 +1825,6 @@ Resources:
18331825
- !Ref SpineASID
18341826
- !Ref SpinePartyKey
18351827
- !Ref SpineCAChain
1836-
- !Ref ServiceSearchApiKey
18371828

18381829
SplunkHECToken:
18391830
DependsOn: SecretsKMSKeyKMSKeyAlias
@@ -2409,12 +2400,6 @@ Outputs:
24092400
#endregion
24102401

24112402
#region Other Secrets Outputs
2412-
ServiceSearchApiKey:
2413-
Description: ServiceSearchApiKey
2414-
Value: !GetAtt ServiceSearchApiKey.Id
2415-
Export:
2416-
Name: !Join [":", [!Ref "AWS::StackName", "ServiceSearchApiKey"]]
2417-
24182403
JiraToken:
24192404
Description: JiraToken
24202405
Value: !GetAtt JiraToken.Id

cloudformation/account_resources_bootstrap.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,14 +374,6 @@ Resources:
374374
#endregion
375375

376376
#region Other Secrets
377-
ServiceSearchApiKey:
378-
DependsOn: SecretsKMSKeyKMSKeyAlias
379-
Type: AWS::SecretsManager::Secret
380-
Properties:
381-
Description: API key for service search
382-
KmsKeyId: alias/SecretsKMSKeyAlias
383-
SecretString: ChangeMe
384-
385377
JiraToken:
386378
DependsOn: SecretsKMSKeyKMSKeyAlias
387379
Type: AWS::SecretsManager::Secret
@@ -471,7 +463,7 @@ Resources:
471463
- !Ref SpineASID
472464
- !Ref SpinePartyKey
473465
- !Ref SpineCAChain
474-
- !Ref ServiceSearchApiKey
466+
- !ImportValue secrets-cdk:Secrets:ServiceSearch3ApiKey:Arn
475467

476468
SplunkHECToken:
477469
DependsOn: SecretsKMSKeyKMSKeyAlias
@@ -746,12 +738,6 @@ Outputs:
746738
#endregion
747739

748740
#region Other Secrets Outputs
749-
ServiceSearchApiKey:
750-
Description: ServiceSearchApiKey
751-
Value: !GetAtt ServiceSearchApiKey.Id
752-
Export:
753-
Name: !Join [":", [!Ref "AWS::StackName", "ServiceSearchApiKey"]]
754-
755741
JiraToken:
756742
Description: JiraToken
757743
Value: !GetAtt JiraToken.Id
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
import {IKey} from "aws-cdk-lib/aws-kms"
3+
import {Construct} from "constructs"
4+
import {StaticSecret} from "../constructs/StaticSecret"
5+
import {Secret} from "aws-cdk-lib/aws-secretsmanager"
6+
7+
export interface ConfigSecretsProps {
8+
readonly stackName: string
9+
readonly configSecretsKmsKey: IKey
10+
}
11+
export class ConfigSecrets extends Construct {
12+
public readonly serviceSearch3ApiKey: Secret
13+
14+
public constructor(scope: Construct, id: string, props: ConfigSecretsProps){
15+
super(scope, id)
16+
const serviceSearch3ApiKey = new StaticSecret(this, "ServiceSearch3ApiKey", {
17+
secretName: `${props.stackName}-ServiceSearch3ApiKey`,
18+
description: "Service Search 3 API Key",
19+
encryptionKey: props.configSecretsKmsKey
20+
})
21+
22+
this.serviceSearch3ApiKey = serviceSearch3ApiKey.secret
23+
}
24+
}

packages/cdk/resources/ExportMigrations.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -652,18 +652,6 @@ const exportValues: { [key: string]: ExportValue } = {
652652
prod:
653653
"alias/SecretsKMSKeyAlias"
654654
},
655-
"account-resources:ServiceSearchApiKey": {
656-
dev:
657-
"arn:aws:secretsmanager:eu-west-2:591291862413:secret:ServiceSearchApiKey-L1Yz7eJVrEIe-R7D494",
658-
ref:
659-
"arn:aws:secretsmanager:eu-west-2:158471595810:secret:ServiceSearchApiKey-0UxJjamgAQYs-t8Eowl",
660-
qa:
661-
"arn:aws:secretsmanager:eu-west-2:394382261442:secret:ServiceSearchApiKey-Zs7o3MVIGRJG-JJMjsE",
662-
int:
663-
"arn:aws:secretsmanager:eu-west-2:399793560585:secret:ServiceSearchApiKey-crcKn9ohTqwR-l1kEkw",
664-
prod:
665-
"arn:aws:secretsmanager:eu-west-2:434629240718:secret:ServiceSearchApiKey-TtpNiKjpPP5t-fhvN92"
666-
},
667655
"account-resources:SNSFeedbackLoggingRoleArn": {
668656
dev:
669657
"arn:aws:iam::591291862413:role/account-resources-SNSFeedbackLoggingRole-JU3IlNDbdZML",

packages/cdk/stacks/SecretsStack.ts

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ import {
55
Tags,
66
CfnOutput
77
} from "aws-cdk-lib"
8+
import {Alias} from "aws-cdk-lib/aws-kms"
89
import {nagSuppressions} from "../nagSuppressions"
910
import {getExportValue} from "../resources/ExportMigrations"
11+
import {ConfigSecrets} from "../resources/ConfigSecrets"
1012

1113
export interface SecretsStackProps extends StackProps {
1214
readonly stackName: string
@@ -25,6 +27,18 @@ export class SecretsStack extends Stack {
2527
// const regressionTestSecrets =
2628
// new RegressionTestSecrets(this, "RegressionTestSecrets", {stackName: props.stackName})
2729

30+
// new, unmigrated secrets
31+
const secretsKmsKey = Alias.fromAliasName(
32+
this,
33+
"SecretsKMSKeyAliasLookup",
34+
getExportValue("account-resources:SecretsKMSKeyAlias", props.environment)
35+
)
36+
37+
const configSecrets = new ConfigSecrets(this, "ConfigSecrets", {
38+
stackName: props.stackName,
39+
configSecretsKmsKey: secretsKmsKey
40+
})
41+
2842
// policy exports
2943
new CfnOutput(this, "AccessSlackSecretsManagedPolicyArn", {
3044
value: getExportValue("account-resources:AccessSlackSecretsManagedPolicy", props.environment),
@@ -222,10 +236,6 @@ export class SecretsStack extends Stack {
222236
value: getExportValue("account-resources:PSUProxygenPublicKey", props.environment),
223237
exportName: `${props.stackName}:Secrets:PSUProxygenPublicKey:Arn`
224238
})
225-
new CfnOutput(this, "ServiceSearchApiKeyArn", {
226-
value: getExportValue("account-resources:ServiceSearchApiKey", props.environment),
227-
exportName: `${props.stackName}:Secrets:ServiceSearchApiKey:Arn`
228-
})
229239
new CfnOutput(this, "SpineASIDArn", {
230240
value: getExportValue("account-resources:SpineASID", props.environment),
231241
exportName: `${props.stackName}:Secrets:SpineASID:Arn`
@@ -339,6 +349,7 @@ export class SecretsStack extends Stack {
339349
value: getExportValue("ci-resources:AllowCloudFormationSecretsAccessManagedPolicy", props.environment),
340350
exportName: `${props.stackName}:Secrets:AllowCloudFormationSecretsAccessManagedPolicy:Arn`
341351
})
352+
342353
new CfnOutput(this, "JiraTokenArn", {
343354
value: getExportValue("account-resources:JiraToken", props.environment),
344355
exportName: `${props.stackName}:Secrets:JiraToken:Arn`
@@ -347,6 +358,12 @@ export class SecretsStack extends Stack {
347358
value: getExportValue("account-resources:ConfluenceToken", props.environment),
348359
exportName: `${props.stackName}:Secrets:ConfluenceToken:Arn`
349360
})
361+
362+
new CfnOutput(this, "ServiceSearch3ApiKeyArn", {
363+
value: configSecrets.serviceSearch3ApiKey.secretArn,
364+
exportName: `${props.stackName}:Secrets:ServiceSearch3ApiKey:Arn`
365+
})
366+
350367
nagSuppressions(this, "Secrets")
351368
}
352369
}

scripts/set_aws_secrets.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,6 @@ def get_secret_arns_and_local_values(all_exports: list, environment: str) -> lis
110110
"required": True,
111111
"local_value": read_local_secret(f"{environment}/eps_signing_cert_chain")
112112
},
113-
{
114-
"variable_name": "service_search_api_key",
115-
"export_name": "account-resources:ServiceSearchApiKey",
116-
"required": True,
117-
"local_value": os.environ.get(f"{environment}_service_search_api_key")
118-
},
119113
{
120114
"variable_name": "PSU_proxygen_private_key",
121115
"export_name": "account-resources:PSUProxygenPrivateKey",
@@ -188,6 +182,13 @@ def get_secret_arns_and_local_values(all_exports: list, environment: str) -> lis
188182
"required": True,
189183
"local_value": read_local_secret(f"{environment}/ptl_prescription_signing_private_key")
190184
},
185+
# new, cdk managed secrets
186+
{
187+
"variable_name": "service_search_api_key",
188+
"export_name": "secrets-cdk:Secrets:ServiceSearch3ApiKey:Arn",
189+
"required": True,
190+
"local_value": os.environ.get(f"{environment}_service_search_api_key")
191+
},
191192
]
192193

193194
secret_arns = []

0 commit comments

Comments
 (0)