I’m struggling with defining `dynamic.Resource` pr...
# general
d
I’m struggling with defining
dynamic.Resource
properties - how do I return info from the backing cloud object via the Resource object here?
Copy code
const TestProvider = {
  async create(inputs) {
    // some api call result
    const derivedVal = "foobar";

    return {
      id: "id",
      outs: { inputVal: inputs.inputVal, derivedVal: derivedVal
      }
    };
  }
};

class TestResource extends pulumi.dynamic.Resource {
  constructor(name, props, opts) {
    super(TestProvider, name, props, opts);
  }
}

const testResource = new TestResource("test-token", {
  inputVal: "bar"
});

console.log(testResource.inputVal); // 'OutputImpl { ...'
console.log(testResource.derivedVal); // undefined
g
From https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamic-resource-outputs, these variable names must match exactly. That's generally the first thing to check.