Skip to content

Commit 13c3532

Browse files
authored
refactor: cloud-connector config depends on ecs o ecr deploy (#56)
1 parent 4c90e1d commit 13c3532

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

templates/CloudConnector.yaml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,26 @@ Parameters:
4343
- "No"
4444
Default: "Yes"
4545
Description: Whether to deploy cloud scanning or not
46+
ECRImageScanningDeploy:
47+
Type: String
48+
AllowedValues:
49+
- "Yes"
50+
- "No"
51+
Default: "Yes"
52+
Description: Whether to deploy ECR Image Scanning or not
53+
ECSImageScanningDeploy:
54+
Type: String
55+
AllowedValues:
56+
- "Yes"
57+
- "No"
58+
Default: "Yes"
59+
Description: Whether to deploy ECS Image Scanning or not
4660

4761
Conditions:
4862
VerifySSL: !Equals [ !Ref VerifySSL, "Yes" ]
4963
DeployCloudScanning: !Equals [ !Ref DeployCloudScanning, "Yes"]
64+
ECRImageScanningDeploy: !Equals [ !Ref ECRImageScanningDeploy, "Yes"]
65+
ECSImageScanningDeploy: !Equals [ !Ref ECSImageScanningDeploy, "Yes"]
5066

5167
Resources:
5268

@@ -231,15 +247,31 @@ Resources:
231247
Scanners:
232248
'Fn::If':
233249
- DeployCloudScanning
234-
- !Sub |
250+
- !Sub
251+
- |
235252
236-
- aws-ecr:
237-
codeBuildProject: ${BuildProject}
238-
secureAPITokenSecretName: ${SysdigSecureAPITokenSsm}
239-
- aws-ecs:
240-
codeBuildProject: ${BuildProject}
241-
secureAPITokenSecretName: ${SysdigSecureAPITokenSsm}
253+
${ECRCode}
254+
${ECSCode}
255+
- ECRCode:
256+
'Fn::If':
257+
- ECRImageScanningDeploy
258+
- !Sub |
259+
260+
- aws-ecr:
261+
codeBuildProject: ${BuildProject}
262+
secureAPITokenSecretName: ${SysdigSecureAPITokenSsm}
263+
- ""
264+
ECSCode:
265+
'Fn::If':
266+
- ECSImageScanningDeploy
267+
- !Sub |
268+
269+
- aws-ecs:
270+
codeBuildProject: ${BuildProject}
271+
secureAPITokenSecretName: ${SysdigSecureAPITokenSsm}
272+
- ""
242273
- "[]"
274+
243275
Secrets:
244276
- Name: SECURE_URL
245277
ValueFrom: !Sub arn:${AWS::Partition}:ssm:${AWS::Region}:${AWS::AccountId}:parameter/${SysdigSecureEndpointSsm}

templates/CloudVision.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ Conditions:
126126
DeployCloudScanning: !Or
127127
- !Equals [!Ref ECRImageScanningDeploy, "Yes"]
128128
- !Equals [!Ref ECSImageScanningDeploy, "Yes"]
129+
ECRImageScanningDeploy: !Equals [ !Ref ECRImageScanningDeploy, "Yes"]
130+
ECSImageScanningDeploy: !Equals [ !Ref ECSImageScanningDeploy, "Yes"]
129131
DeployCloudTrail: !And
130132
- !Condition RequiresCloudTrail
131133
- !Or
@@ -218,6 +220,8 @@ Resources:
218220
BuildProject: !If [ DeployCloudScanning, !GetAtt [ "ScanningCodeBuildStack", "Outputs.BuildProject" ], ""]
219221
CloudTrailTopic: !If [ DeployCloudTrail, !GetAtt ["CloudTrailStack", "Outputs.Topic"], !Ref ExistentCloudTrailSNSTopic ]
220222
DeployCloudScanning: !If [ DeployCloudScanning, "Yes", "No" ]
223+
ECRImageScanningDeploy: !If [ ECRImageScanningDeploy, "Yes", "No"]
224+
ECSImageScanningDeploy: !If [ ECSImageScanningDeploy, "Yes", "No"]
221225

222226
CloudAgentlessRole:
223227
Type: AWS::CloudFormation::Stack

templates/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ S3_BUCKET ?= "s4c-cft"
22
S3_PREFIX ?= "test"
33
# We need the REGION or the TemplateURLs might be created for a different region, resulting in a deployment error
44
S3_REGION ?= "eu-west-1"
5-
SECURE_API_TOKEN="2732cad7-edee-4e23-aaea-a6671ceef7af"
5+
SECURE_API_TOKEN=""
66

77
.PHONY: packaged-template.yaml
88

0 commit comments

Comments
 (0)