I have been trying for a ridiculous amount of time...
# getting-started
c
I have been trying for a ridiculous amount of time now to use an array in config in Pulumi.yaml and cannot get anything to work when I try using pulumi up. How am I meant to get this to work? // Pulumi.yaml
Copy code
name: my-site
runtime: nodejs
main: ./index.ts
config:
    aws:region: us-east-1
    domain: <http://robcarr.net|robcarr.net>
    tags:
        type: array
        items:
            - production
            - staging
// Pulumi.default.yaml
Copy code
name: default
config:
    aws:region: us-east-1
    domain: <http://robcarr.net|robcarr.net>
    tags:
        type: array
        items:
            - production
            - staging
8 errors occurred: * #/config/tags: oneOf failed * #/config/tags: expected string, but got object * #/config/tags: expected integer, but got object * #/config/tags: expected boolean, but got object * #/config/tags: expected array, but got object * #/config/tags: doesn't validate with '/$defs/configTypeDeclaration' * #/config/tags/items: doesn't validate with '/$defs/configItemsType' * #/config/tags/items: expected object, but got array
s
For Pulumi.yaml it should be
Copy code
name: my-site
runtime: nodejs
main: ./index.ts
config:
    aws:region: us-east-1
    domain: <http://robcarr.net|robcarr.net>
    tags:
      - production
      - staging
assuming you want to set those defaults for all stacks. i'm not 100% sure exactly what you are trying to accomplish based on the code you posted
c
I have a bunch of micro stacks, I wanted to add a stack tag to each one which had the environment it was used in, shared resources would get both tags
Things aren't going particularly well atm though, I can't even get pulumi up to work at the minute, it keeps saying unknown file extension .ts on index.ts yet the docs say it's got built in typescript support
s
oh i see. why don't you use the Pulumi CLI to set a tag in order to find out what the format is in the config file?
Copy code
pulumi stack tag set <name> <value>
https://www.pulumi.com/docs/reference/cli/pulumi_stack_tag_set/
and i think your other issue about the
.ts
extension may have to do with the presence of
"type": "module"
in your package.json? I think i ran into that in the past and never got it to work
c
I've found a way round both issues by using InlinePrograms from the pulumi automation package, means I get to keep everything using modules, still get to keep my tsconfig path aliases and I can actually get rid of the yaml files, package.json etc and just define everything in pure typescript, way better!