Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is possible to update the settings of an existent repository without importing it in terraform? #1765

Closed
l-lafin opened this issue Jun 29, 2023 · 2 comments
Labels
Status: Stale Used by stalebot to clean house

Comments

@l-lafin
Copy link

l-lafin commented Jun 29, 2023

We are using the provider to configure our existent repositories in order to standardize and secure all the configurations, this process is executed by a GitHub workflow. We'd like to update the repository settings such as 'Allow merge commits', 'Automatically delete head branches', etc for those existent repositories, but the only resource that I found allowing us to update them is 'github_repository' but this resource always try to create the repository and we don't want that. We also don't want to import the Terraform state, because we want to automate it as much as possible without human interference.

Is there any other resource that is able to update the repository settings instead of creating the whole repository? Or this would be a new feature request?

@devopsrick
Copy link

devopsrick commented Jun 30, 2023

If you use terraform 1.5+ you can import via code and remove the manual human interaction required for importing. Otherwise there are some settings such as branch protections that have separate resources. You would have to see if there are any covering the settings you want. I would suggest looking through the resource documentation at: https://registry.terraform.io/providers/integrations/github/latest/docs

And the import block documentation for 1.5: https://developer.hashicorp.com/terraform/language/import

Copy link

👋 Hey Friends, this issue has been automatically marked as stale because it has no recent activity. It will be closed if no further activity occurs. Please add the Status: Pinned label if you feel that this issue needs to remain open/active. Thank you for your contributions and help in keeping things tidy!

@github-actions github-actions bot added the Status: Stale Used by stalebot to clean house label Mar 27, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Stale Used by stalebot to clean house
Projects
None yet
Development

No branches or pull requests

2 participants