@@ -208,6 +208,8 @@ Resources:
208208 ParameterValue : !Ref NameSuffix
209209 - ParameterKey : ScanningAccountID
210210 ParameterValue : !Ref ScanningAccountID
211+ - ParameterKey : ScanningRoleArn
212+ ParameterValue : !GetAtt ScanningRole.Arn
211213 StackInstancesGroup :
212214 - DeploymentTargets :
213215 Accounts :
@@ -226,6 +228,9 @@ Resources:
226228 ScanningAccountID:
227229 Type: String
228230 Description: The AWS Account ID of the Sysdig Scanning Account
231+ ScanningRoleArn:
232+ Type: String
233+ Description: The ARN of the install scanning role
229234 Resources:
230235 ScanningKmsKey:
231236 Type: 'AWS::KMS::Key'
@@ -241,7 +246,7 @@ Resources:
241246 Principal:
242247 AWS:
243248 - !Sub arn:aws:iam::${ScanningAccountID}:root
244- - !Sub arn:aws:iam::${AWS::AccountId}:role/sysdig-secure-scanning-${NameSuffix}
249+ - !Ref ScanningRoleArn
245250 Action:
246251 - "kms:Encrypt"
247252 - "kms:Decrypt"
@@ -264,12 +269,12 @@ Resources:
264269 Properties:
265270 AliasName: !Sub alias/sysdig-secure-scanning-${NameSuffix}
266271 TargetKeyId: !Ref ScanningKmsKey
267- OrganizationRoleStackSet :
272+ OrganizationKMSKeyStackSet :
268273 Type : AWS::CloudFormation::StackSet
269274 Condition : IsOrganizational
270275 Properties :
271- StackSetName : !Sub sysdig-secure-scanning-organization-roles -${NameSuffix}
272- Description : IAM Role used to create IAM roles scan organization accounts/regions
276+ StackSetName : !Sub sysdig-secure-scanning-organization-kmskey -${NameSuffix}
277+ Description : Create one role, and a kms key in each instrumented region, within accounts under instumented organizational units
273278 PermissionModel : SERVICE_MANAGED
274279 Capabilities :
275280 - " CAPABILITY_NAMED_IAM"
@@ -282,6 +287,8 @@ Resources:
282287 MaxConcurrentPercentage : 100
283288 FailureTolerancePercentage : 90
284289 ConcurrencyMode : SOFT_FAILURE_TOLERANCE
290+ RegionConcurrencyType : SEQUENTIAL
291+ RegionOrder : !Ref Regions
285292 Parameters :
286293 - ParameterKey : NameSuffix
287294 ParameterValue : !Ref NameSuffix
@@ -291,32 +298,43 @@ Resources:
291298 ParameterValue : !Ref TrustedIdentity
292299 - ParameterKey : ExternalID
293300 ParameterValue : !Ref ExternalID
301+ - ParameterKey : Regions
302+ ParameterValue : !Join [ ',', !Ref Regions ]
294303 StackInstancesGroup :
295304 - DeploymentTargets :
296305 OrganizationalUnitIds : !Ref OrganizationalUnitIDs
297- Regions : [ !Ref "AWS::Region"]
306+ Regions : !Ref Regions
298307 TemplateBody : |
299308 AWSTemplateFormatVersion: "2010-09-09"
300- Description: IAM Role used by Sysdig Secure Vulnerability Scanning
301- Parameters:
309+ Description: "Template to create KMS Key and Alias for Sysdig Agentless Scanning"
310+ Parameters:
302311 NameSuffix:
303312 Type: String
304313 Description: Suffix to append to the resource name identifiers
305314 AllowedPattern: '[0-9a-z]+'
306315 MaxLength: 8
307316 MinLength: 4
317+ ScanningAccountID:
318+ Type: String
319+ Description: The AWS Account ID of the Sysdig Scanning Account
308320 ExternalID:
309321 Type: String
310322 Description: Sysdig assigned token that proves you own this account
311323 TrustedIdentity:
312324 Type: String
313325 Description: The Role in Sysdig's AWS Account with permissions to your account
314- ScanningAccountID:
315- Type: String
316- Description: The AWS Account ID of the Sysdig Scanning Account
326+ Regions:
327+ Type: CommaDelimitedList
328+ Description: Comma separated list of regions enabled for Sysdig Scanning
329+ Conditions:
330+ GlobalRegion:
331+ Fn::Equals:
332+ - !Ref "AWS::Region"
333+ - !Select [ "0", !Ref Regions ]
317334 Resources:
318335 ScanningRole:
319336 Type: AWS::IAM::Role
337+ Condition: GlobalRegion
320338 Properties:
321339 RoleName: !Sub sysdig-secure-scanning-${NameSuffix}
322340 AssumeRolePolicyDocument:
@@ -396,52 +414,22 @@ Resources:
396414 Condition:
397415 StringEqualsIgnoreCase:
398416 "aws:ResourceTag/CreatedBy": "Sysdig"
399- OrganizationKMSKeyStackSet :
400- Type : AWS::CloudFormation::StackSet
401- Condition : IsOrganizational
402- DependsOn :
403- - OrganizationRoleStackSet
404- Properties :
405- StackSetName : !Sub sysdig-secure-scanning-organization-kmskey-${NameSuffix}
406- Description : IAM Role used to create KMS Keys to scan organization accounts/regions
407- PermissionModel : SERVICE_MANAGED
408- Capabilities :
409- - " CAPABILITY_NAMED_IAM"
410- AutoDeployment :
411- Enabled : true
412- RetainStacksOnAccountRemoval : false
413- ManagedExecution :
414- Active : true
415- OperationPreferences :
416- MaxConcurrentPercentage : 100
417- FailureTolerancePercentage : 90
418- ConcurrencyMode : SOFT_FAILURE_TOLERANCE
419- RegionConcurrencyType : PARALLEL
420- Parameters :
421- - ParameterKey : NameSuffix
422- ParameterValue : !Ref NameSuffix
423- - ParameterKey : ScanningAccountID
424- ParameterValue : !Ref ScanningAccountID
425- StackInstancesGroup :
426- - DeploymentTargets :
427- OrganizationalUnitIds : !Ref OrganizationalUnitIDs
428- Regions : !Ref Regions
429- TemplateBody : |
430- AWSTemplateFormatVersion: "2010-09-09"
431- Description: "Template to create KMS Key and Alias for Sysdig Agentless Scanning"
432- Parameters:
433- NameSuffix:
434- Type: String
435- Description: Suffix to append to the resource name identifiers
436- AllowedPattern: '[0-9a-z]+'
437- MaxLength: 8
438- MinLength: 4
439- ScanningAccountID:
440- Type: String
441- Description: The AWS Account ID of the Sysdig Scanning Account
442- Resources:
417+
418+ GlobalRegionWaitHandle:
419+ Condition: GlobalRegion
420+ DependsOn: ScanningRole
421+ Type: AWS::CloudFormation::WaitConditionHandle
422+ RegionWaitHandle:
423+ Type: AWS::CloudFormation::WaitConditionHandle
424+ RegionalWaitCondition:
425+ Type: AWS::CloudFormation::WaitCondition
426+ Properties:
427+ Handle: !If [ GlobalRegion, !Ref GlobalRegionWaitHandle, !Ref RegionWaitHandle ]
428+ Timeout: 1
429+ Count: 0
443430 ScanningKmsKey:
444431 Type: 'AWS::KMS::Key'
432+ DependsOn: RegionalWaitCondition
445433 Properties:
446434 Description: "Sysdig Agentless Scanning encryption key"
447435 PendingWindowInDays: 7
0 commit comments