terraform-generator
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -10,4 +10,5 @@ import { default as TerraformGenerator } from './src/TerraformGenerator'; | ||
export { default as Module } from './src/blocks/Module'; | ||
export { default as Identifier } from './src/identifiers/Identifier'; | ||
export { default as Attribute } from './src/identifiers/Attribute'; | ||
export { default as Variable } from './src/blocks/Variable'; | ||
export { default as Argument } from './src/arguments/Argument'; | ||
export { default as Attribute } from './src/arguments/Attribute'; | ||
export { default as Map } from './src/types/Map'; |
@@ -20,7 +20,9 @@ "use strict"; | ||
exports.Module = Module_1.default; | ||
var Identifier_1 = require("./src/identifiers/Identifier"); | ||
exports.Identifier = Identifier_1.default; | ||
var Attribute_1 = require("./src/identifiers/Attribute"); | ||
var Variable_1 = require("./src/blocks/Variable"); | ||
exports.Variable = Variable_1.default; | ||
var Argument_1 = require("./src/arguments/Argument"); | ||
exports.Argument = Argument_1.default; | ||
var Attribute_1 = require("./src/arguments/Attribute"); | ||
exports.Attribute = Attribute_1.default; | ||
var Map_1 = require("./src/types/Map"); | ||
exports.Map = Map_1.default; |
@@ -1,2 +0,2 @@ | ||
import TerraformGenerator, { Attribute, Identifier } from '../..'; | ||
import TerraformGenerator, { Attribute, Argument } from '../..'; | ||
export default abstract class Block { | ||
@@ -14,3 +14,3 @@ protected readonly tfGenerator: TerraformGenerator; | ||
toTerraform(): string; | ||
abstract getIdentifier(): Identifier; | ||
abstract asArgument(): Argument; | ||
abstract getAttribute(name: string): Attribute; | ||
@@ -17,0 +17,0 @@ private validateIdentifier; |
@@ -56,3 +56,3 @@ "use strict"; | ||
if (['string', 'number', 'boolean'].indexOf(typeof value) >= 0 | ||
|| value instanceof Block || value instanceof __1.Identifier || value instanceof __1.Map) { | ||
|| value instanceof Block || value instanceof __1.Argument || value instanceof __1.Map) { | ||
return false; | ||
@@ -112,5 +112,5 @@ } | ||
if (value instanceof Block) { | ||
return this.argumentValueToString(value.getIdentifier()); | ||
return this.argumentValueToString(value.asArgument()); | ||
} | ||
else if (value instanceof __1.Identifier) { | ||
else if (value instanceof __1.Argument) { | ||
if (this.tfGenerator.options.version === '0.11') { | ||
@@ -117,0 +117,0 @@ return `"\${${value.toTerraform()}}"`; |
@@ -1,2 +0,2 @@ | ||
import TerraformGenerator, { Block, Identifier, Attribute } from '../..'; | ||
import TerraformGenerator, { Block, Argument, Attribute } from '../..'; | ||
export default class DataSource extends Block { | ||
@@ -6,4 +6,4 @@ readonly type: string; | ||
constructor(tfGenerator: TerraformGenerator, type: string, name: string, args?: object); | ||
getIdentifier(): Identifier; | ||
asArgument(): Argument; | ||
getAttribute(name: string): Attribute; | ||
} |
@@ -10,4 +10,4 @@ "use strict"; | ||
} | ||
getIdentifier() { | ||
return new __1.Identifier(`data.${this.type}.${this.name}`); | ||
asArgument() { | ||
return new __1.Argument(`data.${this.type}.${this.name}`); | ||
} | ||
@@ -14,0 +14,0 @@ getAttribute(name) { |
@@ -1,7 +0,7 @@ | ||
import TerraformGenerator, { Block, Identifier, Attribute } from '../..'; | ||
import TerraformGenerator, { Block, Argument, Attribute } from '../..'; | ||
export default class Module extends Block { | ||
readonly name: string; | ||
constructor(tfGenerator: TerraformGenerator, name: string, args?: object); | ||
getIdentifier(): Identifier; | ||
asArgument(): Argument; | ||
getAttribute(name: string): Attribute; | ||
} |
@@ -9,4 +9,4 @@ "use strict"; | ||
} | ||
getIdentifier() { | ||
return new __1.Identifier(`module.${this.name}`); | ||
asArgument() { | ||
return new __1.Argument(`module.${this.name}`); | ||
} | ||
@@ -13,0 +13,0 @@ getAttribute(name) { |
@@ -1,7 +0,7 @@ | ||
import TerraformGenerator, { Block, Identifier, Attribute } from '../..'; | ||
import TerraformGenerator, { Block, Argument, Attribute } from '../..'; | ||
export default class Output extends Block { | ||
readonly name: string; | ||
constructor(tfGenerator: TerraformGenerator, name: string, args: object); | ||
getIdentifier(): Identifier; | ||
asArgument(): Argument; | ||
getAttribute(name: string): Attribute; | ||
} |
@@ -9,3 +9,3 @@ "use strict"; | ||
} | ||
getIdentifier() { | ||
asArgument() { | ||
throw new Error('Inaccessible function.'); | ||
@@ -12,0 +12,0 @@ } |
@@ -1,7 +0,7 @@ | ||
import TerraformGenerator, { Block, Identifier, Attribute } from '../..'; | ||
import TerraformGenerator, { Block, Argument, Attribute } from '../..'; | ||
export default class Provider extends Block { | ||
readonly name: string; | ||
constructor(tfGenerator: TerraformGenerator, name: string, args: object); | ||
getIdentifier(): Identifier; | ||
asArgument(): Argument; | ||
getAttribute(name: string): Attribute; | ||
} |
@@ -9,7 +9,7 @@ "use strict"; | ||
} | ||
getIdentifier() { | ||
asArgument() { | ||
if (this.getArgument('alias')) { | ||
return new __1.Identifier(`${this.name}.${this.getArgument('alias')}`); | ||
return new __1.Argument(`${this.name}.${this.getArgument('alias')}`); | ||
} | ||
return new __1.Identifier(this.name); | ||
return new __1.Argument(this.name); | ||
} | ||
@@ -16,0 +16,0 @@ // eslint-disable-next-line @typescript-eslint/no-unused-vars |
@@ -1,2 +0,2 @@ | ||
import TerraformGenerator, { Block, Identifier, Attribute } from '../..'; | ||
import TerraformGenerator, { Block, Argument, Attribute } from '../..'; | ||
export default class Resource extends Block { | ||
@@ -6,4 +6,4 @@ readonly type: string; | ||
constructor(tfGenerator: TerraformGenerator, type: string, name: string, args?: object); | ||
getIdentifier(): Identifier; | ||
asArgument(): Argument; | ||
getAttribute(name: string): Attribute; | ||
} |
@@ -10,4 +10,4 @@ "use strict"; | ||
} | ||
getIdentifier() { | ||
return new __1.Identifier(`${this.type}.${this.name}`); | ||
asArgument() { | ||
return new __1.Argument(`${this.type}.${this.name}`); | ||
} | ||
@@ -14,0 +14,0 @@ getAttribute(name) { |
{ | ||
"name": "terraform-generator", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"author": "Ah Zhe", | ||
@@ -5,0 +5,0 @@ "description": "Generate Terraform plan using Node.js.", |
@@ -84,3 +84,4 @@ # **terraform-generator** | ||
}), | ||
resourceAttribute: resource.getAttribute('attributeName') | ||
resourceAttribute: resource.getAttribute('attributeName'), | ||
custom: new Argument('max(5, 12, 9)') | ||
} | ||
@@ -87,0 +88,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
21073
26
431
192