https://pulumi.com logo
#google-cloud
Title
# google-cloud
e

eager-pillow-75917

04/09/2020, 5:26 PM
I am trying to import a bucket that is sitting in another gcp project. My service account has the correct permissions, because I have been using this bucket to manage the stacks fine. but when I try to import I get a difference in project. Can I have in my stack a resource sitting in a gcp project different from the stack it self?
Copy code
export const Bucket = new Bucket(config.pulumiBucket, {
    name: "my-bucket",
    project: "project-b",
    location: 'US',
    versioning: {
        enabled: true
    },
    labels: {
        owner: "ops",
        environment: "staging",
        description: "some-description"
    }
}, {
    import: "my-bucket",
});
my stack is configured to be in another project:
Copy code
config:
  gcp:project: project-a
the service account has access to the bucket.
f

faint-table-42725

04/09/2020, 6:05 PM
You can construct a separate provider for that project, e.g.
const projectBProvider = new gcp.Provider("proj-b-provider", { project: "project-b" … })
and then pass that provider to the constructor as an option, e.g.
new Bucket(config.pulumiBucket, { … }, { import: "my-bucket", provider: projectBProvider })
e

eager-pillow-75917

04/09/2020, 6:39 PM
ahhh nice
going to try that
that worked man! Thanks!
👍 1