limited-rainbow-51650
05/06/2020, 7:03 PMstring
. I would like to pass a full object. The problem I have is this: if the project is created in the same stack, I have a gcp.organizations.Project
instance, with Output
properties. If the project was already created in another stack, I look it up via getProject
and I am returned a Promise<GetProjectResult>
. The properties of a GetProjectResult
instance are the primitive types (not Output
). So I can’t substitute one for the other just because the resource is created in another stack. Any way around this?green-school-95910
05/06/2020, 7:12 PMproject.apply(p => p.projectId)
limited-rainbow-51650
05/06/2020, 7:16 PMany
.constructor(project: <which type here?>)
green-school-95910
05/06/2020, 7:19 PMInput<Project|GetProjectResult>
and then do project = output(project)
before using it on your componentlimited-rainbow-51650
05/06/2020, 7:29 PM|
character made me think about having or
-types to indicate one or the other:
constructor(project: gcp.organizations.Project | Promise<gcp.organizations.GetProjectResult>)
My editor is not complaining… will see how far I can get with this.green-school-95910
05/06/2020, 7:30 PMInput
wrapping them on the argument list to allow the values to be passed both directly, as promise or as outputlimited-rainbow-51650
05/06/2020, 7:33 PMInput
or is there also another technical thing I’m missing here?green-school-95910
05/06/2020, 7:36 PMInput<Project|GetProjectResult>
is the same as Project | GetProjectResult | Promise<Project | GetProjectResult> | Output<Project | GetProjectResult>
So it will accept resources created inside an apply
, in a promise chain or directlygetSomeConfigsExternally().then(config => new Project(projectId: config.projectId))