cloudformation-github-resource-providers icon indicating copy to clipboard operation
cloudformation-github-resource-providers copied to clipboard

Allow import of existing repository

Open Zouarfi opened this issue 2 years ago • 2 comments

Hello,

We would like to use the GitHub::Repositories::Repository resource on a repository that already exists so that we can make future changes from CloudFormation.

However, by doing so, we logically receive a 422 HTTP code (already exists).

Can we consider adding an option to authorize the import?

Either :

  • via an additional property on the GitHub::Repositories::Repository resource
  • in the configuration of the resource, add in the JSON, in addition to the access token, an option "allow import"?

The second option seems preferable in order to avoid changing the properties of GitHub::Repositories::Repository unnecessarily.

What do you think about it?

We'll be happy to help implement the feature if you think it's a good idea !

Zouarfi avatar May 19 '23 08:05 Zouarfi

Hey @Zouarfi, thank you for the feedback, your ask makes complete sense! Resource import for these 3rd party resources is something we're looking into, but it's not officially supported today. If and when we do support this, you won't need to authorize import or define additional properties. It will work the same way as importing an AWS:: resource. Import should work as long as the resource handler code passes a set of contract tests we have.

If you're feeling brave, even though CloudFormation doesn't claim official support for importing these 3rd party resources today, some of them will actually work for import because they have passed the contract tests we have. Most of the resources published by AWSCommunity publisher in the CloudFormation Registry have passed these tests. I ran a quick test and tried to import GitHub::Repositories::Repository into a stack and it worked. More validation is needed and official support hasn't been claimed yet so please know the risks and do so with caution.

image

Also feel free to message me in the CloudFormation Discord (AWSLucas#9406) if you'd like to chat further about any of this. https://discord.gg/QwBHWkV6Pg

LucasQChen avatar May 19 '23 19:05 LucasQChen

Hello @CloudChoom,

I didn't know that 3rd resource supports import like AWS:: resource ! That's awesome !

I have tested out also and it's working great :) (maybe we will encounter some edge cases, but we'll definitely report it).

We'll interested on the roadmap about the feature for GitHub you will develop and also about other 3rd party resource that you'll plan to support in the future. I'll catch-up on discord on the next days.

Thanks a lot !

Zouarfi avatar May 22 '23 09:05 Zouarfi