Hi all. In terraform I can create multiple tf file...
# general
g
Hi all. In terraform I can create multiple tf files in a single directory to segregate different resources instead of storing them in one big file. How this could be achieved with Pulumi using typescript? Is it documented somewhere?
s
Hi @gifted-island-55702! You can have multiple typescript files and then import the resources between them. Most of the examples in the examples repo don’t seem to show this but you could do something like:
Copy code
$ cat cluster.ts
import * as aws from "@pulumi/aws"

export const myCluster = new aws.ecs.Cluster("name", { /* opts */ });
Copy code
$ cat index.ts
import * as cluster from "./cluster";

/*
or for binding to particular names:

import { myCluster } from "./cluster";
*/
There’s a good example of how to do this in the
gcp-ts-gke
example, here: https://github.com/pulumi/examples/tree/master/gcp-ts-gke
g
Thank you @stocky-spoon-28903 - now it’s clear to me 🙂