Hi All, I'm a noob to typescript but have a bit of...
# general
a
Hi All, I'm a noob to typescript but have a bit of experience with pulumi. I'm trying to find a way to define an array in my stack yaml (Pulumi.int.yaml) and reference the array within a class and pass it as an array to azure.network.Subnet. eg. My class looks like
Copy code
export class subNet {
    constructor(name: string) {
        const data = new azure.network.Subnet("data", {
            addressPrefixes: [config.require('datasubnetrange')],
            enforcePrivateLinkEndpointNetworkPolicies: true,
            name: "data",
            resourceGroupName: "dpc-spi-networking-"+config.require('envid')+"-rg-aue-"+config.require('index'),
            serviceEndpoints: [
                //"Microsoft.KeyVault",
                //"Microsoft.AzureActiveDirectory",
                //"Microsoft.Storage",
                //"Microsoft.Sql",
                config.require('serviceEndpoints')
            ],
            virtualNetworkName: "dpc-vnet-spi-"+config.require('envid')+"-aue-"+config.require('index'),
        }, {
            protect: true,
        });
    }
}
My stack yaml will look something like
Copy code
env:serviceEndpoints:
    - Microsoft.KeyVault
    - Microsoft.AzureActiveDirectory
    - Microsoft.Storage
    - Microsoft.Sql
I've tried everything I can think of. Any help would be greatly appreciated.
q
config.requireObject("serviceEndpoints")
should do the trick.
Specifically, you'd have to do this:
Copy code
serviceEndpoints: config.requireObject('serviceEndpoints'),
🙌 1
a
Brilliant. Thanks @quaint-bird-18760
👍 1