Skip to content

Commit d12f75f

Browse files
authored
[sdlf-cicd] fix add conditionals on empty custom identifier SSM param (#542)
1 parent d16a670 commit d12f75f

File tree

3 files changed

+23
-20
lines changed

3 files changed

+23
-20
lines changed

sdlf-cicd/template-cicd-domain-roles.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Conditions:
3838
UseCustomBucketPrefix: !Not [!Equals [!Ref pCustomBucketPrefix, sdlf]]
3939
RunInVpc: !Equals [!Ref pEnableVpc, true]
4040
EnableMonitoring: !Equals [!Ref pEnableMonitoring, true]
41+
HasCustomIdentifier: !Not [!Equals [!Ref pCustomIdentifier, ""]]
4142

4243
Resources:
4344
######## OPTIONAL SDLF FEATURES #########
@@ -64,7 +65,7 @@ Resources:
6465
Properties:
6566
Name: /SDLF/CustomIdentifier
6667
Type: String
67-
Value: !Ref pCustomIdentifier
68+
Value: !If [HasCustomIdentifier, !Ref pCustomIdentifier, "FALSE"]
6869
Description: Add a custom identifier to foundational resource names
6970

7071
rDevopsCrossaccountCodePipelineRole:

sdlf-foundations/src/template.yaml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ Parameters:
8383
Conditions:
8484
UseCustomBucketPrefix: !Not [!Equals [!Ref pCustomBucketPrefix, sdlf]]
8585
UseLegacyTables: !Equals [!Ref pLegacyTables, true]
86+
UseCustomSuffix: !Not [!Equals [!Ref pCustomSuffix, "FALSE"]]
8687
RunInVpc: !Equals [!Ref pEnableVpc, true]
8788

8889
Globals:
@@ -315,7 +316,7 @@ Resources:
315316
UpdateReplacePolicy: Retain
316317
DeletionPolicy: RetainExceptOnCreate
317318
Properties:
318-
AliasName: !Sub alias/sdlf-kms-key${pCustomSuffix}
319+
AliasName: !If [UseCustomSuffix, !Sub "alias/sdlf-kms-key${pCustomSuffix}", "alias/sdlf-kms-key"]
319320
TargetKeyId: !Ref rKMSKey
320321

321322
######## SSM #########
@@ -726,7 +727,7 @@ Resources:
726727
DeletionPolicy: Delete
727728
UpdateReplacePolicy: Delete
728729
Properties:
729-
QueueName: !Sub sdlf-catalog-queue${pCustomSuffix}
730+
QueueName: !If [UseCustomSuffix, !Sub "sdlf-catalog-queue${pCustomSuffix}", "sdlf-catalog-queue"]
730731
RedrivePolicy:
731732
deadLetterTargetArn: !GetAtt rDeadLetterQueueCatalog.Arn
732733
maxReceiveCount: 1
@@ -739,7 +740,7 @@ Resources:
739740
DeletionPolicy: Delete
740741
UpdateReplacePolicy: Delete
741742
Properties:
742-
QueueName: !Sub sdlf-catalog-dlq${pCustomSuffix}
743+
QueueName: !If [UseCustomSuffix, !Sub "sdlf-catalog-dlq${pCustomSuffix}", "sdlf-catalog-dlq"]
743744
MessageRetentionPeriod: 1209600
744745
VisibilityTimeout: 60
745746
KmsMasterKeyId: !GetAtt rKMSKey.Arn
@@ -799,7 +800,7 @@ Resources:
799800
Type: AWS::Serverless::Function
800801
Properties:
801802
CodeUri: ./lambda/catalog/src
802-
FunctionName: !Sub sdlf-catalog${pCustomSuffix}
803+
FunctionName: !If [UseCustomSuffix, !Sub "sdlf-catalog${pCustomSuffix}", "sdlf-catalog"]
803804
Environment:
804805
Variables:
805806
ENV: !Ref pEnvironment
@@ -813,7 +814,7 @@ Resources:
813814
Type: AWS::Serverless::Function
814815
Properties:
815816
CodeUri: ./lambda/catalog-redrive/src
816-
FunctionName: !Sub sdlf-catalog-redrive${pCustomSuffix}
817+
FunctionName: !If [UseCustomSuffix, !Sub "sdlf-catalog-redrive${pCustomSuffix}", "sdlf-catalog-redrive"]
817818
Environment:
818819
Variables:
819820
QUEUE: !GetAtt rQueueCatalog.QueueName
@@ -960,7 +961,7 @@ Resources:
960961
- AttributeName: id
961962
KeyType: HASH
962963
BillingMode: PAY_PER_REQUEST
963-
TableName: !Sub octagon-ObjectMetadata-${pEnvironment}${pCustomSuffix}
964+
TableName: !If [UseCustomSuffix, !Sub "octagon-ObjectMetadata-${pEnvironment}${pCustomSuffix}", !Sub "octagon-ObjectMetadata-${pEnvironment}"]
964965
StreamSpecification:
965966
StreamViewType: NEW_AND_OLD_IMAGES
966967
SSESpecification:
@@ -988,7 +989,7 @@ Resources:
988989
- AttributeName: name
989990
AttributeType: S
990991
BillingMode: PAY_PER_REQUEST
991-
TableName: !Sub octagon-Datasets-${pEnvironment}${pCustomSuffix}
992+
TableName: !If [UseCustomSuffix, !Sub "octagon-Datasets-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Datasets-${pEnvironment}"]
992993
SSESpecification:
993994
SSEEnabled: True
994995
SSEType: KMS
@@ -1063,7 +1064,7 @@ Resources:
10631064
KeyType: HASH
10641065
Projection:
10651066
ProjectionType: ALL
1066-
TableName: !Sub octagon-Artifacts-${pEnvironment}${pCustomSuffix}
1067+
TableName: !If [UseCustomSuffix, !Sub "octagon-Artifacts-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Artifacts-${pEnvironment}"]
10671068
TimeToLiveSpecification:
10681069
AttributeName: ttl
10691070
Enabled: true
@@ -1125,7 +1126,7 @@ Resources:
11251126
KeyType: RANGE
11261127
Projection:
11271128
ProjectionType: ALL
1128-
TableName: !Sub octagon-Metrics-${pEnvironment}${pCustomSuffix}
1129+
TableName: !If [UseCustomSuffix, !Sub "octagon-Metrics-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Metrics-${pEnvironment}"]
11291130
TimeToLiveSpecification:
11301131
AttributeName: ttl
11311132
Enabled: true
@@ -1163,7 +1164,7 @@ Resources:
11631164
KeyType: HASH
11641165
Projection:
11651166
ProjectionType: ALL
1166-
TableName: !Sub octagon-Configuration-${pEnvironment}${pCustomSuffix}
1167+
TableName: !If [UseCustomSuffix, !Sub "octagon-Configuration-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Configuration-${pEnvironment}"]
11671168
SSESpecification:
11681169
SSEEnabled: True
11691170
SSEType: KMS
@@ -1189,7 +1190,7 @@ Resources:
11891190
- AttributeName: team
11901191
AttributeType: S
11911192
BillingMode: PAY_PER_REQUEST
1192-
TableName: !Sub octagon-Teams-${pEnvironment}${pCustomSuffix}
1193+
TableName: !If [UseCustomSuffix, !Sub "octagon-Teams-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Teams-${pEnvironment}"]
11931194
SSESpecification:
11941195
SSEEnabled: True
11951196
SSEType: KMS
@@ -1215,7 +1216,7 @@ Resources:
12151216
- AttributeName: name
12161217
AttributeType: S
12171218
BillingMode: PAY_PER_REQUEST
1218-
TableName: !Sub octagon-Pipelines-${pEnvironment}${pCustomSuffix}
1219+
TableName: !If [UseCustomSuffix, !Sub "octagon-Pipelines-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Pipelines-${pEnvironment}"]
12191220
SSESpecification:
12201221
SSEEnabled: True
12211222
SSEType: KMS
@@ -1274,7 +1275,7 @@ Resources:
12741275
KeyType: RANGE
12751276
Projection:
12761277
ProjectionType: ALL
1277-
TableName: !Sub octagon-Events-${pEnvironment}${pCustomSuffix}
1278+
TableName: !If [UseCustomSuffix, !Sub "octagon-Events-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Events-${pEnvironment}"]
12781279
TimeToLiveSpecification:
12791280
AttributeName: ttl
12801281
Enabled: true
@@ -1372,7 +1373,7 @@ Resources:
13721373
KeyType: RANGE
13731374
Projection:
13741375
ProjectionType: ALL
1375-
TableName: !Sub octagon-PipelineExecutionHistory-${pEnvironment}${pCustomSuffix}
1376+
TableName: !If [UseCustomSuffix, !Sub "octagon-PipelineExecutionHistory-${pEnvironment}${pCustomSuffix}", !Sub "octagon-PipelineExecutionHistory-${pEnvironment}"]
13761377
TimeToLiveSpecification:
13771378
AttributeName: ttl
13781379
Enabled: true
@@ -1401,7 +1402,7 @@ Resources:
14011402
- AttributeName: name
14021403
AttributeType: S
14031404
BillingMode: PAY_PER_REQUEST
1404-
TableName: !Sub octagon-DataSchemas-${pEnvironment}${pCustomSuffix}
1405+
TableName: !If [UseCustomSuffix, !Sub "octagon-DataSchemas-${pEnvironment}${pCustomSuffix}", !Sub "octagon-DataSchemas-${pEnvironment}"]
14051406
StreamSpecification:
14061407
StreamViewType: NEW_AND_OLD_IMAGES
14071408
SSESpecification:
@@ -1433,7 +1434,7 @@ Resources:
14331434
- AttributeName: datafile_name
14341435
AttributeType: S
14351436
BillingMode: PAY_PER_REQUEST
1436-
TableName: !Sub octagon-Manifests-${pEnvironment}${pCustomSuffix}
1437+
TableName: !If [UseCustomSuffix, !Sub "octagon-Manifests-${pEnvironment}${pCustomSuffix}", !Sub "octagon-Manifests-${pEnvironment}"]
14371438
TimeToLiveSpecification:
14381439
AttributeName: ttl
14391440
Enabled: true
@@ -1508,7 +1509,7 @@ Resources:
15081509
Type: AWS::Serverless::Function
15091510
Condition: UseLegacyTables
15101511
Properties:
1511-
FunctionName: !Sub sdlf-glue-replication${pCustomSuffix}
1512+
FunctionName: !If [UseCustomSuffix, !Sub "sdlf-glue-replication${pCustomSuffix}", "sdlf-glue-replication"]
15121513
Description: Replicates Glue Catalog Metadata and Data Quality to Octagon Schemas Table
15131514
CodeUri: ./lambda/replicate/src
15141515
Environment:

sdlf-team/src/template.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,7 @@ Conditions:
108108
CicdRoleProvided: !Not [!Equals [!Ref pCicdRole, ""]]
109109
UseLegacyTeam: !Equals [!Ref pLegacyTeam, true]
110110
RunInVpc: !Equals [!Ref pEnableVpc, true]
111+
UseCustomOctagonSuffix: !Not [!Equals [!Ref pCustomOctagonSuffix, "FALSE"]]
111112

112113
Globals:
113114
Function:
@@ -814,7 +815,7 @@ Resources:
814815
Variables:
815816
TEAM_NAME: !Ref pTeamName
816817
ENVIRONMENT: !Ref pEnvironment
817-
CUSTOM_OCTAGON_SUFFIX: !Ref pCustomOctagonSuffix
818+
CUSTOM_OCTAGON_SUFFIX: !If [UseCustomOctagonSuffix, !Ref pCustomOctagonSuffix, ""]
818819
CodeUri: ./lambda/datasets-dynamodb/src
819820

820821
rPermissionForDatasetsEventsToInvokeLambda:
@@ -933,7 +934,7 @@ Resources:
933934
Variables:
934935
TEAM_NAME: !Ref pTeamName
935936
ENVIRONMENT: !Ref pEnvironment
936-
CUSTOM_OCTAGON_SUFFIX: !Ref pCustomOctagonSuffix
937+
CUSTOM_OCTAGON_SUFFIX: !If [UseCustomOctagonSuffix, !Ref pCustomOctagonSuffix, ""]
937938
CodeUri: ./lambda/pipelines-dynamodb/src
938939

939940
rPermissionForPipelinesEventsToInvokeLambda:

0 commit comments

Comments
 (0)