pulumi-terraform 6.0.0__py3-none-any.whl
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.
- pulumi_terraform/__init__.py +32 -0
- pulumi_terraform/_utilities.py +331 -0
- pulumi_terraform/provider.py +77 -0
- pulumi_terraform/pulumi-plugin.json +5 -0
- pulumi_terraform/py.typed +0 -0
- pulumi_terraform/state/__init__.py +11 -0
- pulumi_terraform/state/_inputs.py +76 -0
- pulumi_terraform/state/get_local_reference.py +87 -0
- pulumi_terraform/state/get_remote_reference.py +98 -0
- pulumi_terraform-6.0.0.dist-info/METADATA +117 -0
- pulumi_terraform-6.0.0.dist-info/RECORD +13 -0
- pulumi_terraform-6.0.0.dist-info/WHEEL +5 -0
- pulumi_terraform-6.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
3
|
+
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
4
|
+
|
5
|
+
import builtins
|
6
|
+
from . import _utilities
|
7
|
+
import typing
|
8
|
+
# Export this package's modules as members:
|
9
|
+
from .provider import *
|
10
|
+
|
11
|
+
# Make subpackages available:
|
12
|
+
if typing.TYPE_CHECKING:
|
13
|
+
import pulumi_terraform.state as __state
|
14
|
+
state = __state
|
15
|
+
else:
|
16
|
+
state = _utilities.lazy_import('pulumi_terraform.state')
|
17
|
+
|
18
|
+
_utilities.register(
|
19
|
+
resource_modules="""
|
20
|
+
[]
|
21
|
+
""",
|
22
|
+
resource_packages="""
|
23
|
+
[
|
24
|
+
{
|
25
|
+
"pkg": "terraform",
|
26
|
+
"token": "pulumi:providers:terraform",
|
27
|
+
"fqn": "pulumi_terraform",
|
28
|
+
"class": "Provider"
|
29
|
+
}
|
30
|
+
]
|
31
|
+
"""
|
32
|
+
)
|
@@ -0,0 +1,331 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
3
|
+
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
4
|
+
|
5
|
+
|
6
|
+
import asyncio
|
7
|
+
import functools
|
8
|
+
import importlib.metadata
|
9
|
+
import importlib.util
|
10
|
+
import inspect
|
11
|
+
import json
|
12
|
+
import os
|
13
|
+
import sys
|
14
|
+
import typing
|
15
|
+
import warnings
|
16
|
+
import base64
|
17
|
+
|
18
|
+
import pulumi
|
19
|
+
import pulumi.runtime
|
20
|
+
from pulumi.runtime.sync_await import _sync_await
|
21
|
+
from pulumi.runtime.proto import resource_pb2
|
22
|
+
|
23
|
+
from semver import VersionInfo as SemverVersion
|
24
|
+
from parver import Version as PEP440Version
|
25
|
+
|
26
|
+
C = typing.TypeVar("C", bound=typing.Callable)
|
27
|
+
|
28
|
+
|
29
|
+
def get_env(*args):
|
30
|
+
for v in args:
|
31
|
+
value = os.getenv(v)
|
32
|
+
if value is not None:
|
33
|
+
return value
|
34
|
+
return None
|
35
|
+
|
36
|
+
|
37
|
+
def get_env_bool(*args):
|
38
|
+
str = get_env(*args)
|
39
|
+
if str is not None:
|
40
|
+
# NOTE: these values are taken from https://golang.org/src/strconv/atob.go?s=351:391#L1, which is what
|
41
|
+
# Terraform uses internally when parsing boolean values.
|
42
|
+
if str in ["1", "t", "T", "true", "TRUE", "True"]:
|
43
|
+
return True
|
44
|
+
if str in ["0", "f", "F", "false", "FALSE", "False"]:
|
45
|
+
return False
|
46
|
+
return None
|
47
|
+
|
48
|
+
|
49
|
+
def get_env_int(*args):
|
50
|
+
str = get_env(*args)
|
51
|
+
if str is not None:
|
52
|
+
try:
|
53
|
+
return int(str)
|
54
|
+
except:
|
55
|
+
return None
|
56
|
+
return None
|
57
|
+
|
58
|
+
|
59
|
+
def get_env_float(*args):
|
60
|
+
str = get_env(*args)
|
61
|
+
if str is not None:
|
62
|
+
try:
|
63
|
+
return float(str)
|
64
|
+
except:
|
65
|
+
return None
|
66
|
+
return None
|
67
|
+
|
68
|
+
|
69
|
+
def _get_semver_version():
|
70
|
+
# __name__ is set to the fully-qualified name of the current module, In our case, it will be
|
71
|
+
# <some module>._utilities. <some module> is the module we want to query the version for.
|
72
|
+
root_package, *rest = __name__.split('.')
|
73
|
+
|
74
|
+
# pkg_resources uses setuptools to inspect the set of installed packages. We use it here to ask
|
75
|
+
# for the currently installed version of the root package (i.e. us) and get its version.
|
76
|
+
|
77
|
+
# Unfortunately, PEP440 and semver differ slightly in incompatible ways. The Pulumi engine expects
|
78
|
+
# to receive a valid semver string when receiving requests from the language host, so it's our
|
79
|
+
# responsibility as the library to convert our own PEP440 version into a valid semver string.
|
80
|
+
|
81
|
+
pep440_version_string = importlib.metadata.version(root_package)
|
82
|
+
pep440_version = PEP440Version.parse(pep440_version_string)
|
83
|
+
(major, minor, patch) = pep440_version.release
|
84
|
+
prerelease = None
|
85
|
+
if pep440_version.pre_tag == 'a':
|
86
|
+
prerelease = f"alpha.{pep440_version.pre}"
|
87
|
+
elif pep440_version.pre_tag == 'b':
|
88
|
+
prerelease = f"beta.{pep440_version.pre}"
|
89
|
+
elif pep440_version.pre_tag == 'rc':
|
90
|
+
prerelease = f"rc.{pep440_version.pre}"
|
91
|
+
elif pep440_version.dev is not None:
|
92
|
+
# PEP440 has explicit support for dev builds, while semver encodes them as "prerelease" versions. To bridge
|
93
|
+
# between the two, we convert our dev build version into a prerelease tag. This matches what all of our other
|
94
|
+
# packages do when constructing their own semver string.
|
95
|
+
prerelease = f"dev.{pep440_version.dev}"
|
96
|
+
elif pep440_version.local is not None:
|
97
|
+
# PEP440 only allows a small set of prerelease tags, so when converting an arbitrary prerelease,
|
98
|
+
# PypiVersion in /pkg/codegen/python/utilities.go converts it to a local version. Therefore, we need to
|
99
|
+
# do the reverse conversion here and set the local version as the prerelease tag.
|
100
|
+
prerelease = pep440_version.local
|
101
|
+
|
102
|
+
return SemverVersion(major=major, minor=minor, patch=patch, prerelease=prerelease)
|
103
|
+
|
104
|
+
|
105
|
+
# Determine the version once and cache the value, which measurably improves program performance.
|
106
|
+
_version = _get_semver_version()
|
107
|
+
_version_str = str(_version)
|
108
|
+
|
109
|
+
def get_resource_opts_defaults() -> pulumi.ResourceOptions:
|
110
|
+
return pulumi.ResourceOptions(
|
111
|
+
version=get_version(),
|
112
|
+
plugin_download_url=get_plugin_download_url(),
|
113
|
+
)
|
114
|
+
|
115
|
+
def get_invoke_opts_defaults() -> pulumi.InvokeOptions:
|
116
|
+
return pulumi.InvokeOptions(
|
117
|
+
version=get_version(),
|
118
|
+
plugin_download_url=get_plugin_download_url(),
|
119
|
+
)
|
120
|
+
|
121
|
+
def get_resource_args_opts(resource_args_type, resource_options_type, *args, **kwargs):
|
122
|
+
"""
|
123
|
+
Return the resource args and options given the *args and **kwargs of a resource's
|
124
|
+
__init__ method.
|
125
|
+
"""
|
126
|
+
|
127
|
+
resource_args, opts = None, None
|
128
|
+
|
129
|
+
# If the first item is the resource args type, save it and remove it from the args list.
|
130
|
+
if args and isinstance(args[0], resource_args_type):
|
131
|
+
resource_args, args = args[0], args[1:]
|
132
|
+
|
133
|
+
# Now look at the first item in the args list again.
|
134
|
+
# If the first item is the resource options class, save it.
|
135
|
+
if args and isinstance(args[0], resource_options_type):
|
136
|
+
opts = args[0]
|
137
|
+
|
138
|
+
# If resource_args is None, see if "args" is in kwargs, and, if so, if it's typed as the
|
139
|
+
# the resource args type.
|
140
|
+
if resource_args is None:
|
141
|
+
a = kwargs.get("args")
|
142
|
+
if isinstance(a, resource_args_type):
|
143
|
+
resource_args = a
|
144
|
+
|
145
|
+
# If opts is None, look it up in kwargs.
|
146
|
+
if opts is None:
|
147
|
+
opts = kwargs.get("opts")
|
148
|
+
|
149
|
+
return resource_args, opts
|
150
|
+
|
151
|
+
|
152
|
+
# Temporary: just use pulumi._utils.lazy_import once everyone upgrades.
|
153
|
+
def lazy_import(fullname):
|
154
|
+
|
155
|
+
import pulumi._utils as u
|
156
|
+
f = getattr(u, 'lazy_import', None)
|
157
|
+
if f is None:
|
158
|
+
f = _lazy_import_temp
|
159
|
+
|
160
|
+
return f(fullname)
|
161
|
+
|
162
|
+
|
163
|
+
# Copied from pulumi._utils.lazy_import, see comments there.
|
164
|
+
def _lazy_import_temp(fullname):
|
165
|
+
m = sys.modules.get(fullname, None)
|
166
|
+
if m is not None:
|
167
|
+
return m
|
168
|
+
|
169
|
+
spec = importlib.util.find_spec(fullname)
|
170
|
+
|
171
|
+
m = sys.modules.get(fullname, None)
|
172
|
+
if m is not None:
|
173
|
+
return m
|
174
|
+
|
175
|
+
loader = importlib.util.LazyLoader(spec.loader)
|
176
|
+
spec.loader = loader
|
177
|
+
module = importlib.util.module_from_spec(spec)
|
178
|
+
|
179
|
+
m = sys.modules.get(fullname, None)
|
180
|
+
if m is not None:
|
181
|
+
return m
|
182
|
+
|
183
|
+
sys.modules[fullname] = module
|
184
|
+
loader.exec_module(module)
|
185
|
+
return module
|
186
|
+
|
187
|
+
|
188
|
+
class Package(pulumi.runtime.ResourcePackage):
|
189
|
+
def __init__(self, pkg_info):
|
190
|
+
super().__init__()
|
191
|
+
self.pkg_info = pkg_info
|
192
|
+
|
193
|
+
def version(self):
|
194
|
+
return _version
|
195
|
+
|
196
|
+
def construct_provider(self, name: str, typ: str, urn: str) -> pulumi.ProviderResource:
|
197
|
+
if typ != self.pkg_info['token']:
|
198
|
+
raise Exception(f"unknown provider type {typ}")
|
199
|
+
Provider = getattr(lazy_import(self.pkg_info['fqn']), self.pkg_info['class'])
|
200
|
+
return Provider(name, pulumi.ResourceOptions(urn=urn))
|
201
|
+
|
202
|
+
|
203
|
+
class Module(pulumi.runtime.ResourceModule):
|
204
|
+
def __init__(self, mod_info):
|
205
|
+
super().__init__()
|
206
|
+
self.mod_info = mod_info
|
207
|
+
|
208
|
+
def version(self):
|
209
|
+
return _version
|
210
|
+
|
211
|
+
def construct(self, name: str, typ: str, urn: str) -> pulumi.Resource:
|
212
|
+
class_name = self.mod_info['classes'].get(typ, None)
|
213
|
+
|
214
|
+
if class_name is None:
|
215
|
+
raise Exception(f"unknown resource type {typ}")
|
216
|
+
|
217
|
+
TheClass = getattr(lazy_import(self.mod_info['fqn']), class_name)
|
218
|
+
return TheClass(name, pulumi.ResourceOptions(urn=urn))
|
219
|
+
|
220
|
+
|
221
|
+
def register(resource_modules, resource_packages):
|
222
|
+
resource_modules = json.loads(resource_modules)
|
223
|
+
resource_packages = json.loads(resource_packages)
|
224
|
+
|
225
|
+
for pkg_info in resource_packages:
|
226
|
+
pulumi.runtime.register_resource_package(pkg_info['pkg'], Package(pkg_info))
|
227
|
+
|
228
|
+
for mod_info in resource_modules:
|
229
|
+
pulumi.runtime.register_resource_module(
|
230
|
+
mod_info['pkg'],
|
231
|
+
mod_info['mod'],
|
232
|
+
Module(mod_info))
|
233
|
+
|
234
|
+
|
235
|
+
_F = typing.TypeVar('_F', bound=typing.Callable[..., typing.Any])
|
236
|
+
|
237
|
+
|
238
|
+
def lift_output_func(func: typing.Any) -> typing.Callable[[_F], _F]:
|
239
|
+
"""Decorator internally used on {fn}_output lifted function versions
|
240
|
+
to implement them automatically from the un-lifted function."""
|
241
|
+
|
242
|
+
func_sig = inspect.signature(func)
|
243
|
+
|
244
|
+
def lifted_func(*args, opts=None, **kwargs):
|
245
|
+
bound_args = func_sig.bind(*args, **kwargs)
|
246
|
+
# Convert tuple to list, see pulumi/pulumi#8172
|
247
|
+
args_list = list(bound_args.args)
|
248
|
+
return pulumi.Output.from_input({
|
249
|
+
'args': args_list,
|
250
|
+
'kwargs': bound_args.kwargs
|
251
|
+
}).apply(lambda resolved_args: func(*resolved_args['args'],
|
252
|
+
opts=opts,
|
253
|
+
**resolved_args['kwargs']))
|
254
|
+
|
255
|
+
return (lambda _: lifted_func)
|
256
|
+
|
257
|
+
|
258
|
+
def call_plain(
|
259
|
+
tok: str,
|
260
|
+
props: pulumi.Inputs,
|
261
|
+
res: typing.Optional[pulumi.Resource] = None,
|
262
|
+
typ: typing.Optional[type] = None,
|
263
|
+
) -> typing.Any:
|
264
|
+
"""
|
265
|
+
Wraps pulumi.runtime.plain to force the output and return it plainly.
|
266
|
+
"""
|
267
|
+
|
268
|
+
output = pulumi.runtime.call(tok, props, res, typ)
|
269
|
+
|
270
|
+
# Ingoring deps silently. They are typically non-empty, r.f() calls include r as a dependency.
|
271
|
+
result, known, secret, _ = _sync_await(asyncio.create_task(_await_output(output)))
|
272
|
+
|
273
|
+
problem = None
|
274
|
+
if not known:
|
275
|
+
problem = ' an unknown value'
|
276
|
+
elif secret:
|
277
|
+
problem = ' a secret value'
|
278
|
+
|
279
|
+
if problem:
|
280
|
+
raise AssertionError(
|
281
|
+
f"Plain resource method '{tok}' incorrectly returned {problem}. "
|
282
|
+
+ "This is an error in the provider, please report this to the provider developer."
|
283
|
+
)
|
284
|
+
|
285
|
+
return result
|
286
|
+
|
287
|
+
|
288
|
+
async def _await_output(o: pulumi.Output[typing.Any]) -> typing.Tuple[object, bool, bool, set]:
|
289
|
+
return (
|
290
|
+
await o._future,
|
291
|
+
await o._is_known,
|
292
|
+
await o._is_secret,
|
293
|
+
await o._resources,
|
294
|
+
)
|
295
|
+
|
296
|
+
|
297
|
+
# This is included to provide an upgrade path for users who are using a version
|
298
|
+
# of the Pulumi SDK (<3.121.0) that does not include the `deprecated` decorator.
|
299
|
+
def deprecated(message: str) -> typing.Callable[[C], C]:
|
300
|
+
"""
|
301
|
+
Decorator to indicate a function is deprecated.
|
302
|
+
|
303
|
+
As well as inserting appropriate statements to indicate that the function is
|
304
|
+
deprecated, this decorator also tags the function with a special attribute
|
305
|
+
so that Pulumi code can detect that it is deprecated and react appropriately
|
306
|
+
in certain situations.
|
307
|
+
|
308
|
+
message is the deprecation message that should be printed if the function is called.
|
309
|
+
"""
|
310
|
+
|
311
|
+
def decorator(fn: C) -> C:
|
312
|
+
if not callable(fn):
|
313
|
+
raise TypeError("Expected fn to be callable")
|
314
|
+
|
315
|
+
@functools.wraps(fn)
|
316
|
+
def deprecated_fn(*args, **kwargs):
|
317
|
+
warnings.warn(message)
|
318
|
+
pulumi.warn(f"{fn.__name__} is deprecated: {message}")
|
319
|
+
|
320
|
+
return fn(*args, **kwargs)
|
321
|
+
|
322
|
+
deprecated_fn.__dict__["_pulumi_deprecated_callable"] = fn
|
323
|
+
return typing.cast(C, deprecated_fn)
|
324
|
+
|
325
|
+
return decorator
|
326
|
+
|
327
|
+
def get_plugin_download_url():
|
328
|
+
return None
|
329
|
+
|
330
|
+
def get_version():
|
331
|
+
return _version_str
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
3
|
+
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
4
|
+
|
5
|
+
import builtins
|
6
|
+
import copy
|
7
|
+
import warnings
|
8
|
+
import sys
|
9
|
+
import pulumi
|
10
|
+
import pulumi.runtime
|
11
|
+
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
12
|
+
if sys.version_info >= (3, 11):
|
13
|
+
from typing import NotRequired, TypedDict, TypeAlias
|
14
|
+
else:
|
15
|
+
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
16
|
+
from . import _utilities
|
17
|
+
|
18
|
+
__all__ = ['ProviderArgs', 'Provider']
|
19
|
+
|
20
|
+
@pulumi.input_type
|
21
|
+
class ProviderArgs:
|
22
|
+
def __init__(__self__):
|
23
|
+
"""
|
24
|
+
The set of arguments for constructing a Provider resource.
|
25
|
+
"""
|
26
|
+
pass
|
27
|
+
|
28
|
+
|
29
|
+
class Provider(pulumi.ProviderResource):
|
30
|
+
@overload
|
31
|
+
def __init__(__self__,
|
32
|
+
resource_name: str,
|
33
|
+
opts: Optional[pulumi.ResourceOptions] = None,
|
34
|
+
__props__=None):
|
35
|
+
"""
|
36
|
+
Create a Terraform resource with the given unique name, props, and options.
|
37
|
+
:param str resource_name: The name of the resource.
|
38
|
+
:param pulumi.ResourceOptions opts: Options for the resource.
|
39
|
+
"""
|
40
|
+
...
|
41
|
+
@overload
|
42
|
+
def __init__(__self__,
|
43
|
+
resource_name: str,
|
44
|
+
args: Optional[ProviderArgs] = None,
|
45
|
+
opts: Optional[pulumi.ResourceOptions] = None):
|
46
|
+
"""
|
47
|
+
Create a Terraform resource with the given unique name, props, and options.
|
48
|
+
:param str resource_name: The name of the resource.
|
49
|
+
:param ProviderArgs args: The arguments to use to populate this resource's properties.
|
50
|
+
:param pulumi.ResourceOptions opts: Options for the resource.
|
51
|
+
"""
|
52
|
+
...
|
53
|
+
def __init__(__self__, resource_name: str, *args, **kwargs):
|
54
|
+
resource_args, opts = _utilities.get_resource_args_opts(ProviderArgs, pulumi.ResourceOptions, *args, **kwargs)
|
55
|
+
if resource_args is not None:
|
56
|
+
__self__._internal_init(resource_name, opts, **resource_args.__dict__)
|
57
|
+
else:
|
58
|
+
__self__._internal_init(resource_name, *args, **kwargs)
|
59
|
+
|
60
|
+
def _internal_init(__self__,
|
61
|
+
resource_name: str,
|
62
|
+
opts: Optional[pulumi.ResourceOptions] = None,
|
63
|
+
__props__=None):
|
64
|
+
opts = pulumi.ResourceOptions.merge(_utilities.get_resource_opts_defaults(), opts)
|
65
|
+
if not isinstance(opts, pulumi.ResourceOptions):
|
66
|
+
raise TypeError('Expected resource options to be a ResourceOptions instance')
|
67
|
+
if opts.id is None:
|
68
|
+
if __props__ is not None:
|
69
|
+
raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource')
|
70
|
+
__props__ = ProviderArgs.__new__(ProviderArgs)
|
71
|
+
|
72
|
+
super(Provider, __self__).__init__(
|
73
|
+
'terraform',
|
74
|
+
resource_name,
|
75
|
+
__props__,
|
76
|
+
opts)
|
77
|
+
|
File without changes
|
@@ -0,0 +1,11 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
3
|
+
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
4
|
+
|
5
|
+
import builtins
|
6
|
+
from .. import _utilities
|
7
|
+
import typing
|
8
|
+
# Export this package's modules as members:
|
9
|
+
from .get_local_reference import *
|
10
|
+
from .get_remote_reference import *
|
11
|
+
from ._inputs import *
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
3
|
+
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
4
|
+
|
5
|
+
import builtins
|
6
|
+
import copy
|
7
|
+
import warnings
|
8
|
+
import sys
|
9
|
+
import pulumi
|
10
|
+
import pulumi.runtime
|
11
|
+
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
12
|
+
if sys.version_info >= (3, 11):
|
13
|
+
from typing import NotRequired, TypedDict, TypeAlias
|
14
|
+
else:
|
15
|
+
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
16
|
+
from .. import _utilities
|
17
|
+
|
18
|
+
__all__ = [
|
19
|
+
'Workspaces',
|
20
|
+
'WorkspacesDict',
|
21
|
+
]
|
22
|
+
|
23
|
+
MYPY = False
|
24
|
+
|
25
|
+
if not MYPY:
|
26
|
+
class WorkspacesDict(TypedDict):
|
27
|
+
name: NotRequired[builtins.str]
|
28
|
+
"""
|
29
|
+
The full name of one remote workspace. When configured, only the default workspace can be used. This option conflicts with prefix.
|
30
|
+
"""
|
31
|
+
prefix: NotRequired[builtins.str]
|
32
|
+
"""
|
33
|
+
A prefix used in the names of one or more remote workspaces, all of which can be used with this configuration. The full workspace names are used in HCP Terraform, and the short names (minus the prefix) are used on the command line for Terraform CLI workspaces. If omitted, only the default workspace can be used. This option conflicts with name.
|
34
|
+
"""
|
35
|
+
elif False:
|
36
|
+
WorkspacesDict: TypeAlias = Mapping[str, Any]
|
37
|
+
|
38
|
+
@pulumi.input_type
|
39
|
+
class Workspaces:
|
40
|
+
def __init__(__self__, *,
|
41
|
+
name: Optional[builtins.str] = None,
|
42
|
+
prefix: Optional[builtins.str] = None):
|
43
|
+
"""
|
44
|
+
:param builtins.str name: The full name of one remote workspace. When configured, only the default workspace can be used. This option conflicts with prefix.
|
45
|
+
:param builtins.str prefix: A prefix used in the names of one or more remote workspaces, all of which can be used with this configuration. The full workspace names are used in HCP Terraform, and the short names (minus the prefix) are used on the command line for Terraform CLI workspaces. If omitted, only the default workspace can be used. This option conflicts with name.
|
46
|
+
"""
|
47
|
+
if name is not None:
|
48
|
+
pulumi.set(__self__, "name", name)
|
49
|
+
if prefix is not None:
|
50
|
+
pulumi.set(__self__, "prefix", prefix)
|
51
|
+
|
52
|
+
@property
|
53
|
+
@pulumi.getter
|
54
|
+
def name(self) -> Optional[builtins.str]:
|
55
|
+
"""
|
56
|
+
The full name of one remote workspace. When configured, only the default workspace can be used. This option conflicts with prefix.
|
57
|
+
"""
|
58
|
+
return pulumi.get(self, "name")
|
59
|
+
|
60
|
+
@name.setter
|
61
|
+
def name(self, value: Optional[builtins.str]):
|
62
|
+
pulumi.set(self, "name", value)
|
63
|
+
|
64
|
+
@property
|
65
|
+
@pulumi.getter
|
66
|
+
def prefix(self) -> Optional[builtins.str]:
|
67
|
+
"""
|
68
|
+
A prefix used in the names of one or more remote workspaces, all of which can be used with this configuration. The full workspace names are used in HCP Terraform, and the short names (minus the prefix) are used on the command line for Terraform CLI workspaces. If omitted, only the default workspace can be used. This option conflicts with name.
|
69
|
+
"""
|
70
|
+
return pulumi.get(self, "prefix")
|
71
|
+
|
72
|
+
@prefix.setter
|
73
|
+
def prefix(self, value: Optional[builtins.str]):
|
74
|
+
pulumi.set(self, "prefix", value)
|
75
|
+
|
76
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
3
|
+
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
4
|
+
|
5
|
+
import builtins
|
6
|
+
import copy
|
7
|
+
import warnings
|
8
|
+
import sys
|
9
|
+
import pulumi
|
10
|
+
import pulumi.runtime
|
11
|
+
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
12
|
+
if sys.version_info >= (3, 11):
|
13
|
+
from typing import NotRequired, TypedDict, TypeAlias
|
14
|
+
else:
|
15
|
+
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
16
|
+
from .. import _utilities
|
17
|
+
|
18
|
+
__all__ = [
|
19
|
+
'GetLocalReferenceResult',
|
20
|
+
'AwaitableGetLocalReferenceResult',
|
21
|
+
'get_local_reference',
|
22
|
+
'get_local_reference_output',
|
23
|
+
]
|
24
|
+
|
25
|
+
@pulumi.output_type
|
26
|
+
class GetLocalReferenceResult:
|
27
|
+
"""
|
28
|
+
The result of fetching from a Terraform state store.
|
29
|
+
"""
|
30
|
+
def __init__(__self__, outputs=None):
|
31
|
+
if outputs and not isinstance(outputs, dict):
|
32
|
+
raise TypeError("Expected argument 'outputs' to be a dict")
|
33
|
+
pulumi.set(__self__, "outputs", outputs)
|
34
|
+
|
35
|
+
@property
|
36
|
+
@pulumi.getter
|
37
|
+
def outputs(self) -> Mapping[str, Any]:
|
38
|
+
"""
|
39
|
+
The outputs displayed from Terraform state.
|
40
|
+
"""
|
41
|
+
return pulumi.get(self, "outputs")
|
42
|
+
|
43
|
+
|
44
|
+
class AwaitableGetLocalReferenceResult(GetLocalReferenceResult):
|
45
|
+
# pylint: disable=using-constant-test
|
46
|
+
def __await__(self):
|
47
|
+
if False:
|
48
|
+
yield self
|
49
|
+
return GetLocalReferenceResult(
|
50
|
+
outputs=self.outputs)
|
51
|
+
|
52
|
+
|
53
|
+
def get_local_reference(path: Optional[builtins.str] = None,
|
54
|
+
workspace_dir: Optional[builtins.str] = None,
|
55
|
+
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetLocalReferenceResult:
|
56
|
+
"""
|
57
|
+
Access state from the local filesystem.
|
58
|
+
|
59
|
+
|
60
|
+
:param builtins.str path: The path to the tfstate file. This defaults to "terraform.tfstate" relative to the root module by default.
|
61
|
+
:param builtins.str workspace_dir: The path to non-default workspaces.
|
62
|
+
"""
|
63
|
+
__args__ = dict()
|
64
|
+
__args__['path'] = path
|
65
|
+
__args__['workspaceDir'] = workspace_dir
|
66
|
+
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
|
67
|
+
__ret__ = pulumi.runtime.invoke('terraform:state:getLocalReference', __args__, opts=opts, typ=GetLocalReferenceResult).value
|
68
|
+
|
69
|
+
return AwaitableGetLocalReferenceResult(
|
70
|
+
outputs=pulumi.get(__ret__, 'outputs'))
|
71
|
+
def get_local_reference_output(path: Optional[pulumi.Input[Optional[builtins.str]]] = None,
|
72
|
+
workspace_dir: Optional[pulumi.Input[Optional[builtins.str]]] = None,
|
73
|
+
opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetLocalReferenceResult]:
|
74
|
+
"""
|
75
|
+
Access state from the local filesystem.
|
76
|
+
|
77
|
+
|
78
|
+
:param builtins.str path: The path to the tfstate file. This defaults to "terraform.tfstate" relative to the root module by default.
|
79
|
+
:param builtins.str workspace_dir: The path to non-default workspaces.
|
80
|
+
"""
|
81
|
+
__args__ = dict()
|
82
|
+
__args__['path'] = path
|
83
|
+
__args__['workspaceDir'] = workspace_dir
|
84
|
+
opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
|
85
|
+
__ret__ = pulumi.runtime.invoke_output('terraform:state:getLocalReference', __args__, opts=opts, typ=GetLocalReferenceResult)
|
86
|
+
return __ret__.apply(lambda __response__: GetLocalReferenceResult(
|
87
|
+
outputs=pulumi.get(__response__, 'outputs')))
|
@@ -0,0 +1,98 @@
|
|
1
|
+
# coding=utf-8
|
2
|
+
# *** WARNING: this file was generated by pulumi-language-python. ***
|
3
|
+
# *** Do not edit by hand unless you're certain you know what you are doing! ***
|
4
|
+
|
5
|
+
import builtins
|
6
|
+
import copy
|
7
|
+
import warnings
|
8
|
+
import sys
|
9
|
+
import pulumi
|
10
|
+
import pulumi.runtime
|
11
|
+
from typing import Any, Mapping, Optional, Sequence, Union, overload
|
12
|
+
if sys.version_info >= (3, 11):
|
13
|
+
from typing import NotRequired, TypedDict, TypeAlias
|
14
|
+
else:
|
15
|
+
from typing_extensions import NotRequired, TypedDict, TypeAlias
|
16
|
+
from .. import _utilities
|
17
|
+
from ._inputs import *
|
18
|
+
|
19
|
+
__all__ = [
|
20
|
+
'GetRemoteReferenceResult',
|
21
|
+
'AwaitableGetRemoteReferenceResult',
|
22
|
+
'get_remote_reference',
|
23
|
+
'get_remote_reference_output',
|
24
|
+
]
|
25
|
+
|
26
|
+
@pulumi.output_type
|
27
|
+
class GetRemoteReferenceResult:
|
28
|
+
"""
|
29
|
+
The result of fetching from a Terraform state store.
|
30
|
+
"""
|
31
|
+
def __init__(__self__, outputs=None):
|
32
|
+
if outputs and not isinstance(outputs, dict):
|
33
|
+
raise TypeError("Expected argument 'outputs' to be a dict")
|
34
|
+
pulumi.set(__self__, "outputs", outputs)
|
35
|
+
|
36
|
+
@property
|
37
|
+
@pulumi.getter
|
38
|
+
def outputs(self) -> Mapping[str, Any]:
|
39
|
+
"""
|
40
|
+
The outputs displayed from Terraform state.
|
41
|
+
"""
|
42
|
+
return pulumi.get(self, "outputs")
|
43
|
+
|
44
|
+
|
45
|
+
class AwaitableGetRemoteReferenceResult(GetRemoteReferenceResult):
|
46
|
+
# pylint: disable=using-constant-test
|
47
|
+
def __await__(self):
|
48
|
+
if False:
|
49
|
+
yield self
|
50
|
+
return GetRemoteReferenceResult(
|
51
|
+
outputs=self.outputs)
|
52
|
+
|
53
|
+
|
54
|
+
def get_remote_reference(hostname: Optional[builtins.str] = None,
|
55
|
+
organization: Optional[builtins.str] = None,
|
56
|
+
token: Optional[builtins.str] = None,
|
57
|
+
workspaces: Optional[Union['Workspaces', 'WorkspacesDict']] = None,
|
58
|
+
opts: Optional[pulumi.InvokeOptions] = None) -> AwaitableGetRemoteReferenceResult:
|
59
|
+
"""
|
60
|
+
Access state from a remote backend.
|
61
|
+
|
62
|
+
|
63
|
+
:param builtins.str hostname: The remote backend hostname to connect to.
|
64
|
+
:param builtins.str organization: The name of the organization containing the targeted workspace(s).
|
65
|
+
:param builtins.str token: The token used to authenticate with the remote backend.
|
66
|
+
"""
|
67
|
+
__args__ = dict()
|
68
|
+
__args__['hostname'] = hostname
|
69
|
+
__args__['organization'] = organization
|
70
|
+
__args__['token'] = token
|
71
|
+
__args__['workspaces'] = workspaces
|
72
|
+
opts = pulumi.InvokeOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
|
73
|
+
__ret__ = pulumi.runtime.invoke('terraform:state:getRemoteReference', __args__, opts=opts, typ=GetRemoteReferenceResult).value
|
74
|
+
|
75
|
+
return AwaitableGetRemoteReferenceResult(
|
76
|
+
outputs=pulumi.get(__ret__, 'outputs'))
|
77
|
+
def get_remote_reference_output(hostname: Optional[pulumi.Input[Optional[builtins.str]]] = None,
|
78
|
+
organization: Optional[pulumi.Input[builtins.str]] = None,
|
79
|
+
token: Optional[pulumi.Input[Optional[builtins.str]]] = None,
|
80
|
+
workspaces: Optional[pulumi.Input[Union['Workspaces', 'WorkspacesDict']]] = None,
|
81
|
+
opts: Optional[Union[pulumi.InvokeOptions, pulumi.InvokeOutputOptions]] = None) -> pulumi.Output[GetRemoteReferenceResult]:
|
82
|
+
"""
|
83
|
+
Access state from a remote backend.
|
84
|
+
|
85
|
+
|
86
|
+
:param builtins.str hostname: The remote backend hostname to connect to.
|
87
|
+
:param builtins.str organization: The name of the organization containing the targeted workspace(s).
|
88
|
+
:param builtins.str token: The token used to authenticate with the remote backend.
|
89
|
+
"""
|
90
|
+
__args__ = dict()
|
91
|
+
__args__['hostname'] = hostname
|
92
|
+
__args__['organization'] = organization
|
93
|
+
__args__['token'] = token
|
94
|
+
__args__['workspaces'] = workspaces
|
95
|
+
opts = pulumi.InvokeOutputOptions.merge(_utilities.get_invoke_opts_defaults(), opts)
|
96
|
+
__ret__ = pulumi.runtime.invoke_output('terraform:state:getRemoteReference', __args__, opts=opts, typ=GetRemoteReferenceResult)
|
97
|
+
return __ret__.apply(lambda __response__: GetRemoteReferenceResult(
|
98
|
+
outputs=pulumi.get(__response__, 'outputs')))
|
@@ -0,0 +1,117 @@
|
|
1
|
+
Metadata-Version: 2.4
|
2
|
+
Name: pulumi_terraform
|
3
|
+
Version: 6.0.0
|
4
|
+
Summary: The Terraform provider for Pulumi lets you consume the outputs contained in Terraform state from your Pulumi programs.
|
5
|
+
License: Apache-2.0
|
6
|
+
Project-URL: Homepage, https://pulumi.com
|
7
|
+
Project-URL: Repository, https://github.com/pulumi/pulumi-terraform
|
8
|
+
Keywords: terraform,kind/native,category/utility
|
9
|
+
Requires-Python: >=3.9
|
10
|
+
Description-Content-Type: text/markdown
|
11
|
+
Requires-Dist: parver>=0.2.1
|
12
|
+
Requires-Dist: pulumi<4.0.0,>=3.142.0
|
13
|
+
Requires-Dist: semver>=2.8.1
|
14
|
+
Requires-Dist: typing-extensions>=4.11; python_version < "3.11"
|
15
|
+
|
16
|
+
# Pulumi Terraform Provider
|
17
|
+
|
18
|
+
The Terraform resource provider for Pulumi lets you consume the outputs
|
19
|
+
contained in Terraform state files from your Pulumi programs. The package
|
20
|
+
provides a `RemoteStateReference` resource which acts like a native Pulumi
|
21
|
+
[`StackReference`][stackreference].
|
22
|
+
|
23
|
+
To use this package, please [install the Pulumi CLI first][pulumicli].
|
24
|
+
|
25
|
+
## Installing
|
26
|
+
|
27
|
+
### Node.js (JavaScript/TypeScript)
|
28
|
+
|
29
|
+
To use from JavaScript or TypeScript in Node.js, install using either `npm`:
|
30
|
+
|
31
|
+
$ npm install @pulumi/terraform
|
32
|
+
|
33
|
+
or `yarn`:
|
34
|
+
|
35
|
+
$ yarn add @pulumi/terraform
|
36
|
+
|
37
|
+
### Python
|
38
|
+
|
39
|
+
To use from Python, install using `pip`:
|
40
|
+
|
41
|
+
$ pip install pulumi-terraform
|
42
|
+
|
43
|
+
## Concepts
|
44
|
+
|
45
|
+
The `@pulumi/terraform` package provides a [resource](https://www.pulumi.com/docs/concepts/resources/) named `RemoteStateReference`
|
46
|
+
which is used to read outputs from a Terraform state file stored in one of the supported
|
47
|
+
Terraform remote state backends.
|
48
|
+
|
49
|
+
## Examples
|
50
|
+
|
51
|
+
### S3
|
52
|
+
|
53
|
+
The following program will read a Terraform state file stored in S3:
|
54
|
+
|
55
|
+
```typescript
|
56
|
+
import * as tf from "@pulumi/terraform";
|
57
|
+
|
58
|
+
const remoteState = new tf.state.RemoteStateReference("s3state", {
|
59
|
+
backendType: "s3",
|
60
|
+
bucket: "pulumi-terraform-state-test",
|
61
|
+
key: "test/terraform.tfstate",
|
62
|
+
region: "us-west-2"
|
63
|
+
});
|
64
|
+
|
65
|
+
// Use the getOutput function on the resource to access root outputs
|
66
|
+
const vpcId= remoteState.getOutput("vpc_id");
|
67
|
+
```
|
68
|
+
|
69
|
+
### Local file
|
70
|
+
|
71
|
+
The following program will read a Terraform state file stored locally in the
|
72
|
+
filesystem:
|
73
|
+
|
74
|
+
```typescript
|
75
|
+
import * as tf from "@pulumi/terraform";
|
76
|
+
|
77
|
+
const remotestate = new tf.state.RemoteStateReference("localstate", {
|
78
|
+
backendType: "local",
|
79
|
+
path: path.join(__dirname, "terraform.tfstate"),
|
80
|
+
});
|
81
|
+
|
82
|
+
// Use the getOutput function on the resource to access root outputs
|
83
|
+
const vpcId= remoteState.getOutput("vpc_id");
|
84
|
+
```
|
85
|
+
|
86
|
+
### Terraform Enterprise
|
87
|
+
|
88
|
+
For state stored in Terraform Enterprise, the authentication token must be set
|
89
|
+
via the Pulumi configuration system - for example, using:
|
90
|
+
|
91
|
+
pulumi config set --secret terraformEnterpriseToken <value>
|
92
|
+
|
93
|
+
The following program will read a Terraform state file stored in Terraform
|
94
|
+
Enterprise, using the value of `terraformEnterpriseToken` from above:
|
95
|
+
|
96
|
+
```typescript
|
97
|
+
import * as pulumi from "@pulumi/pulumi";
|
98
|
+
import * as tf from "@pulumi/terraform";
|
99
|
+
|
100
|
+
const config = new pulumi.Config();
|
101
|
+
|
102
|
+
const ref = new tf.state.RemoteStateReference("remote", {
|
103
|
+
backendType: "remote",
|
104
|
+
organization: "pulumi",
|
105
|
+
token: config.requireSecret("terraformEnterpriseToken"),
|
106
|
+
workspaces: {
|
107
|
+
name: "test-state-file"
|
108
|
+
}
|
109
|
+
});
|
110
|
+
|
111
|
+
// Use the getOutput function on the resource to access root outputs
|
112
|
+
const vpcId= remoteState.getOutput("vpc_id");
|
113
|
+
```
|
114
|
+
|
115
|
+
[stackreference]: https://www.pulumi.com/docs/reference/organizing-stacks-projects/#inter-stack-dependencies
|
116
|
+
[pulumicli]: https://pulumi.com/
|
117
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
pulumi_terraform/__init__.py,sha256=ZKaNSfrrEzsIhfem0AhtgdUBrvd27vo24FXn4gRLcEY,689
|
2
|
+
pulumi_terraform/_utilities.py,sha256=66uLGQDI1oMFOI3Fe5igAphtexWhcSLDyuVW50jW3ik,10789
|
3
|
+
pulumi_terraform/provider.py,sha256=Woo4KoAlaORJ8X27QKeM0E0ja3ixQuiQJTkJyPJbKkU,2931
|
4
|
+
pulumi_terraform/pulumi-plugin.json,sha256=a_RYcVn731_sy-9H3lAjSImE-S-pWvO1YzGdDY7Oxaw,68
|
5
|
+
pulumi_terraform/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
pulumi_terraform/state/__init__.py,sha256=Ar2NX3_dORSCL7Qcz1J68WwrdBM9oPergv_4GfBSxf0,361
|
7
|
+
pulumi_terraform/state/_inputs.py,sha256=lX3T_oxYe1Z0bwO-M4TLsZNITtm0iz0TEw_cc4WNXxE,3240
|
8
|
+
pulumi_terraform/state/get_local_reference.py,sha256=6Wc7zO8VgbUIClHgz9e1Dx4frXdNBPWGC17OrN3HEHs,3425
|
9
|
+
pulumi_terraform/state/get_remote_reference.py,sha256=S43jNUWM1lWhU4HYiSwigPgUhhw9O6usgKZSO_eZu4g,4090
|
10
|
+
pulumi_terraform-6.0.0.dist-info/METADATA,sha256=AqwKYaXGFi1VnowyxM-MgcivETUff8koFOFcWWG9au4,3431
|
11
|
+
pulumi_terraform-6.0.0.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
12
|
+
pulumi_terraform-6.0.0.dist-info/top_level.txt,sha256=mQHWBkiLSwbC0GLgDIZQUFXyWbV-9C15VFPow5RFqUE,17
|
13
|
+
pulumi_terraform-6.0.0.dist-info/RECORD,,
|
@@ -0,0 +1 @@
|
|
1
|
+
pulumi_terraform
|