@goldstack/utils-terraform-hetzner 0.1.1
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/README.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
# Goldstack Terraform AWS Utilities
|
|
2
|
+
|
|
3
|
+
This library allows configuring Terraform dynamically from Node.js in order to support deployments to AWS.
|
|
4
|
+
|
|
5
|
+
See [source code](https://github.com/goldstack/goldstack/blob/master/workspaces/templates-lib/packages/utils-terraform-aws/src/utilsTerraformAws.ts).
|
|
6
|
+
|
|
7
|
+
This library is used to support Goldstack templates that define AWS infrastructure such as [Next.js + Bootstrap](https://goldstack.party/templates/nextjs-bootstrap).
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CloudProvider, TerraformDeployment, TerraformOptions } from '@goldstack/utils-terraform';
|
|
2
|
+
import { AWSCloudProvider } from '@goldstack/utils-terraform-aws';
|
|
3
|
+
export declare class HetznerCloudProvider implements CloudProvider {
|
|
4
|
+
token: string;
|
|
5
|
+
awsProvider: AWSCloudProvider;
|
|
6
|
+
generateEnvVariableString: () => string;
|
|
7
|
+
setEnvVariables: () => void;
|
|
8
|
+
getTfStateVariables: (deployment: TerraformDeployment) => [string, string][];
|
|
9
|
+
constructor(token: string, awsProvider: AWSCloudProvider);
|
|
10
|
+
}
|
|
11
|
+
export declare const terraformHetznerCli: (args: string[], provider: AWSCloudProvider, options?: TerraformOptions) => Promise<void>;
|
|
12
|
+
//# sourceMappingURL=utilsTerraformHetzner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilsTerraformHetzner.d.ts","sourceRoot":"","sources":["../../src/utilsTerraformHetzner.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,aAAa,EACb,mBAAmB,EACnB,gBAAgB,EACjB,MAAM,4BAA4B,CAAC;AAKpC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAElE,qBAAa,oBAAqB,YAAW,aAAa;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,gBAAgB,CAAC;IAE9B,yBAAyB,QAAO,MAAM,CAKpC;IAEF,eAAe,QAAO,IAAI,CAGxB;IAEF,mBAAmB,eACL,mBAAmB,KAC9B,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAEnB;gBAEU,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,gBAAgB;CAIzD;AAED,eAAO,MAAM,mBAAmB,SACxB,MAAM,EAAE,YACJ,gBAAgB,YAChB,gBAAgB,KACzB,QAAQ,IAAI,CAWd,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.terraformHetznerCli = exports.HetznerCloudProvider = void 0;
|
|
4
|
+
const utils_terraform_1 = require("@goldstack/utils-terraform");
|
|
5
|
+
const infra_hetzner_1 = require("@goldstack/infra-hetzner");
|
|
6
|
+
class HetznerCloudProvider {
|
|
7
|
+
constructor(token, awsProvider) {
|
|
8
|
+
this.generateEnvVariableString = () => {
|
|
9
|
+
return (`-e TF_VAR_hcloud_token=${this.token} ` +
|
|
10
|
+
this.awsProvider.generateEnvVariableString());
|
|
11
|
+
};
|
|
12
|
+
this.setEnvVariables = () => {
|
|
13
|
+
process.env.TF_VAR_hcloud_token = this.token;
|
|
14
|
+
this.awsProvider.setEnvVariables();
|
|
15
|
+
};
|
|
16
|
+
this.getTfStateVariables = (deployment) => {
|
|
17
|
+
return this.awsProvider.getTfStateVariables(deployment);
|
|
18
|
+
};
|
|
19
|
+
this.token = token;
|
|
20
|
+
this.awsProvider = awsProvider;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.HetznerCloudProvider = HetznerCloudProvider;
|
|
24
|
+
const terraformHetznerCli = async (args, provider, options) => {
|
|
25
|
+
const deploymentName = args[1];
|
|
26
|
+
const deployment = (0, infra_hetzner_1.readDeploymentFromPackageConfig)(deploymentName);
|
|
27
|
+
const user = await (0, infra_hetzner_1.getHetznerUser)(deployment.hetznerUser);
|
|
28
|
+
(0, utils_terraform_1.terraformCli)(args, {
|
|
29
|
+
...options,
|
|
30
|
+
provider: new HetznerCloudProvider(user.config.token, provider),
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
exports.terraformHetznerCli = terraformHetznerCli;
|
|
34
|
+
//# sourceMappingURL=utilsTerraformHetzner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utilsTerraformHetzner.js","sourceRoot":"","sources":["../../src/utilsTerraformHetzner.ts"],"names":[],"mappings":";;;AAAA,gEAKoC;AACpC,4DAGkC;AAGlC,MAAa,oBAAoB;IAsB/B,YAAY,KAAa,EAAE,WAA6B;QAlBxD,8BAAyB,GAAG,GAAW,EAAE;YACvC,OAAO,CACL,0BAA0B,IAAI,CAAC,KAAK,GAAG;gBACvC,IAAI,CAAC,WAAW,CAAC,yBAAyB,EAAE,CAC7C,CAAC;QACJ,CAAC,CAAC;QAEF,oBAAe,GAAG,GAAS,EAAE;YAC3B,OAAO,CAAC,GAAG,CAAC,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC;YAC7C,IAAI,CAAC,WAAW,CAAC,eAAe,EAAE,CAAC;QACrC,CAAC,CAAC;QAEF,wBAAmB,GAAG,CACpB,UAA+B,EACX,EAAE;YACtB,OAAO,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,UAAU,CAAC,CAAC;QAC1D,CAAC,CAAC;QAGA,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;IACjC,CAAC;CACF;AA1BD,oDA0BC;AAEM,MAAM,mBAAmB,GAAG,KAAK,EACtC,IAAc,EACd,QAA0B,EAC1B,OAA0B,EACX,EAAE;IACjB,MAAM,cAAc,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IAE/B,MAAM,UAAU,GAAG,IAAA,+CAA+B,EAAC,cAAc,CAAC,CAAC;IAEnE,MAAM,IAAI,GAAG,MAAM,IAAA,8BAAc,EAAC,UAAU,CAAC,WAAW,CAAC,CAAC;IAE1D,IAAA,8BAAY,EAAC,IAAI,EAAE;QACjB,GAAG,OAAO;QACV,QAAQ,EAAE,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC;KAChE,CAAC,CAAC;AACL,CAAC,CAAC;AAfW,QAAA,mBAAmB,uBAe9B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@goldstack/utils-terraform-hetzner",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Easily deploy Terraform IaC with npm package scripts for Hetzner Cloud Services",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"goldstack",
|
|
7
|
+
"utility",
|
|
8
|
+
"terraform",
|
|
9
|
+
"aws",
|
|
10
|
+
"IaC"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://goldstack.party",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/goldstack/goldstack/issues"
|
|
15
|
+
},
|
|
16
|
+
"repository": {
|
|
17
|
+
"type": "git",
|
|
18
|
+
"url": "https://github.com/goldstack/goldstack.git"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "Max Rohde",
|
|
22
|
+
"sideEffects": false,
|
|
23
|
+
"main": "dist/src/utilsTerraformHetzner.js",
|
|
24
|
+
"scripts": {
|
|
25
|
+
"build": "yarn clean && yarn compile",
|
|
26
|
+
"build:watch": "yarn clean && yarn compile-watch",
|
|
27
|
+
"clean": "rimraf ./dist",
|
|
28
|
+
"compile": "tsc -p tsconfig.json",
|
|
29
|
+
"compile-watch": "tsc -p tsconfig.json --watch",
|
|
30
|
+
"compile-watch:light": "nodemon --watch ./src/ -e '*' --exec 'yarn compile'",
|
|
31
|
+
"coverage": "jest --collect-coverage --passWithNoTests --config=./jest.config.js --runInBand",
|
|
32
|
+
"prepublishOnly": "yarn run build",
|
|
33
|
+
"publish": "utils-git changed --exec \"yarn npm publish $@\"",
|
|
34
|
+
"test-ci": "jest --passWithNoTests --config=./jest.config.js --runInBand",
|
|
35
|
+
"version:apply": "utils-git changed --exec \"yarn version $@ && yarn version apply\"",
|
|
36
|
+
"version:apply:force": "yarn version $@ && yarn version apply"
|
|
37
|
+
},
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@goldstack/infra-hetzner": "0.1.1",
|
|
40
|
+
"@goldstack/utils-config": "0.4.10",
|
|
41
|
+
"@goldstack/utils-log": "0.3.9",
|
|
42
|
+
"@goldstack/utils-package": "0.4.10",
|
|
43
|
+
"@goldstack/utils-sh": "0.5.9",
|
|
44
|
+
"@goldstack/utils-terraform": "0.4.20",
|
|
45
|
+
"@goldstack/utils-terraform-aws": "0.4.22"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@goldstack/utils-git": "0.2.9",
|
|
49
|
+
"@swc/core": "^1.3.74",
|
|
50
|
+
"@swc/jest": "^0.2.27",
|
|
51
|
+
"@types/jest": "^29.0.1",
|
|
52
|
+
"@types/node": "^18.7.13",
|
|
53
|
+
"jest": "^29.3.1",
|
|
54
|
+
"rimraf": "^3.0.2",
|
|
55
|
+
"typescript": "^4.8.4"
|
|
56
|
+
},
|
|
57
|
+
"publishConfig": {
|
|
58
|
+
"main": "dist/src/utilsTerraformHetzner.js"
|
|
59
|
+
}
|
|
60
|
+
}
|