What’s the correct way to use `requireSecret` as a...
# general
c
What’s the correct way to use
requireSecret
as an argument to a cloud spec? I see that in https://github.com/pulumi/examples/blob/fdf37ddecedb10dcdfa77362f8ece49c52011caa/aws-stackreference-architecture/database/src/index.ts#L30 nothing special is going on but when I follow that pattern like:
Copy code
const config = new Config();
const dbPassword = config.requireSecret('dbPassword');

// stuff....

const postgresUser = new gcp.sql.User('master', {
  name: dbUser,
  password: dbPassword, // this line errors out. I've also tried dbPassword.get()
  instance: postgresDB.name,
  project: project
});
I get the following error:
Copy code
index.ts(187,3): error TS2322: Type 'Output<string>' is not assignable to type 'string | Promise<string> | OutputInstance<string> | undefined'.
      Type 'Output<string>' is not assignable to type 'OutputInstance<string>'.
        Types of property 'apply' are incompatible.
          Type '{ <U>(func: (t: string) => Promise<U>): import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: string) => import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/Users/paymahn/qwil/[secret]/pulumi/infra/nod...' is not assignable to type '{ <U>(func: (t: string) => Promise<U>): import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: string) => import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/...'.
            Type 'import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modules/@pulumi/pulumi/output").Output<any>' is not assignable to type 'import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi/output").Output<any>'.
              Type 'OutputInstance<any>' is not assignable to type 'Output<any>'.
                Type 'OutputInstance<any>' is not assignable to type 'OutputInstance<any> & LiftedObject<any, string>'.
                  Type 'import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modules/@pulumi/pulumi/output").OutputInstance<any>' is not assignable to type 'import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi/output").OutputInstance<any>'.
                    Types of property 'apply' are incompatible.
                      Type '{ <U>(func: (t: any) => Promise<U>): import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: any) => import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modu...' is not assignable to type '{ <U>(func: (t: any) => Promise<U>): import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi/output").Output<U>; <U>(func: (t: any) => import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi/output").OutputInstance<U>): import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi...'.
                        Type 'import("/Users/paymahn/qwil/[secret]/pulumi/infra/node_modules/@pulumi/pulumi/output").Output<any>' is not assignable to type 'import("/Users/paymahn/qwil/[secret]/pulumi/node_modules/@pulumi/pulumi/output").Output<any>'.
                          Type 'OutputInstance<any>' is not assignable to type 'Output<any>'.
                            Type 'OutputInstance<any>' is not assignable to type 'OutputInstance<any> & LiftedObject<any, string>'.
                              Type 'OutputInstance<any>' is not assignable to type 'LiftedObject<any, string>'.
                                Index signature is missing in type 'OutputInstance<any>'.
I’ve tried calling
.get()
on
dbPassword
but that results in another error of
Copy code
Error: Cannot call '.get' during update or preview.
    To manipulate the value of this Output, use '.apply' instead.
t
You do everything right but you probably hit https://github.com/pulumi/pulumi/issues/3652
Try updating if you aren't at 1.7.1 yet
c
brew upgrade pulumi
?
brew is reporting I’m on 1.7.0 and it seems that’s the latest version
t
I believe you need updated Node @pulumi/pulumi
c
node 1.7.1?
t
"@pulumi/pulumi": "^1.7.1", in package.json
c
aaah