constructor()

in lib/cdk-devopsguru-multi-acc-reg-spec-stack.ts [13:68]


  constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);    

    const admin_account_id = new cdk.CfnParameter(this, 'AdministratorAccountId',{
      description : 'Administrator Account Id',
    });

    const target_account_id = new cdk.CfnParameter(this, 'TargetAccountId',{
      description : 'Target Account Id',
    });

    const region_id = new cdk.CfnParameter(this, 'RegionIds',{
      type: 'List<String>',
      description : 'Region Ids to deploy StackSet',
    });

    new stackset.CfnStackSet(this, 'DevopsGuruStackSetSpecStacks', {
      permissionModel : 'SELF_MANAGED',
      stackSetName : 'EnableDevOpsGuruStackSetMultiAccRegSpecSacks',
      description : 'CDK Stack Instance to Enable DevOpsGuru for Specific Stacks',
      stackInstancesGroup: [
      {
        deploymentTargets: {
        accounts : [admin_account_id.valueAsString,target_account_id.valueAsString],
        },
        regions: region_id.valueAsList,
      }],
      operationPreferences: {
        failureToleranceCount: 0,
        maxConcurrentCount: 1
      },
      templateBody: `
        Resources:
          DevOpsGuruMonitoring:
            Type: AWS::DevOpsGuru::ResourceCollection
            Properties:
              ResourceCollectionFilter:
                CloudFormation:
                  StackNames: ['CdkInfrastructureStack']

          DevOpsGuruTopic: 
            Type: AWS::SNS::Topic
            Properties: 
              TopicName: devops-guru-spec-stack
              Subscription:
                - Endpoint: abc@xyz.com
                  Protocol: email
          
          DevOpsGuruNotification:
            Type: AWS::DevOpsGuru::NotificationChannel
            Properties:
              Config:
                Sns:
                  TopicArn: !Ref DevOpsGuruTopic`
  });
  }