https://pulumi.com logo
Title
w

witty-vegetable-61961

03/30/2023, 11:03 PM
Hi, I want to use Pulumi to configure GitHub repos. The repos are already configured manually. I assume I should do a Pulumi import to get this infra into Pulumi?
s

salmon-account-74572

03/30/2023, 11:16 PM
Yes.
w

witty-vegetable-61961

03/30/2023, 11:16 PM
This is a very specific ask but do we have an example of importing GitHub resources? Not sure what an example command would be.
s

steep-toddler-94095

03/30/2023, 11:22 PM
one way to do it is through the CLI: https://www.pulumi.com/registry/packages/github/api-docs/repository/ if the repos are very similar to each other, you can import one using the CLI (it generates the code for you too) and then write a bit more code to import all the other repos through Pulumi Opts in a `Array.map/for-loop`: https://www.pulumi.com/docs/intro/concepts/resources/options/import/#import Though with the Opts you can only import if the code you write matches the state in the cloud
w

witty-vegetable-61961

03/30/2023, 11:24 PM
Ah I just saw the docs:
pulumi import github:index/repository:Repository terraform terraform
My bad! What does index and terraform terraform refer to?
s

steep-toddler-94095

03/30/2023, 11:27 PM
oof that example is not great haha. index should just stay index. the first
terraform
in that example is the name of the repo and the second
terraform
is the name of the Pulumi Resource you want to import it as. In general these are probably fine to be the same, but sometimes you might want them to not match
w

witty-vegetable-61961

03/30/2023, 11:29 PM
Ah gotcha, yeah the repo name to import and the last argument would be same in my case.
I could do a script to iterate github repos and then run the import command for each. Powershell or C#. Nice and easy.
s

steep-toddler-94095

03/30/2023, 11:36 PM
yeah that's an option too!
w

witty-vegetable-61961

03/30/2023, 11:38 PM
ok gotcha. Another question, not related. I have some stacks made like dev, tst, prd, for some projects, and others are under my org, so gurdips1/dev, gurdips1/tst, etc. Can I move stacks to the org model?
s

steep-toddler-94095

03/30/2023, 11:40 PM
I am unfortunately not familiar with the cloud features, so you'll have to post that as a question separate from this thread so someone else can answer!
w

witty-vegetable-61961

03/30/2023, 11:43 PM
np!