pulumi/sdk/nodejs/tests/automation/data/import
Zaid Ajaj bbc9c6d0d5
[autmation/nodejs] Implement Stack.import() to specify and import resources into a stack (#16615)
Addressing https://github.com/pulumi/pulumi/issues/8237 starting with
NodeJS

This PR implements `Stack.import(...)` in NodeJS automation API and
allows the user to specify resources and other import options to perform
the import. Here is an example of how it looks like from the user's
perspective:
```ts
// importing resources from a list of import definitions
// can also specify nameTable: { ... }
const result = await stack.import({
    protect: false,
    resources: [
        {  
            type: "random:index/randomPassword:RandomPassword",
            name: "randomPassword",
            id: "supersecret"
        }
    ]
})

// see the generated code from the import
console.log(result.generatedCode)
```
In addition to specifying resources, we can also specify a converter to
import resources with:
```ts
// pulumi import --from terraform ./tfstate.json
const result = await stack.import({
    converter: "terraform",
    converterArgs: "./tfstate.json" 
})
```

> I've used `converter` and `converterArgs` as opposed to `from` and
`fromArgs` because `fromArgs` sounds a bit weird and `converter` makes
sense because we are using a converter. We could say `fromConverter` and
`fromConverterArgs` but that sounds like a mouthful
2024-07-24 14:58:12 +00:00
..
Pulumi.yaml [autmation/nodejs] Implement Stack.import() to specify and import resources into a stack (#16615) 2024-07-24 14:58:12 +00:00
expected_generated_code.txt [autmation/nodejs] Implement Stack.import() to specify and import resources into a stack (#16615) 2024-07-24 14:58:12 +00:00