UNPKG

terraform-plus

Version:
61 lines (50 loc) 1.58 kB
'use strict'; const TerraformCommand = require('../terraform-command'); const Terraform = require('../terraform/terraform'); class ShowCommand extends TerraformCommand { /** * @desc Validates options passed via cli * * @returns {Boolean} - Returns true if options given from cli are valid. * * @private */ _validateOptions() { return super._validateOptions(); } /** * @desc Executes `terraform show` across multiple terraform scripts */ run() { let promiseArray = []; // this._logger.debug(`templates : ${this._templates}`); // executes terraform show for each dir that has .tf files this._tfsPaths.forEach((dir) => promiseArray.push(this.terraform.show(this._path.join(dir)))); return Promise.all(promiseArray); } /** * @returns {String} */ static get DESCRIPTION() { return 'run `terraform show` across multiple terraform scripts' } /** * @returns {String} */ static get OPTIONS() { return [{ opt: '-p, --provider [provider]', desc: 'terraform provider name (e.g. aws, azurerm, google)' }, { opt: '-i, --include [comma_separated_values]', desc: 'comma separated values of terraform scripts or folders to be included' }, { opt: '-e, --exclude [comma_separated_values]', desc: 'comma separated values of terraform scripts or folders to be excluded' }, { opt: '-d, --directory [directory]', desc: 'path where terraform will be executed (default value - current working directory)' }]; } } module.exports = ShowCommand;