@powerlines/plugin-terraform 0.1.32 → 0.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/_rolldown/runtime.cjs +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +36 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +36 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types/_internal.cjs +0 -0
- package/dist/types/_internal.d.cts +8 -0
- package/dist/types/_internal.d.cts.map +1 -0
- package/dist/types/_internal.d.mts +8 -0
- package/dist/types/_internal.d.mts.map +1 -0
- package/dist/types/_internal.mjs +1 -0
- package/dist/types/index.cjs +0 -0
- package/dist/types/index.d.cts +3 -0
- package/dist/types/index.d.mts +3 -0
- package/dist/types/index.mjs +1 -0
- package/dist/types/plugin.cjs +0 -0
- package/dist/types/plugin.d.cts +86 -0
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +86 -0
- package/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.mjs +1 -0
- package/dist/types/terraform.cjs +0 -0
- package/dist/types/terraform.d.cts +17 -0
- package/dist/types/terraform.d.cts.map +1 -0
- package/dist/types/terraform.d.mts +17 -0
- package/dist/types/terraform.d.mts.map +1 -0
- package/dist/types/terraform.mjs +1 -0
- package/package.json +10 -10
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});const e=require(`./_virtual/_rolldown/runtime.cjs`);let t=require(`@stryke/string-format/kebab-case`),n=require(`@stryke/type-checks`),r=require(`defu`);r=e.__toESM(r,1);let i=require(`execa`),a=require(`powerlines/plugin-utils`),o=require(`shelljs`);const s=(e={})=>[{name:`terraform`,async config(){return{deploy:{terraform:(0,r.default)(e,{autoApproval:!1,planFile:`plan.out`,formatWrite:!1,upgrade:!1,destroy:!1,migrateState:!1,lock:!0,reconfigure:!1})}}},async configResolved(){this.terraform??={};let e=(0,o.which)(`terragrunt`)?`terragrunt`:(0,o.which)(`tofu`)?`tofu`:(0,o.which)(`terraform`)?`terraform`:null;if(!e)throw Error(`Both OpenTofu and Terraform are not installed. Please install one of the two before running this executor.`);this.terraform.command=e;let n=(0,t.kebabCase)((0,a.getOrganizationName)(this)),r=(0,t.kebabCase)(await(0,a.getWorkspaceName)(this)),i=(0,t.kebabCase)(this.config.name);this.config.terraform.stackName??=`${n||r||i}-${r&&r!==n&&r!==i?`${r}-`:``}${i}-${this.config.mode}`},async deploy(){this.info(`Creating resources for Terraform stack: ${this.config.terraform.stackName}`),await this.$$internal.callHook(`terraform:deploy`,{sequential:!0}),this.info(`Deploying Terraform stack: ${this.config.terraform.stackName}`),this.config.terraform.destroy&&await(0,i.execaCommand)([this.terraform.command,this.terraform.command===`terragrunt`?this.config.terraform.stackName:void 0,`destroy`,this.config.terraform.autoApproval&&`--auto-approve`,this.config.terraform.varFile&&`--var ${this.config.terraform.varFile}`,(0,n.isSetString)(this.config.terraform.planFile)&&this.config.terraform.planFile].filter(Boolean).join(` `),{preferLocal:!0,shell:!0,stdio:`inherit`,cwd:this.infrastructurePath,env:this.config.mode===`production`?{TF_IN_AUTOMATION:`true`,TF_INPUT:`0`}:{}}),await(0,i.execaCommand)([this.terraform.command,this.terraform.command===`terragrunt`?this.config.terraform.stackName:void 0,`apply`,this.config.terraform.autoApproval&&`--auto-approve`,this.config.terraform.varFile&&`--var ${this.config.terraform.varFile}`,(0,n.isSetString)(this.config.terraform.planFile)&&this.config.terraform.planFile].filter(Boolean).join(` `),{preferLocal:!0,shell:!0,stdio:`inherit`,cwd:this.infrastructurePath,env:this.config.mode===`production`?{TF_IN_AUTOMATION:`true`,TF_INPUT:`0`}:{}}),this.info(`Successfully deployed ${this.config.terraform.stackName}`)}}];exports.default=s,exports.plugin=s;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Resource, ResourceBody, TerraformContext } from "./types/terraform.cjs";
|
|
2
|
+
import { TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig } from "./types/plugin.cjs";
|
|
3
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
4
|
+
import { Plugin, PluginContext } from "powerlines";
|
|
5
|
+
|
|
6
|
+
//#region src/index.d.ts
|
|
7
|
+
declare module "powerlines" {
|
|
8
|
+
interface Config {
|
|
9
|
+
terraform?: TerraformPluginOptions;
|
|
10
|
+
}
|
|
11
|
+
interface BasePlugin<TContext extends PluginContext> {
|
|
12
|
+
terraform?: {
|
|
13
|
+
/**
|
|
14
|
+
* Run the Terraform deployment to create or update infrastructure resources defined in the Terraform program. This hook is executed after the main build process, allowing you to manage your infrastructure as code using Terraform directly from your Powerlines plugin.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* This hook will execute the Terraform program defined in the `config` hook, which should be used to define the infrastructure resources. The Terraform program will be executed sequentially, allowing you to define resources in multiple hooks if needed. The resources defined in the Terraform program will be passed to the next hook invocation, allowing you to manage dependencies between resources defined in different hooks.
|
|
18
|
+
*
|
|
19
|
+
* @param this - The plugin context.
|
|
20
|
+
*/
|
|
21
|
+
deploy?: (this: TContext) => MaybePromise<void>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A package containing a Powerlines plugin to configure infrastructure and deploy a project using Terraform IaC.
|
|
27
|
+
*
|
|
28
|
+
* @see https://www.terraform.io
|
|
29
|
+
*
|
|
30
|
+
* @param options - The Terraform plugin user configuration options.
|
|
31
|
+
* @returns A Powerlines plugin to configure infrastructure and deploy a project using Terraform.
|
|
32
|
+
*/
|
|
33
|
+
declare const plugin: <TContext extends TerraformPluginContext = TerraformPluginContext>(options?: TerraformPluginOptions) => Plugin<TContext>[];
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Resource, ResourceBody, TerraformContext, TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig, plugin as default, plugin };
|
|
36
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;YAiCY,MAAA;IACR,SAAA,GAAY,sBAAA;EAAA;EAAA,UAGJ,UAAA,kBAA4B,aAAA;IACpC,SAAA;MAJY;;;;;;;;MAaV,MAAA,IAAU,IAAA,EAAM,QAAA,KAAa,YAAA;IAAA;EAAA;AAAA;;;;;;;;;cAatB,MAAA,oBACM,sBAAA,GAAyB,sBAAA,EAE1C,OAAA,GAAS,sBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Resource, ResourceBody, TerraformContext } from "./types/terraform.mjs";
|
|
2
|
+
import { TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig } from "./types/plugin.mjs";
|
|
3
|
+
import { MaybePromise } from "@stryke/types/base";
|
|
4
|
+
import { Plugin, PluginContext } from "powerlines";
|
|
5
|
+
|
|
6
|
+
//#region src/index.d.ts
|
|
7
|
+
declare module "powerlines" {
|
|
8
|
+
interface Config {
|
|
9
|
+
terraform?: TerraformPluginOptions;
|
|
10
|
+
}
|
|
11
|
+
interface BasePlugin<TContext extends PluginContext> {
|
|
12
|
+
terraform?: {
|
|
13
|
+
/**
|
|
14
|
+
* Run the Terraform deployment to create or update infrastructure resources defined in the Terraform program. This hook is executed after the main build process, allowing you to manage your infrastructure as code using Terraform directly from your Powerlines plugin.
|
|
15
|
+
*
|
|
16
|
+
* @remarks
|
|
17
|
+
* This hook will execute the Terraform program defined in the `config` hook, which should be used to define the infrastructure resources. The Terraform program will be executed sequentially, allowing you to define resources in multiple hooks if needed. The resources defined in the Terraform program will be passed to the next hook invocation, allowing you to manage dependencies between resources defined in different hooks.
|
|
18
|
+
*
|
|
19
|
+
* @param this - The plugin context.
|
|
20
|
+
*/
|
|
21
|
+
deploy?: (this: TContext) => MaybePromise<void>;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* A package containing a Powerlines plugin to configure infrastructure and deploy a project using Terraform IaC.
|
|
27
|
+
*
|
|
28
|
+
* @see https://www.terraform.io
|
|
29
|
+
*
|
|
30
|
+
* @param options - The Terraform plugin user configuration options.
|
|
31
|
+
* @returns A Powerlines plugin to configure infrastructure and deploy a project using Terraform.
|
|
32
|
+
*/
|
|
33
|
+
declare const plugin: <TContext extends TerraformPluginContext = TerraformPluginContext>(options?: TerraformPluginOptions) => Plugin<TContext>[];
|
|
34
|
+
//#endregion
|
|
35
|
+
export { Resource, ResourceBody, TerraformContext, TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig, plugin as default, plugin };
|
|
36
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;;YAiCY,MAAA;IACR,SAAA,GAAY,sBAAA;EAAA;EAAA,UAGJ,UAAA,kBAA4B,aAAA;IACpC,SAAA;MAJY;;;;;;;;MAaV,MAAA,IAAU,IAAA,EAAM,QAAA,KAAa,YAAA;IAAA;EAAA;AAAA;;;;;;;;;cAatB,MAAA,oBACM,sBAAA,GAAyB,sBAAA,EAE1C,OAAA,GAAS,sBAAA,KACR,MAAA,CAAO,QAAA"}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{kebabCase as e}from"@stryke/string-format/kebab-case";import{isSetString as t}from"@stryke/type-checks";import n from"defu";import{execaCommand as r}from"execa";import{getOrganizationName as i,getWorkspaceName as a}from"powerlines/plugin-utils";import{which as o}from"shelljs";const s=(s={})=>[{name:`terraform`,async config(){return{deploy:{terraform:n(s,{autoApproval:!1,planFile:`plan.out`,formatWrite:!1,upgrade:!1,destroy:!1,migrateState:!1,lock:!0,reconfigure:!1})}}},async configResolved(){this.terraform??={};let t=o(`terragrunt`)?`terragrunt`:o(`tofu`)?`tofu`:o(`terraform`)?`terraform`:null;if(!t)throw Error(`Both OpenTofu and Terraform are not installed. Please install one of the two before running this executor.`);this.terraform.command=t;let n=e(i(this)),r=e(await a(this)),s=e(this.config.name);this.config.terraform.stackName??=`${n||r||s}-${r&&r!==n&&r!==s?`${r}-`:``}${s}-${this.config.mode}`},async deploy(){this.info(`Creating resources for Terraform stack: ${this.config.terraform.stackName}`),await this.$$internal.callHook(`terraform:deploy`,{sequential:!0}),this.info(`Deploying Terraform stack: ${this.config.terraform.stackName}`),this.config.terraform.destroy&&await r([this.terraform.command,this.terraform.command===`terragrunt`?this.config.terraform.stackName:void 0,`destroy`,this.config.terraform.autoApproval&&`--auto-approve`,this.config.terraform.varFile&&`--var ${this.config.terraform.varFile}`,t(this.config.terraform.planFile)&&this.config.terraform.planFile].filter(Boolean).join(` `),{preferLocal:!0,shell:!0,stdio:`inherit`,cwd:this.infrastructurePath,env:this.config.mode===`production`?{TF_IN_AUTOMATION:`true`,TF_INPUT:`0`}:{}}),await r([this.terraform.command,this.terraform.command===`terragrunt`?this.config.terraform.stackName:void 0,`apply`,this.config.terraform.autoApproval&&`--auto-approve`,this.config.terraform.varFile&&`--var ${this.config.terraform.varFile}`,t(this.config.terraform.planFile)&&this.config.terraform.planFile].filter(Boolean).join(` `),{preferLocal:!0,shell:!0,stdio:`inherit`,cwd:this.infrastructurePath,env:this.config.mode===`production`?{TF_IN_AUTOMATION:`true`,TF_INPUT:`0`}:{}}),this.info(`Successfully deployed ${this.config.terraform.stackName}`)}}];export{s as default,s as plugin};
|
|
2
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetString } from \"@stryke/type-checks\";\nimport { MaybePromise } from \"@stryke/types/base\";\nimport defu from \"defu\";\nimport { execaCommand } from \"execa\";\nimport { Plugin, PluginContext } from \"powerlines\";\nimport { getOrganizationName, getWorkspaceName } from \"powerlines/plugin-utils\";\nimport { which } from \"shelljs\";\nimport { TerraformContext } from \"./types\";\nimport { Unstable_TerraformPluginContext } from \"./types/_internal\";\nimport { TerraformPluginContext, TerraformPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\ndeclare module \"powerlines\" {\n interface Config {\n terraform?: TerraformPluginOptions;\n }\n\n interface BasePlugin<TContext extends PluginContext> {\n terraform?: {\n /**\n * Run the Terraform deployment to create or update infrastructure resources defined in the Terraform program. This hook is executed after the main build process, allowing you to manage your infrastructure as code using Terraform directly from your Powerlines plugin.\n *\n * @remarks\n * This hook will execute the Terraform program defined in the `config` hook, which should be used to define the infrastructure resources. The Terraform program will be executed sequentially, allowing you to define resources in multiple hooks if needed. The resources defined in the Terraform program will be passed to the next hook invocation, allowing you to manage dependencies between resources defined in different hooks.\n *\n * @param this - The plugin context.\n */\n deploy?: (this: TContext) => MaybePromise<void>;\n };\n }\n}\n\n/**\n * A package containing a Powerlines plugin to configure infrastructure and deploy a project using Terraform IaC.\n *\n * @see https://www.terraform.io\n *\n * @param options - The Terraform plugin user configuration options.\n * @returns A Powerlines plugin to configure infrastructure and deploy a project using Terraform.\n */\nexport const plugin = <\n TContext extends TerraformPluginContext = TerraformPluginContext\n>(\n options: TerraformPluginOptions = {}\n): Plugin<TContext>[] => {\n return [\n {\n name: \"terraform\",\n async config() {\n return {\n deploy: {\n terraform: defu(options, {\n autoApproval: false,\n planFile: \"plan.out\",\n formatWrite: false,\n upgrade: false,\n destroy: false,\n migrateState: false,\n lock: true,\n reconfigure: false\n })\n }\n };\n },\n async configResolved() {\n this.terraform ??= {} as TerraformContext;\n\n const command = which(\"terragrunt\")\n ? \"terragrunt\"\n : which(\"tofu\")\n ? \"tofu\"\n : which(\"terraform\")\n ? \"terraform\"\n : null;\n if (!command) {\n throw new Error(\n \"Both OpenTofu and Terraform are not installed. Please install one of the two before running this executor.\"\n );\n }\n\n this.terraform.command = command;\n\n const organizationName = kebabCase(getOrganizationName(this));\n const workspaceName = kebabCase(await getWorkspaceName(this));\n const projectName = kebabCase(this.config.name);\n\n this.config.terraform.stackName ??= `${organizationName || workspaceName || projectName}-${\n workspaceName &&\n workspaceName !== organizationName &&\n workspaceName !== projectName\n ? `${workspaceName}-`\n : \"\"\n }${projectName}-${this.config.mode}`;\n },\n async deploy() {\n this.info(\n `Creating resources for Terraform stack: ${this.config.terraform.stackName}`\n );\n\n await (\n this as unknown as Unstable_TerraformPluginContext\n ).$$internal.callHook(\"terraform:deploy\", {\n sequential: true\n });\n\n this.info(\n `Deploying Terraform stack: ${this.config.terraform.stackName}`\n );\n\n if (this.config.terraform.destroy) {\n await execaCommand(\n [\n this.terraform.command,\n this.terraform.command === \"terragrunt\"\n ? this.config.terraform.stackName\n : undefined,\n \"destroy\",\n this.config.terraform.autoApproval && \"--auto-approve\",\n this.config.terraform.varFile &&\n `--var ${this.config.terraform.varFile}`,\n isSetString(this.config.terraform.planFile) &&\n this.config.terraform.planFile\n ]\n .filter(Boolean)\n .join(\" \"),\n {\n preferLocal: true,\n shell: true,\n stdio: \"inherit\",\n cwd: this.infrastructurePath,\n env:\n this.config.mode === \"production\"\n ? {\n TF_IN_AUTOMATION: \"true\",\n TF_INPUT: \"0\"\n }\n : {}\n }\n );\n }\n\n await execaCommand(\n [\n this.terraform.command,\n this.terraform.command === \"terragrunt\"\n ? this.config.terraform.stackName\n : undefined,\n \"apply\",\n this.config.terraform.autoApproval && \"--auto-approve\",\n this.config.terraform.varFile &&\n `--var ${this.config.terraform.varFile}`,\n isSetString(this.config.terraform.planFile) &&\n this.config.terraform.planFile\n ]\n .filter(Boolean)\n .join(\" \"),\n {\n preferLocal: true,\n shell: true,\n stdio: \"inherit\",\n cwd: this.infrastructurePath,\n env:\n this.config.mode === \"production\"\n ? {\n TF_IN_AUTOMATION: \"true\",\n TF_INPUT: \"0\"\n }\n : {}\n }\n );\n\n this.info(`Successfully deployed ${this.config.terraform.stackName}`);\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":"4RA4DA,MAAa,GAGX,EAAkC,EAAE,GAE7B,CACL,CACE,KAAM,YACN,MAAM,QAAS,CACb,MAAO,CACL,OAAQ,CACN,UAAW,EAAK,EAAS,CACvB,aAAc,GACd,SAAU,WACV,YAAa,GACb,QAAS,GACT,QAAS,GACT,aAAc,GACd,KAAM,GACN,YAAa,GACd,CAAC,CACH,CACF,EAEH,MAAM,gBAAiB,CACrB,KAAK,YAAc,EAAE,CAErB,IAAM,EAAU,EAAM,aAAa,CAC/B,aACA,EAAM,OAAO,CACX,OACA,EAAM,YAAY,CAChB,YACA,KACR,GAAI,CAAC,EACH,MAAU,MACR,6GACD,CAGH,KAAK,UAAU,QAAU,EAEzB,IAAM,EAAmB,EAAU,EAAoB,KAAK,CAAC,CACvD,EAAgB,EAAU,MAAM,EAAiB,KAAK,CAAC,CACvD,EAAc,EAAU,KAAK,OAAO,KAAK,CAE/C,KAAK,OAAO,UAAU,YAAc,GAAG,GAAoB,GAAiB,EAAY,GACtF,GACA,IAAkB,GAClB,IAAkB,EACd,GAAG,EAAc,GACjB,KACH,EAAY,GAAG,KAAK,OAAO,QAEhC,MAAM,QAAS,CACb,KAAK,KACH,2CAA2C,KAAK,OAAO,UAAU,YAClE,CAED,MACE,KACA,WAAW,SAAS,mBAAoB,CACxC,WAAY,GACb,CAAC,CAEF,KAAK,KACH,8BAA8B,KAAK,OAAO,UAAU,YACrD,CAEG,KAAK,OAAO,UAAU,SACxB,MAAM,EACJ,CACE,KAAK,UAAU,QACf,KAAK,UAAU,UAAY,aACvB,KAAK,OAAO,UAAU,UACtB,IAAA,GACJ,UACA,KAAK,OAAO,UAAU,cAAgB,iBACtC,KAAK,OAAO,UAAU,SACpB,SAAS,KAAK,OAAO,UAAU,UACjC,EAAY,KAAK,OAAO,UAAU,SAAS,EACzC,KAAK,OAAO,UAAU,SACzB,CACE,OAAO,QAAQ,CACf,KAAK,IAAI,CACZ,CACE,YAAa,GACb,MAAO,GACP,MAAO,UACP,IAAK,KAAK,mBACV,IACE,KAAK,OAAO,OAAS,aACjB,CACE,iBAAkB,OAClB,SAAU,IACX,CACD,EAAE,CACT,CACF,CAGH,MAAM,EACJ,CACE,KAAK,UAAU,QACf,KAAK,UAAU,UAAY,aACvB,KAAK,OAAO,UAAU,UACtB,IAAA,GACJ,QACA,KAAK,OAAO,UAAU,cAAgB,iBACtC,KAAK,OAAO,UAAU,SACpB,SAAS,KAAK,OAAO,UAAU,UACjC,EAAY,KAAK,OAAO,UAAU,SAAS,EACzC,KAAK,OAAO,UAAU,SACzB,CACE,OAAO,QAAQ,CACf,KAAK,IAAI,CACZ,CACE,YAAa,GACb,MAAO,GACP,MAAO,UACP,IAAK,KAAK,mBACV,IACE,KAAK,OAAO,OAAS,aACjB,CACE,iBAAkB,OAClB,SAAU,IACX,CACD,EAAE,CACT,CACF,CAED,KAAK,KAAK,yBAAyB,KAAK,OAAO,UAAU,YAAY,EAExE,CACF"}
|
|
File without changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TerraformPluginContext, TerraformPluginResolvedConfig } from "./plugin.cjs";
|
|
2
|
+
import { Unstable_PluginContext } from "@powerlines/core/types/_internal";
|
|
3
|
+
|
|
4
|
+
//#region src/types/_internal.d.ts
|
|
5
|
+
type Unstable_TerraformPluginContext<TResolvedConfig extends TerraformPluginResolvedConfig = TerraformPluginResolvedConfig> = TerraformPluginContext<TResolvedConfig> & Unstable_PluginContext<TResolvedConfig>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Unstable_TerraformPluginContext };
|
|
8
|
+
//# sourceMappingURL=_internal.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_internal.d.cts","names":[],"sources":["../../src/types/_internal.ts"],"mappings":";;;;KAwBY,+BAAA,yBACc,6BAAA,GACtB,6BAAA,IACA,sBAAA,CAAuB,eAAA,IACzB,sBAAA,CAAuB,eAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { TerraformPluginContext, TerraformPluginResolvedConfig } from "./plugin.mjs";
|
|
2
|
+
import { Unstable_PluginContext } from "@powerlines/core/types/_internal";
|
|
3
|
+
|
|
4
|
+
//#region src/types/_internal.d.ts
|
|
5
|
+
type Unstable_TerraformPluginContext<TResolvedConfig extends TerraformPluginResolvedConfig = TerraformPluginResolvedConfig> = TerraformPluginContext<TResolvedConfig> & Unstable_PluginContext<TResolvedConfig>;
|
|
6
|
+
//#endregion
|
|
7
|
+
export { Unstable_TerraformPluginContext };
|
|
8
|
+
//# sourceMappingURL=_internal.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_internal.d.mts","names":[],"sources":["../../src/types/_internal.ts"],"mappings":";;;;KAwBY,+BAAA,yBACc,6BAAA,GACtB,6BAAA,IACA,sBAAA,CAAuB,eAAA,IACzB,sBAAA,CAAuB,eAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
File without changes
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Resource, ResourceBody, TerraformContext } from "./terraform.cjs";
|
|
2
|
+
import { TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig } from "./plugin.cjs";
|
|
3
|
+
export { Resource, ResourceBody, TerraformContext, TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Resource, ResourceBody, TerraformContext } from "./terraform.mjs";
|
|
2
|
+
import { TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig } from "./plugin.mjs";
|
|
3
|
+
export { Resource, ResourceBody, TerraformContext, TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
File without changes
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { TerraformContext } from "./terraform.cjs";
|
|
2
|
+
import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
|
|
3
|
+
|
|
4
|
+
//#region src/types/plugin.d.ts
|
|
5
|
+
interface TerraformPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the Terraform stack to deploy
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* If not specified, the stack name will be generated based on the organization, workspace, project, and mode. The format of the generated stack name is `{organizationName}-{workspaceName}-{projectName}-{mode}`, where `workspaceName` is only included if it is different from both `organizationName` and `projectName`.
|
|
11
|
+
*
|
|
12
|
+
* For example, if the organization name is "my-org", the workspace name is "my-workspace", the project name is "my-project", and the mode is "production", the generated stack name will be `my-org-my-workspace-my-project-production`. If the workspace name is "my-project" (same as project name), the generated stack name will be `my-org-my-project-production`.
|
|
13
|
+
*
|
|
14
|
+
* @defaultvalue `{organizationName}-{workspaceName}-{projectName}-{mode}`
|
|
15
|
+
*/
|
|
16
|
+
stackName?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to auto-approve the plan
|
|
19
|
+
*
|
|
20
|
+
* @defaultvalue false
|
|
21
|
+
*/
|
|
22
|
+
autoApproval?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The plan file
|
|
25
|
+
*
|
|
26
|
+
* @defaultvalue "plan.out"
|
|
27
|
+
*/
|
|
28
|
+
planFile?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to format the files before writing
|
|
31
|
+
*
|
|
32
|
+
* @defaultvalue false
|
|
33
|
+
*/
|
|
34
|
+
formatWrite?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to upgrade the modules
|
|
37
|
+
*
|
|
38
|
+
* @defaultvalue false
|
|
39
|
+
*/
|
|
40
|
+
upgrade?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to destroy the stack
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* This will run `terraform destroy` instead of `terraform apply`. Use with caution, as this will destroy all resources in the stack. This option is intended for use in CI/CD pipelines, and should not be used in development or production environments.
|
|
46
|
+
*
|
|
47
|
+
* @defaultvalue false
|
|
48
|
+
*/
|
|
49
|
+
destroy?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to migrate the state
|
|
52
|
+
*
|
|
53
|
+
* @defaultvalue false
|
|
54
|
+
*/
|
|
55
|
+
migrateState?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to lock the state
|
|
58
|
+
*
|
|
59
|
+
* @defaultvalue false
|
|
60
|
+
*/
|
|
61
|
+
lock?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The variable file
|
|
64
|
+
*
|
|
65
|
+
* @defaultvalue "variables.tf"
|
|
66
|
+
*/
|
|
67
|
+
varFile?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to reconfigure the state
|
|
70
|
+
*
|
|
71
|
+
* @defaultvalue false
|
|
72
|
+
*/
|
|
73
|
+
reconfigure?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface TerraformPluginUserConfig extends UserConfig {
|
|
76
|
+
terraform?: TerraformPluginOptions;
|
|
77
|
+
}
|
|
78
|
+
interface TerraformPluginResolvedConfig extends ResolvedConfig {
|
|
79
|
+
terraform: TerraformPluginOptions;
|
|
80
|
+
}
|
|
81
|
+
type TerraformPluginContext<TResolvedConfig extends TerraformPluginResolvedConfig = TerraformPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
82
|
+
terraform: TerraformContext;
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig };
|
|
86
|
+
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;UAqBiB,sBAAA;;AAAjB;;;;;;;;;EAWE,SAAA;EA6CA;;;;;EAtCA,YAAA;EA8De;;;;;EAvDf,QAAA;EAwDY;;;AAGd;;EApDE,WAAA;EAoDmE;;;;;EA7CnE,OAAA;EAiDU;;;;;;;;EAvCV,OAAA;EA2C2B;;;;;EApC3B,YAAA;EAoCA;;;;;EA7BA,IAAA;;;;;;EAOA,OAAA;;;;;;EAOA,WAAA;AAAA;AAAA,UAGe,yBAAA,SAAkC,UAAA;EACjD,SAAA,GAAY,sBAAA;AAAA;AAAA,UAGG,6BAAA,SAAsC,cAAA;EACrD,SAAA,EAAW,sBAAA;AAAA;AAAA,KAGD,sBAAA,yBACc,6BAAA,GACtB,6BAAA,IACA,aAAA,CAAc,eAAA;EAChB,SAAA,EAAW,gBAAA;AAAA"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { TerraformContext } from "./terraform.mjs";
|
|
2
|
+
import { PluginContext, ResolvedConfig, UserConfig } from "powerlines";
|
|
3
|
+
|
|
4
|
+
//#region src/types/plugin.d.ts
|
|
5
|
+
interface TerraformPluginOptions {
|
|
6
|
+
/**
|
|
7
|
+
* The name of the Terraform stack to deploy
|
|
8
|
+
*
|
|
9
|
+
* @remarks
|
|
10
|
+
* If not specified, the stack name will be generated based on the organization, workspace, project, and mode. The format of the generated stack name is `{organizationName}-{workspaceName}-{projectName}-{mode}`, where `workspaceName` is only included if it is different from both `organizationName` and `projectName`.
|
|
11
|
+
*
|
|
12
|
+
* For example, if the organization name is "my-org", the workspace name is "my-workspace", the project name is "my-project", and the mode is "production", the generated stack name will be `my-org-my-workspace-my-project-production`. If the workspace name is "my-project" (same as project name), the generated stack name will be `my-org-my-project-production`.
|
|
13
|
+
*
|
|
14
|
+
* @defaultvalue `{organizationName}-{workspaceName}-{projectName}-{mode}`
|
|
15
|
+
*/
|
|
16
|
+
stackName?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Whether to auto-approve the plan
|
|
19
|
+
*
|
|
20
|
+
* @defaultvalue false
|
|
21
|
+
*/
|
|
22
|
+
autoApproval?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The plan file
|
|
25
|
+
*
|
|
26
|
+
* @defaultvalue "plan.out"
|
|
27
|
+
*/
|
|
28
|
+
planFile?: string;
|
|
29
|
+
/**
|
|
30
|
+
* Whether to format the files before writing
|
|
31
|
+
*
|
|
32
|
+
* @defaultvalue false
|
|
33
|
+
*/
|
|
34
|
+
formatWrite?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Whether to upgrade the modules
|
|
37
|
+
*
|
|
38
|
+
* @defaultvalue false
|
|
39
|
+
*/
|
|
40
|
+
upgrade?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Whether to destroy the stack
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* This will run `terraform destroy` instead of `terraform apply`. Use with caution, as this will destroy all resources in the stack. This option is intended for use in CI/CD pipelines, and should not be used in development or production environments.
|
|
46
|
+
*
|
|
47
|
+
* @defaultvalue false
|
|
48
|
+
*/
|
|
49
|
+
destroy?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Whether to migrate the state
|
|
52
|
+
*
|
|
53
|
+
* @defaultvalue false
|
|
54
|
+
*/
|
|
55
|
+
migrateState?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Whether to lock the state
|
|
58
|
+
*
|
|
59
|
+
* @defaultvalue false
|
|
60
|
+
*/
|
|
61
|
+
lock?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* The variable file
|
|
64
|
+
*
|
|
65
|
+
* @defaultvalue "variables.tf"
|
|
66
|
+
*/
|
|
67
|
+
varFile?: string;
|
|
68
|
+
/**
|
|
69
|
+
* Whether to reconfigure the state
|
|
70
|
+
*
|
|
71
|
+
* @defaultvalue false
|
|
72
|
+
*/
|
|
73
|
+
reconfigure?: boolean;
|
|
74
|
+
}
|
|
75
|
+
interface TerraformPluginUserConfig extends UserConfig {
|
|
76
|
+
terraform?: TerraformPluginOptions;
|
|
77
|
+
}
|
|
78
|
+
interface TerraformPluginResolvedConfig extends ResolvedConfig {
|
|
79
|
+
terraform: TerraformPluginOptions;
|
|
80
|
+
}
|
|
81
|
+
type TerraformPluginContext<TResolvedConfig extends TerraformPluginResolvedConfig = TerraformPluginResolvedConfig> = PluginContext<TResolvedConfig> & {
|
|
82
|
+
terraform: TerraformContext;
|
|
83
|
+
};
|
|
84
|
+
//#endregion
|
|
85
|
+
export { TerraformPluginContext, TerraformPluginOptions, TerraformPluginResolvedConfig, TerraformPluginUserConfig };
|
|
86
|
+
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;UAqBiB,sBAAA;;AAAjB;;;;;;;;;EAWE,SAAA;EA6CA;;;;;EAtCA,YAAA;EA8De;;;;;EAvDf,QAAA;EAwDY;;;AAGd;;EApDE,WAAA;EAoDmE;;;;;EA7CnE,OAAA;EAiDU;;;;;;;;EAvCV,OAAA;EA2C2B;;;;;EApC3B,YAAA;EAoCA;;;;;EA7BA,IAAA;;;;;;EAOA,OAAA;;;;;;EAOA,WAAA;AAAA;AAAA,UAGe,yBAAA,SAAkC,UAAA;EACjD,SAAA,GAAY,sBAAA;AAAA;AAAA,UAGG,6BAAA,SAAsC,cAAA;EACrD,SAAA,EAAW,sBAAA;AAAA;AAAA,KAGD,sBAAA,yBACc,6BAAA,GACtB,6BAAA,IACA,aAAA,CAAc,eAAA;EAChB,SAAA,EAAW,gBAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
|
File without changes
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/types/terraform.d.ts
|
|
2
|
+
interface ResourceBody {
|
|
3
|
+
[key: string]: string | boolean | number | ResourceBody | ResourceBody[];
|
|
4
|
+
}
|
|
5
|
+
interface Resource {
|
|
6
|
+
type: string;
|
|
7
|
+
name: string;
|
|
8
|
+
body: ResourceBody;
|
|
9
|
+
}
|
|
10
|
+
interface TerraformContext {
|
|
11
|
+
command: "terraform" | "tofu" | "terragrunt";
|
|
12
|
+
resources: Resource[];
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Resource, ResourceBody, TerraformContext };
|
|
17
|
+
//# sourceMappingURL=terraform.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terraform.d.cts","names":[],"sources":["../../src/types/terraform.ts"],"mappings":";UAkBiB,YAAA;EAAA,CACd,GAAA,uCAA0C,YAAA,GAAe,YAAA;AAAA;AAAA,UAG3C,QAAA;EACf,IAAA;EACA,IAAA;EACA,IAAA,EAAM,YAAA;AAAA;AAAA,UAGS,gBAAA;EACf,OAAA;EACA,SAAA,EAAW,QAAA;EAAA,CACV,GAAA;AAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
//#region src/types/terraform.d.ts
|
|
2
|
+
interface ResourceBody {
|
|
3
|
+
[key: string]: string | boolean | number | ResourceBody | ResourceBody[];
|
|
4
|
+
}
|
|
5
|
+
interface Resource {
|
|
6
|
+
type: string;
|
|
7
|
+
name: string;
|
|
8
|
+
body: ResourceBody;
|
|
9
|
+
}
|
|
10
|
+
interface TerraformContext {
|
|
11
|
+
command: "terraform" | "tofu" | "terragrunt";
|
|
12
|
+
resources: Resource[];
|
|
13
|
+
[key: string]: any;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Resource, ResourceBody, TerraformContext };
|
|
17
|
+
//# sourceMappingURL=terraform.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"terraform.d.mts","names":[],"sources":["../../src/types/terraform.ts"],"mappings":";UAkBiB,YAAA;EAAA,CACd,GAAA,uCAA0C,YAAA,GAAe,YAAA;AAAA;AAAA,UAG3C,QAAA;EACf,IAAA;EACA,IAAA;EACA,IAAA,EAAM,YAAA;AAAA;AAAA,UAGS,gBAAA;EACf,OAAA;EACA,SAAA,EAAW,QAAA;EAAA,CACV,GAAA;AAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerlines/plugin-terraform",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.34",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Powerlines plugin to deploy infrastructure using Terraform.",
|
|
6
6
|
"keywords": [
|
|
@@ -123,22 +123,22 @@
|
|
|
123
123
|
"typings": "dist/index.d.mts",
|
|
124
124
|
"files": ["dist/**/*"],
|
|
125
125
|
"dependencies": {
|
|
126
|
-
"@stryke/fs": "^0.33.
|
|
127
|
-
"@stryke/helpers": "^0.10.
|
|
128
|
-
"@stryke/path": "^0.
|
|
129
|
-
"@stryke/string-format": "^0.17.
|
|
130
|
-
"@stryke/type-checks": "^0.6.
|
|
131
|
-
"@stryke/types": "^0.11.
|
|
126
|
+
"@stryke/fs": "^0.33.69",
|
|
127
|
+
"@stryke/helpers": "^0.10.11",
|
|
128
|
+
"@stryke/path": "^0.28.1",
|
|
129
|
+
"@stryke/string-format": "^0.17.12",
|
|
130
|
+
"@stryke/type-checks": "^0.6.4",
|
|
131
|
+
"@stryke/types": "^0.11.6",
|
|
132
132
|
"defu": "^6.1.7",
|
|
133
133
|
"execa": "^9.6.1",
|
|
134
|
-
"powerlines": "^0.43.
|
|
134
|
+
"powerlines": "^0.43.30",
|
|
135
135
|
"shelljs": "^0.10.0",
|
|
136
136
|
"typescript": "^6.0.3"
|
|
137
137
|
},
|
|
138
138
|
"devDependencies": {
|
|
139
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
139
|
+
"@powerlines/plugin-plugin": "^0.12.385",
|
|
140
140
|
"@types/node": "^25.6.0"
|
|
141
141
|
},
|
|
142
142
|
"publishConfig": { "access": "public" },
|
|
143
|
-
"gitHead": "
|
|
143
|
+
"gitHead": "36f3385b33024e00aafb6c4a10e7a2e3c896aad5"
|
|
144
144
|
}
|