glamorous-printer-66548
09/28/2018, 10:17 PMPromise<gcp.container.GetClusterResult>
into an Input<gcp.container.GetClusterResult>
or Output<gcp.container.GetClusterResult>
so that I can pass subproperties of the result to pulumi resources without manual unwrapping?microscopic-florist-22719
Promise<T>
is directly assignable to an Input<T>
.Input<T>
, as Input<T>
is defined as the union of T | Input<T> | Output<T>
glamorous-printer-66548
09/28/2018, 10:23 PMconst clusterResult = gcp.container.getCluster({name: 'my-custer'})
new my.Resource('foo', {
clusterEndPoint: clusterResult.endpoint
})
clusterResult
would be a regular pulumi resource i could tap into the subproperties without unwrapping.Promise
I first would have to unwrap it via .then
in order to get a subproperty.incalculable-sundown-82514
09/28/2018, 10:33 PM.get
over data sources - .get
does give you a regular pulumi resourceglamorous-printer-66548
09/28/2018, 10:39 PMgsutil mb <gs://pulumi-experiment-bucket>
import * as gcp from '@pulumi/gcp';
const myBucket = gcp.storage.Bucket.get('my-bucket', 'pulumi-experiment-bucket');
Previewing changes:
Type Name Plan Info
+ pulumi:pulumi:Stack pulumi-query-experiments-christian-experiments create
>- └─ gcp:storage:Bucket my-bucket read 1 error
Diagnostics:
gcp:storage:Bucket: my-bucket
error: Preview failed: refreshing urn:pulumi:christian-experiments::pulumi-query-experiments::gcp:storage/bucket:Bucket::my-bucket: Error reading Storage Bucket "": googleapi: Error 400: Required parameter: project, required
error: an error occurred while advancing the preview
pulumi config set gcp:project my-project
import * as gcp from '@pulumi/gcp';
const myBucket = gcp.storage.Bucket.get(
'my-bucket',
'pulumi-experiment-bucket',
{ project: 'my-project', name: 'pulumi-experiment-bucket' }
);
incalculable-sundown-82514
09/28/2018, 10:42 PMglamorous-printer-66548
09/28/2018, 10:42 PMincalculable-sundown-82514
09/28/2018, 10:44 PMglamorous-printer-66548
09/28/2018, 10:48 PMimport * as gcp from '@pulumi/gcp';
const myBucket = gcp.storage.Bucket.get(
'my-bucket',
'pulumi-experiment-bucket'
);
but THIS works:
import * as gcp from '@pulumi/gcp';
const myBucket = gcp.storage.Bucket.get(
'my-bucket',
'pulumi-experiment-bucket',
{ name: 'pulumi-experiment-bucket' }
);
name
to the third param)?incalculable-sundown-82514
09/28/2018, 10:49 PM.get
is actually an ID, which uniquely identifies the bucket - it may not be the same as the name of the bucket itself.glamorous-printer-66548
09/28/2018, 10:50 PMname
and now pulumi fails with:
Previewing changes:
Type Name Plan Info
+ pulumi:pulumi:Stack pulumi-query-experiments-christian-experiments create
>- └─ gcp:storage:Bucket my-bucket read 1 error
Diagnostics:
gcp:storage:Bucket: my-bucket
error: Preview failed: reading resource urn:pulumi:christian-experiments::pulumi-query-experiments::gcp:storage/bucket:Bucket::my-bucket yielded an unexpected ID;expected pulumi-experiment-bucket-foo, got pulumi-experiment-bucket
error: an error occurred while advancing the preview
name
property for the lookup but then tries to match that name with the manually provided id
and complains if they don’t match.incalculable-sundown-82514
09/28/2018, 10:57 PMglamorous-printer-66548
09/28/2018, 10:58 PMname
property at all, because the id
is assumed to be name anyways.microscopic-florist-22719
glamorous-printer-66548
09/28/2018, 11:03 PMmicroscopic-florist-22719
glamorous-printer-66548
09/28/2018, 11:36 PMmicroscopic-florist-22719