You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GCP requires that the bucket should be named as the domain name and that we create a CNAME record in the DNS to point it to google store. I am able to manually create the bucket from GCP Console, with the domain name say, for example, www.myawesomesite.com. However, when I try to create the same programmatically using Pulumi, I end up getting the following error.
NOTE: I am the verified owner of the domain, the domain itself is also verified and I have also already added Pulumi's service account email as the domain owner in Webmaster tools - https://www.google.com/webmasters/tools/dashboard.
Code:
constpulumi=require("@pulumi/pulumi");constgcp=require('@pulumi/gcp');constmime=require('mime');constfs=require('fs');constpath=require('path');constsiteDir=path.join(__dirname,'www');constsiteBucket=newgcp.storage.Bucket('pulumi-demo-bucket',{name: 'www.myawesomesite.com',websites: [{mainPageSuffix: 'index.html',notFoundPage: '404.html'}]});constdefaultAcl=newgcp.storage.BucketACL('pulumi-demo-acl',{bucket: siteBucket,defaultAcl: 'publicRead'});// For each file in the directory, create an object stored in `siteBucket`fs.readdirSync(siteDir).forEach(item=>{letfilePath=path.join(siteDir,item);letobject=newgcp.storage.BucketObject(item,{bucket: siteBucket,source: filePath,contentType: mime.getType(filePath)||undefined,});});// Stack exportsexports.bucketName=siteBucket.name;
ERROR:
$ pulumi update
Previewing update of stack 'plume-demo'
Previewing changes:
* pulumi:pulumi:Stack pulumi-demo-plume-demo running
+ gcp:storage:Bucket pulumi-demo-bucket create
+ gcp:storage:BucketACL pulumi-demo-acl create
+ gcp:storage:BucketObject favicon.png create
+ gcp:storage:BucketObject index.html create
info: 4 changes previewed:
+ 4 resources to create
1 resource unchanged
Updating stack 'plume-demo'
Performing changes:
* pulumi:pulumi:Stack pulumi-demo-plume-demo running
+ gcp:storage:Bucket pulumi-demo-bucket creating
+ gcp:storage:Bucket pulumi-demo-bucket creating 1 error. error: Plan apply failed: creating urn:pulumi:plume-demo::pulumi-demo::gcp:storage/bucket:Bucket::pulumi-demo-bucket: googleapi: Error 403: The bucket you tried to create is a domain name owned by another user., forbidden
+ gcp:storage:Bucket pulumi-demo-bucket **creating failed** 1 error. error: Plan apply failed: creating urn:pulumi:plume-demo::pulumi-demo::gcp:storage/bucket:Bucket::pulumi-demo-bucket: googleapi: Error 403: The bucket you tried to create is a domain name owned by another user., forbidden
+ gcp:storage:Bucket pulumi-demo-bucket **creating failed** 2 errors. error: update failed
* pulumi:pulumi:Stack pulumi-demo-plume-demo done
Diagnostics:
gcp:storage:Bucket: pulumi-demo-bucket
error: Plan apply failed: creating urn:pulumi:plume-demo::pulumi-demo::gcp:storage/bucket:Bucket::pulumi-demo-bucket: googleapi: Error 403: The bucket you tried to create is a domain name owned by another user., forbidden
error: update failed
info: no changes required:
1 resource unchanged
The text was updated successfully, but these errors were encountered:
The immediate issue here appears to be that bucket: siteBucket, should be bucket: siteBucket.id,. If I copy the program above into TypeScript, it catches the two occurrences of this.
Use Case:
Create a bucket in GCP to host a static website.
Details:
GCP requires that the bucket should be named as the domain name and that we create a CNAME record in the DNS to point it to google store. I am able to manually create the bucket from GCP Console, with the domain name say, for example, www.myawesomesite.com. However, when I try to create the same programmatically using Pulumi, I end up getting the following error.
NOTE: I am the verified owner of the domain, the domain itself is also verified and I have also already added Pulumi's service account email as the domain owner in Webmaster tools - https://www.google.com/webmasters/tools/dashboard.
Code:
ERROR:
The text was updated successfully, but these errors were encountered: