terraform-generator
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -15,1 +15,2 @@ import { default as TerraformGenerator } from './TerraformGenerator'; | ||
export { default as Map } from './types/Map'; | ||
export { writePlan } from './utils'; |
@@ -30,1 +30,3 @@ "use strict"; | ||
exports.Map = Map_1.default; | ||
var utils_1 = require("./utils"); | ||
exports.writePlan = utils_1.writePlan; |
@@ -1,1 +0,4 @@ | ||
export { writePlan } from './Utils'; | ||
export declare const writePlan: (plan: string, dir: string, options?: { | ||
filename?: string; | ||
format?: boolean; | ||
}) => void; |
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Utils_1 = require("./Utils"); | ||
exports.writePlan = Utils_1.writePlan; | ||
const shelljs_1 = __importDefault(require("shelljs")); | ||
const fs_1 = __importDefault(require("fs")); | ||
const path_1 = __importDefault(require("path")); | ||
exports.writePlan = (plan, dir, options) => { | ||
if (!options) { | ||
options = {}; | ||
} | ||
if (!options.filename) { | ||
options.filename = 'terraform.tf'; | ||
} | ||
if (!options.filename.endsWith('.tf')) { | ||
options.filename += '.tf'; | ||
} | ||
if (!fs_1.default.existsSync(dir)) { | ||
shelljs_1.default.mkdir('-p', dir); | ||
} | ||
fs_1.default.writeFileSync(path_1.default.join(dir, options.filename), plan); | ||
if (options.format) { | ||
shelljs_1.default.exec(`cd ${dir} && terraform fmt`); | ||
} | ||
}; |
{ | ||
"name": "terraform-generator", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"author": "Ah Zhe", | ||
@@ -9,5 +9,2 @@ "description": "Generate Terraform plan using Node.js.", | ||
], | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"homepage": "https://github.com/ahzhezhe/terraform-generator#readme", | ||
@@ -19,2 +16,5 @@ "repository": { | ||
"license": "ISC", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"main": "dist/index.js", | ||
@@ -26,4 +26,4 @@ "types": "dist/index.d.ts", | ||
"tryout": "ts-node tryout.ts", | ||
"build": "tsc", | ||
"prepublishOnly": "del-cli --force dist && tsc", | ||
"build": "del-cli --force dist && tsc", | ||
"prepublishOnly": "npm run build", | ||
"postpublish": "del-cli --force dist" | ||
@@ -30,0 +30,0 @@ }, |
@@ -42,2 +42,7 @@ # **terraform-generator** | ||
### **Import** | ||
```javascript | ||
import TerraformGenerator, { Resource, Map, Argument, writePlan } from 'terraform-generator'; | ||
``` | ||
### **Initiate TerraformGenerator** | ||
@@ -115,4 +120,2 @@ ```javascript | ||
```javascript | ||
import { writePlan } from 'terraform-generator/utils'; | ||
// Write Terraform plan to a file | ||
@@ -126,4 +129,3 @@ // Default filename is terraform.tf | ||
```javascript | ||
import TerraformGenerator, { Provider, Resource, DataSource, Output, Map } from 'terraform-generator'; | ||
import { writePlan } from 'terraform-generator/utils'; | ||
import TerraformGenerator, { Map, writePlan } from 'terraform-generator'; | ||
import fs from 'fs'; | ||
@@ -130,0 +132,0 @@ import path from 'path'; |
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
225
24400
30
526