public async execute()

in src/tasks/CloudFormationCreateOrUpdateStack/TaskOperations.ts [43:88]


    public async execute(): Promise<void> {
        let stackId: string = await testStackExists(this.cloudFormationClient, this.taskParameters.stackName)
        if (stackId) {
            console.log(tl.loc('StackExists'))

            if (this.taskParameters.templateSource === usePreviousTemplate) {
                console.log(tl.loc('UpdatingStackWithPreviousTemplate'))
            }

            if (this.taskParameters.useChangeSet) {
                stackId = await this.createOrUpdateWithChangeSet('UPDATE')
            } else {
                await this.updateStack()
            }
        } else {
            console.log(tl.loc('StackDoesNotExist'))

            if (this.taskParameters.templateSource === usePreviousTemplate) {
                throw new Error(tl.loc('UsePreviousTemplateIsInvalidWhenCreatingStack'))
            }

            if (this.taskParameters.useChangeSet) {
                stackId = await this.createOrUpdateWithChangeSet('CREATE')
            } else {
                stackId = await this.createStack()
            }
        }

        if (this.taskParameters.outputVariable) {
            console.log(tl.loc('SettingOutputVariable', this.taskParameters.outputVariable))
            tl.setVariable(this.taskParameters.outputVariable, stackId)
        }

        if (this.taskParameters.captureStackOutputs !== ignoreStackOutputs) {
            await captureStackOutputs(
                this.cloudFormationClient,
                this.taskParameters.stackName,
                this.taskParameters.captureStackOutputs === stackOutputsAsJson,
                this.taskParameters.captureAsSecuredVars
            )
        } else {
            console.log(tl.loc('SkippingStackOutputsProcessing'))
        }

        console.log(tl.loc('TaskCompleted', this.taskParameters.stackName, stackId))
    }