@pulumi/terraform 6.0.0 → 6.0.2
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 +5 -99
- package/package.json +3 -3
- package/package.json.dev +2 -2
- package/utilities.d.ts +0 -4
- package/utilities.js +19 -29
- package/utilities.js.map +1 -1
package/README.md
CHANGED
|
@@ -1,102 +1,8 @@
|
|
|
1
1
|
# Pulumi Terraform Provider
|
|
2
2
|
|
|
3
|
-
The Terraform resource provider for Pulumi lets you consume the outputs
|
|
4
|
-
|
|
5
|
-
provides a `RemoteStateReference` resource which acts like a native Pulumi
|
|
6
|
-
[`StackReference`][stackreference].
|
|
7
|
-
|
|
8
|
-
To use this package, please [install the Pulumi CLI first][pulumicli].
|
|
9
|
-
|
|
10
|
-
## Installing
|
|
11
|
-
|
|
12
|
-
### Node.js (JavaScript/TypeScript)
|
|
13
|
-
|
|
14
|
-
To use from JavaScript or TypeScript in Node.js, install using either `npm`:
|
|
15
|
-
|
|
16
|
-
$ npm install @pulumi/terraform
|
|
17
|
-
|
|
18
|
-
or `yarn`:
|
|
19
|
-
|
|
20
|
-
$ yarn add @pulumi/terraform
|
|
21
|
-
|
|
22
|
-
### Python
|
|
23
|
-
|
|
24
|
-
To use from Python, install using `pip`:
|
|
25
|
-
|
|
26
|
-
$ pip install pulumi-terraform
|
|
27
|
-
|
|
28
|
-
## Concepts
|
|
29
|
-
|
|
30
|
-
The `@pulumi/terraform` package provides a [resource](https://www.pulumi.com/docs/concepts/resources/) named `RemoteStateReference`
|
|
31
|
-
which is used to read outputs from a Terraform state file stored in one of the supported
|
|
32
|
-
Terraform remote state backends.
|
|
33
|
-
|
|
34
|
-
## Examples
|
|
35
|
-
|
|
36
|
-
### S3
|
|
37
|
-
|
|
38
|
-
The following program will read a Terraform state file stored in S3:
|
|
39
|
-
|
|
40
|
-
```typescript
|
|
41
|
-
import * as tf from "@pulumi/terraform";
|
|
42
|
-
|
|
43
|
-
const remoteState = new tf.state.RemoteStateReference("s3state", {
|
|
44
|
-
backendType: "s3",
|
|
45
|
-
bucket: "pulumi-terraform-state-test",
|
|
46
|
-
key: "test/terraform.tfstate",
|
|
47
|
-
region: "us-west-2"
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// Use the getOutput function on the resource to access root outputs
|
|
51
|
-
const vpcId= remoteState.getOutput("vpc_id");
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Local file
|
|
55
|
-
|
|
56
|
-
The following program will read a Terraform state file stored locally in the
|
|
57
|
-
filesystem:
|
|
58
|
-
|
|
59
|
-
```typescript
|
|
60
|
-
import * as tf from "@pulumi/terraform";
|
|
61
|
-
|
|
62
|
-
const remotestate = new tf.state.RemoteStateReference("localstate", {
|
|
63
|
-
backendType: "local",
|
|
64
|
-
path: path.join(__dirname, "terraform.tfstate"),
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Use the getOutput function on the resource to access root outputs
|
|
68
|
-
const vpcId= remoteState.getOutput("vpc_id");
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Terraform Enterprise
|
|
72
|
-
|
|
73
|
-
For state stored in Terraform Enterprise, the authentication token must be set
|
|
74
|
-
via the Pulumi configuration system - for example, using:
|
|
75
|
-
|
|
76
|
-
pulumi config set --secret terraformEnterpriseToken <value>
|
|
77
|
-
|
|
78
|
-
The following program will read a Terraform state file stored in Terraform
|
|
79
|
-
Enterprise, using the value of `terraformEnterpriseToken` from above:
|
|
80
|
-
|
|
81
|
-
```typescript
|
|
82
|
-
import * as pulumi from "@pulumi/pulumi";
|
|
83
|
-
import * as tf from "@pulumi/terraform";
|
|
84
|
-
|
|
85
|
-
const config = new pulumi.Config();
|
|
86
|
-
|
|
87
|
-
const ref = new tf.state.RemoteStateReference("remote", {
|
|
88
|
-
backendType: "remote",
|
|
89
|
-
organization: "pulumi",
|
|
90
|
-
token: config.requireSecret("terraformEnterpriseToken"),
|
|
91
|
-
workspaces: {
|
|
92
|
-
name: "test-state-file"
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
// Use the getOutput function on the resource to access root outputs
|
|
97
|
-
const vpcId= remoteState.getOutput("vpc_id");
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
[stackreference]: https://www.pulumi.com/docs/reference/organizing-stacks-projects/#inter-stack-dependencies
|
|
101
|
-
[pulumicli]: https://pulumi.com/
|
|
3
|
+
The Terraform resource provider for Pulumi lets you consume the outputs contained in
|
|
4
|
+
Terraform state files from your Pulumi programs.
|
|
102
5
|
|
|
6
|
+
> [!IMPORTANT]
|
|
7
|
+
> For reference docs and installation instructions, please go to
|
|
8
|
+
> <https://www.pulumi.com/registry/packages/terraform/>.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulumi/terraform",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"terraform",
|
|
6
6
|
"kind/native",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
12
|
"scripts": {
|
|
13
13
|
"build": "tsc",
|
|
14
|
-
"install": "node scripts/install-pulumi-plugin.js resource terraform 6.0.
|
|
14
|
+
"install": "node scripts/install-pulumi-plugin.js resource terraform 6.0.2"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"@pulumi/pulumi": "^3.142.0"
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
"pulumi": {
|
|
24
24
|
"resource": true,
|
|
25
25
|
"name": "terraform",
|
|
26
|
-
"version": "6.0.
|
|
26
|
+
"version": "6.0.2"
|
|
27
27
|
}
|
|
28
28
|
}
|
package/package.json.dev
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pulumi/terraform",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.2",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"terraform",
|
|
6
6
|
"kind/native",
|
|
@@ -22,6 +22,6 @@
|
|
|
22
22
|
"pulumi": {
|
|
23
23
|
"resource": true,
|
|
24
24
|
"name": "terraform",
|
|
25
|
-
"version": "6.0.
|
|
25
|
+
"version": "6.0.2"
|
|
26
26
|
}
|
|
27
27
|
}
|
package/utilities.d.ts
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
import * as pulumi from "@pulumi/pulumi";
|
|
2
1
|
export declare function getEnv(...vars: string[]): string | undefined;
|
|
3
2
|
export declare function getEnvBoolean(...vars: string[]): boolean | undefined;
|
|
4
3
|
export declare function getEnvNumber(...vars: string[]): number | undefined;
|
|
5
4
|
export declare function getVersion(): string;
|
|
6
|
-
export declare function callAsync<T>(tok: string, props: pulumi.Inputs, res?: pulumi.Resource, opts?: {
|
|
7
|
-
property?: string;
|
|
8
|
-
}): Promise<T>;
|
package/utilities.js
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// *** WARNING: this file was generated by pulumi-language-nodejs. ***
|
|
3
3
|
// *** Do not edit by hand unless you're certain you know what you are doing! ***
|
|
4
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
5
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
6
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
7
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
8
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
9
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
10
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
11
|
-
});
|
|
12
|
-
};
|
|
13
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
5
|
exports.callAsync = exports.lazyLoad = exports.resourceOptsDefaults = exports.getVersion = exports.getEnvNumber = exports.getEnvBoolean = exports.getEnv = void 0;
|
|
15
6
|
const runtime = require("@pulumi/pulumi/runtime");
|
|
@@ -76,26 +67,25 @@ function lazyLoad(exports, props, loadModule) {
|
|
|
76
67
|
}
|
|
77
68
|
}
|
|
78
69
|
exports.lazyLoad = lazyLoad;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
});
|
|
70
|
+
/** @internal */
|
|
71
|
+
async function callAsync(tok, props, res, opts) {
|
|
72
|
+
const o = runtime.call(tok, props, res);
|
|
73
|
+
const value = await o.promise(true /*withUnknowns*/);
|
|
74
|
+
const isKnown = await o.isKnown;
|
|
75
|
+
const isSecret = await o.isSecret;
|
|
76
|
+
const problem = !isKnown ? "an unknown value"
|
|
77
|
+
: isSecret ? "a secret value"
|
|
78
|
+
: undefined;
|
|
79
|
+
// Ingoring o.resources silently. They are typically non-empty, r.f() calls include r as a dependency.
|
|
80
|
+
if (problem) {
|
|
81
|
+
throw new Error(`Plain resource method "${tok}" incorrectly returned ${problem}. ` +
|
|
82
|
+
"This is an error in the provider, please report this to the provider developer.");
|
|
83
|
+
}
|
|
84
|
+
// Extract a single property if requested.
|
|
85
|
+
if (opts && opts.property) {
|
|
86
|
+
return value[opts.property];
|
|
87
|
+
}
|
|
88
|
+
return value;
|
|
99
89
|
}
|
|
100
90
|
exports.callAsync = callAsync;
|
|
101
91
|
//# sourceMappingURL=utilities.js.map
|
package/utilities.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utilities.js","sourceRoot":"","sources":["../utilities.ts"],"names":[],"mappings":";AAAA,sEAAsE;AACtE,iFAAiF
|
|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