terraform-generator
Advanced tools
Comparing version 6.2.0 to 6.3.0
@@ -10,3 +10,3 @@ import { TerraformElement } from '../utils'; | ||
* | ||
* @param arg argument as string or copy from another argument object | ||
* @param arg argument as string | ||
* @param escape escape the value | ||
@@ -13,0 +13,0 @@ */ |
@@ -24,3 +24,3 @@ "use strict"; | ||
* | ||
* @param arg argument as string or copy from another argument object | ||
* @param arg argument as string | ||
* @param escape escape the value | ||
@@ -31,5 +31,2 @@ */ | ||
_Argument_argument.set(this, void 0); | ||
if (!arg || (typeof arg === 'string' && !arg.trim())) { | ||
throw new Error('Argument cannot be undefined.'); | ||
} | ||
__classPrivateFieldSet(this, _Argument_argument, arg, "f"); | ||
@@ -36,0 +33,0 @@ } |
@@ -7,3 +7,2 @@ import { Block } from '../blocks'; | ||
export declare class Attribute extends Argument { | ||
#private; | ||
/** | ||
@@ -10,0 +9,0 @@ * Construct block's attribute. |
"use strict"; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _a, _Attribute_constructArgument; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -22,15 +16,6 @@ exports.attr = exports.Attribute = void 0; | ||
constructor(block, attrName) { | ||
super(__classPrivateFieldGet(_a, _a, "m", _Attribute_constructArgument).call(_a, block, attrName)); | ||
super(`${block.asArgument().toTerraform()}.${attrName.trim()}`); | ||
} | ||
} | ||
exports.Attribute = Attribute; | ||
_a = Attribute, _Attribute_constructArgument = function _Attribute_constructArgument(block, attrName) { | ||
if (!block) { | ||
throw new Error('Attribute block cannot be undefined.'); | ||
} | ||
if (!attrName?.trim()) { | ||
throw new Error('Attribute name cannot be undefined.'); | ||
} | ||
return `${block.asArgument().toTerraform()}.${attrName.trim()}`; | ||
}; | ||
/** | ||
@@ -37,0 +22,0 @@ * Convenient function to construct new block's [[Attribute]]. |
@@ -28,8 +28,2 @@ "use strict"; | ||
_a = Function, _Function_constructArgument = function _Function_constructArgument(fn, ...args) { | ||
if (!fn.trim()) { | ||
throw new Error('Function name cannot be undefined.'); | ||
} | ||
if (args.filter(arg => arg == null).length > 0) { | ||
throw new Error(`Invalid function argument: ${args}`); | ||
} | ||
let str = `${fn}(`; | ||
@@ -36,0 +30,0 @@ args.forEach((arg, i) => { |
@@ -7,3 +7,2 @@ import { TerraformArgs } from '../utils'; | ||
export declare class Map extends Argument { | ||
#private; | ||
readonly arguments: TerraformArgs; | ||
@@ -10,0 +9,0 @@ /** |
"use strict"; | ||
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { | ||
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); | ||
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); | ||
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); | ||
}; | ||
var _a, _Map_constructArgument; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -22,3 +16,3 @@ exports.map = exports.Map = void 0; | ||
constructor(args) { | ||
super(__classPrivateFieldGet(_a, _a, "m", _Map_constructArgument).call(_a, args)); | ||
super(utils_1.Util.argumentValueToString(args)); | ||
this.arguments = args; | ||
@@ -28,5 +22,2 @@ } | ||
exports.Map = Map; | ||
_a = Map, _Map_constructArgument = function _Map_constructArgument(args) { | ||
return utils_1.Util.argumentValueToString(args); | ||
}; | ||
/** | ||
@@ -33,0 +24,0 @@ * Convenient function to construct new [[Map]]. |
@@ -8,6 +8,8 @@ export * from './Block'; | ||
export * from './Module'; | ||
export * from './Moved'; | ||
export * from './Output'; | ||
export * from './Provider'; | ||
export * from './Provisioner'; | ||
export * from './Removed'; | ||
export * from './Resource'; | ||
export * from './Variable'; |
@@ -24,6 +24,8 @@ "use strict"; | ||
__exportStar(require("./Module"), exports); | ||
__exportStar(require("./Moved"), exports); | ||
__exportStar(require("./Output"), exports); | ||
__exportStar(require("./Provider"), exports); | ||
__exportStar(require("./Provisioner"), exports); | ||
__exportStar(require("./Removed"), exports); | ||
__exportStar(require("./Resource"), exports); | ||
__exportStar(require("./Variable"), exports); |
@@ -21,3 +21,3 @@ "use strict"; | ||
constructor(type, name, args, provisioners) { | ||
super('resource', [type, name], args || {}, provisioners); | ||
super('resource', [type, name], args ?? {}, provisioners); | ||
this.type = type; | ||
@@ -24,0 +24,0 @@ this.name = name; |
@@ -1,2 +0,2 @@ | ||
import { Block, Comment, Resource, Data, Module, Output, Provider, Variable, Backend, Provisioner, ResourceToDataOptions, Locals, Import, ImportArgs, VariableArgs, ModuleArgs, OutputArgs } from './blocks'; | ||
import { Block, Comment, Resource, Data, Module, Output, Provider, Variable, Backend, Provisioner, ResourceToDataOptions, Locals, Import, ImportArgs, VariableArgs, ModuleArgs, OutputArgs, Moved, MovedArgs, RemovedArgs, Removed } from './blocks'; | ||
import { TerraformArgs } from './utils'; | ||
@@ -166,2 +166,18 @@ /** | ||
/** | ||
* Add moved into Terraform. | ||
* | ||
* Refer to Terraform documentation on what can be put as type & arguments. | ||
* | ||
* @param args arguments | ||
*/ | ||
moved(args: MovedArgs): Moved; | ||
/** | ||
* Add removed into Terraform. | ||
* | ||
* Refer to Terraform documentation on what can be put as type & arguments. | ||
* | ||
* @param args arguments | ||
*/ | ||
removed(args: RemovedArgs): Removed; | ||
/** | ||
* Add variable values into Terraform. | ||
@@ -168,0 +184,0 @@ * |
@@ -245,2 +245,26 @@ "use strict"; | ||
/** | ||
* Add moved into Terraform. | ||
* | ||
* Refer to Terraform documentation on what can be put as type & arguments. | ||
* | ||
* @param args arguments | ||
*/ | ||
moved(args) { | ||
const block = new blocks_1.Moved(args); | ||
this.addBlocks(block); | ||
return block; | ||
} | ||
/** | ||
* Add removed into Terraform. | ||
* | ||
* Refer to Terraform documentation on what can be put as type & arguments. | ||
* | ||
* @param args arguments | ||
*/ | ||
removed(args) { | ||
const block = new blocks_1.Removed(args); | ||
this.addBlocks(block); | ||
return block; | ||
} | ||
/** | ||
* Add variable values into Terraform. | ||
@@ -247,0 +271,0 @@ * |
{ | ||
"name": "terraform-generator", | ||
"version": "6.2.0", | ||
"version": "6.3.0", | ||
"author": "Chang Zhe Jiet", | ||
@@ -5,0 +5,0 @@ "description": "Generate Terraform configurations with Node.js.", |
79777
62
2242