Exemplo n.º 1
0
    def init(self):
        if self.init_done:
            return
        self.init_done = True
        self.paco_ctx.log_start('Init', self.env_region)

        # Secrets Manager
        self.secrets_stack_grp = SecretsManagerStackGroup(
            self.paco_ctx,
            self.account_ctx,
            self,
            self.env_region.secrets_manager,
            StackTags(self.stack_tags)
        )
        self.secrets_stack_grp.init()
        self.stack_grps.append(self.secrets_stack_grp)

        # Network Stack: VPC, Subnets, Etc
        self.network_stack_grp = NetworkStackGroup(
            self.paco_ctx,
            self.account_ctx,
            self,
            StackTags(self.stack_tags)
        )
        self.stack_grps.append(self.network_stack_grp)
        self.network_stack_grp.init()

        # Application Engine Stacks
        for app_name in self.ordered_application_names():
            application_stack_grp = ApplicationStackGroup(
                self.paco_ctx,
                self.account_ctx,
                self,
                self.env_region['applications'][app_name],
                StackTags(self.stack_tags)
            )
            self.application_stack_grps[app_name] = application_stack_grp
            self.stack_grps.append(application_stack_grp)
            application_stack_grp.init()

        # Backup
        if self.env_region.backup_vaults:
            self.backup_stack_grp = BackupVaultsStackGroup(
                self.paco_ctx,
                self.account_ctx,
                self,
                self.env_region.backup_vaults,
                StackTags(self.stack_tags)
            )
            self.backup_stack_grp.init()
            self.stack_grps.append(self.backup_stack_grp)

        self.paco_ctx.log_finish('Init', self.env_region)
    def init(self):
        if self.init_done:
            return
        self.init_done = True
        self.paco_ctx.log_action_col('Init', 'Environment',
                                     self.env_id + ' ' + self.region)
        self.secrets_stack_grp = SecretsManagerStackGroup(
            self.paco_ctx, self.account_ctx, self, self.config.secrets_manager,
            StackTags(self.stack_tags))
        self.secrets_stack_grp.init()
        self.stack_grps.append(self.secrets_stack_grp)

        # Network Stack: VPC, Subnets, Etc
        self.network_stack_grp = NetworkStackGroup(self.paco_ctx,
                                                   self.account_ctx, self,
                                                   StackTags(self.stack_tags))
        self.stack_grps.append(self.network_stack_grp)
        self.network_stack_grp.init()

        # IAM Stack
        # XXX: This may come back later.
        #for iam_group_id in self.iam_ids():
        #    iam_roles_dict = self.iam_roles_dict(iam_group_id)
        #    iam_stack_grp = IAMStackGroup(self.paco_ctx,
        #                                  self.account_ctx,
        #                                  self.get_aws_name(),
        #                                  iam_roles_dict,
        #                                  iam_group_id,
        #                                  self.config_ref_prefix,
        #                                  self)
        #    self.iam_stack_grps[iam_group_id] = iam_stack_grp
        #    self.stack_grps.append(iam_stack_grp)
        #    iam_stack_grp.init()

        # Application Engine Stacks
        for app_id in self.application_ids():
            application_stack_grp = ApplicationStackGroup(
                self.paco_ctx, self.account_ctx, self, app_id,
                StackTags(self.stack_tags))
            self.application_stack_grps[app_id] = application_stack_grp
            self.stack_grps.append(application_stack_grp)
            application_stack_grp.init()

        # Backup
        if self.config.backup_vaults:
            self.backup_stack_grp = BackupVaultsStackGroup(
                self.paco_ctx, self.account_ctx, self,
                self.config.backup_vaults, StackTags(self.stack_tags))
            self.backup_stack_grp.init()
            self.stack_grps.append(self.backup_stack_grp)

        self.paco_ctx.log_action_col('Init', 'Environment',
                                     self.env_id + ' ' + self.region)