https://pulumi.com logo
#general
Title
# general
g

gifted-island-55702

01/11/2019, 1:22 PM
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

stocky-spoon-28903

01/11/2019, 3:15 PM
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

gifted-island-55702

01/11/2019, 5:22 PM
Thank you @stocky-spoon-28903 - now it’s clear to me 🙂
3 Views