Skip to content

Latest commit

 

History

History

pulumi-ts-map-string-string

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Pulumi TypeScript Map Output Empty Issue

Pulumi TypeScript Output Map<string,string> Issue. console.log shows map output in Diagnostics section

Running the App

  1. Create a new stack

    pulumi stack init dev
  2. Restore npm dependencies

    npm install
  3. Run pulumi up and deploy the changes by selecting y

    Updating (dev)
    
    View Live: https://app.pulumi.com/myuser/pulumi-ts-map-string-string/dev/updates/1
    
        Type                                        Name                             Status              
    +   pulumi:pulumi:Stack                         pulumi-ts-map-string-string-dev  created (0.45s)     
    +   └─ pkg:index:K8sExternalSecretsDeployments  foo-testtestest                  created (0.43s)     
    
    Resources:
        + 2 created
    
    Duration: 2s
  4. View the outputs.

    pulumi stack output

    Results

     Current stack outputs (1):
         OUTPUT      VALUE
         someMapVar  {}

    Note This is empty due to the following reason.

    For something to be used as an output, it’s JSON.stringify’d. For maps, this is always {} IIRC. When printing to the console, node uses some special formatters which intercepts map types and does a pretty print on them - which is different to serializing to JSON.

    When writing to an output .. just use Object.fromEntries(map.entries()) This requires the ES2019 lib in the tsconfig to work

    we don't support the JS container objects Map and Set for serialization. Likely easier to use this than remembering to convert:

    public readonly somethingMapVar: Record<string, string>;
  5. Destroy the stack

    pulumi stack destroy -y
  6. Remove the stack. This will remove the Pulumi.dev.yaml file

    pulumi stack rm