early-kite-86569
09/15/2021, 7:34 PMdefault_bucket
(from https://www.pulumi.com/docs/reference/pkg/gcp/appengine/application/) full details with get_bucket
(https://www.pulumi.com/docs/reference/pkg/google-native/storage/v1/getbucket/)
# Get created bucket
self.full_bucket_details = storage.get_bucket(
self.firestore_app.default_bucket,
opts=pulumi.InvokeOptions(parent=self.firestore_app),
)
Does not work because it tries to get the bucket before the resource is created:
Exception: invoke of google-nativestorage/v1getBucket failed: invocation of google-nativestorage/v1getBucket returned an error: error sending request: googleapi: Error 400: Invalid bucket name: '{bucket}', invalid
bored-oyster-3147
09/15/2021, 7:41 PMearly-kite-86569
09/15/2021, 7:42 PMbored-oyster-3147
09/15/2021, 7:42 PMname
is the name of a bucket resource that was provisioned in the same stackearly-kite-86569
09/15/2021, 7:43 PMbored-oyster-3147
09/15/2021, 7:46 PMapplication
is creating a bucket so that bucket isn't being directly managed by pulumi?
When you call the get_bucket
function that you linked you can pass in InvokeOptions
which I believes takes in a dependsOn
property? You could pass your application
resource to the dependsOn
and that might tell the API call to wait until the application is deployed before fetching the bucketearly-kite-86569
09/15/2021, 7:47 PMdepends_on
isn't an argument to InvokeOptions
bored-oyster-3147
09/15/2021, 8:02 PMparent
. Honestly though the output dependency tree should take care of this flow for you?
for instance something like:
self.full_bucket_details = self.firestone_app.default_bucket.apply(bucketName => {
return storage.get_bucket(
bucketName,
opts=pulumi.InvokeOptions(parent=self.firestore_app));
});
early-kite-86569
09/15/2021, 8:16 PMbored-oyster-3147
09/15/2021, 8:30 PMDefaultObjectAccessControl
or BucketIamPolicy
or BucketAccessControl
to accomplish this? Those each are resource that attach to an existing bucket.Bucket
resource and not as a resource that can be attached to the root Bucket
, than you may need to figure out a way to have your stack manage that bucket to begin with. So if that is the case you will want to see if there is a way to provide the Application
resource an existing bucketearly-kite-86569
09/15/2021, 8:32 PM