Skip to content

Commit b53fad1

Browse files
committed
tf module example included
1 parent dc4e111 commit b53fad1

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

docs/pulumi.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,50 @@ pulumi.export("vpc_name", vpc.name)
418418
pulumi.export("subnet_id", vpc_subnet.id)
419419
pulumi.export("ocp_cluster_id", cluster.id)
420420
421+
```
422+
423+
</details>
424+
425+
<details>
426+
<summary> Example 4: Use existing Terraform IBM Modules (TIM) to create Watson Discovery instance</summary>
427+
<br/>
428+
429+
In order to use a Terraform module in Pulumi, first add it to your project using the `pulumi package add` command. Refer [here](https://www.pulumi.com/docs/iac/guides/building-extending/using-existing-tools/use-terraform-module/) for more information.
430+
431+
```sh
432+
pulumi package add terraform-module <module-source> [<version>] <pulumi-package-name>
433+
```
434+
435+
This will generate a local SDK which can be imported in the Pulumi program.
436+
437+
So, the Watson discovery package can be added as:
438+
439+
```sh
440+
pulumi package add terraform-module terraform-ibm-modules/watsonx-discovery/ibm v1.11.1 wx-discovery
441+
```
442+
443+
```py
444+
import pulumi
445+
import pulumi_ibm as ibm
446+
import pulumi_wx_discovery as wxd_mod
447+
448+
449+
config = pulumi.Config()
450+
451+
wxd = wxd_mod.Module(
452+
"my-wxd-resource",
453+
resource_group_id=config.get("resource-group"),
454+
watson_discovery_name = "my-wxd",
455+
)
456+
457+
# Show outputs
458+
pulumi.export("account_id", wxd.account_id)
459+
pulumi.export("wxd_id", wxd.id)
460+
pulumi.export("crn", wxd.crn)
461+
pulumi.export("plan_id", wxd.plan_id)
462+
pulumi.export("dashboard_url", wxd.dashboard_url)
463+
464+
421465
```
422466
423467
</details>

0 commit comments

Comments
 (0)