```I'm trying to use structured config w/pulumi 1....
# general
i
Copy code
I'm trying to use structured config w/pulumi 1.8.1 and not getting anywhere, I keep getting invalid JSON errors: 
config:
The error I’m getting is: Error: Configuration ‘test:repos’ value ‘[object Object],[object Object]’ is not a valid JSON object
If I remove the list of items and just use a single entry that also doesn’t work
a
If you're using TypeScript, I believe you need to define an interface for the object in order for requireObject to know how to construct it. For example, if you define an interface myType, you then call requireObject<myType>, or if your config has a list of those objects, requireObject<myType[]>. This page gives a good example of how to get objects from the config file in various languages: https://www.pulumi.com/docs/intro/concepts/config/#structured-configuration
i
Yep, tried that. No love from Pulumi.
Replacing YAML w/a JSON string DOES work though
obviously w/slightly different config syntax
a
hmmm, maybe it's a bug 🤔
I think the yaml format works if you have a setup like this: Pulumi.<stack>.yaml:
Copy code
config:
  aws:region: us-east-1
  configtest:app-names: |-
    foo-app
  configtest:repos:
    - name: "root"
      account: "xxxxx"
      untaggedExpireDays: 7
      mutableTags: true
      trustRelationships: [ "xxxxx", "xxxxx", "xxxxx", "xxxxx", "xxxxx" ]
    - name: "dev"
      account: "xxxxx"
      untaggedExpireDays: 14
      mutableTags: true
      trustRelationships: [ "xxxxx", "xxxxx", "xxxxx", "xxxxx", "xxxxx" ]
index.ts:
Copy code
import * as pulumi from "@pulumi/pulumi";

interface Repo {
    name: string,
    account: string,
    untaggedExpireDays: number,
    mutableTags: boolean,
    trustRelationships: string[]
}

const config = new pulumi.Config();
const objects = config.requireObject<Repo[]>("repos");

console.log(objects);
i
ok, i’ll try again. thanks!