Repository navigation
Replies: 2 comments
|
Hi @aminbaa, did you try to import the repository? $ terraform import github_repository.terraform terraform |
0 replies
|
Note that with Terraform 1.5+ you can do that within the code using import {
to = github_repository.existing_repo_name
id = ... # that repository ID
}You can either add that resource manually in the code: resource "github_repository" "existing_repo_name" {
name = "existing-repo-name"
# you will have to pre-fill all required fields
}This might be inconvenient because you have to manually fill in the fields of the resource. A better (but experimental) option is to generate the code for that resource by running terraform plan -generate-config-out=existing-repos.tfThen edit the generated code. In the plan you will see that resources are imported, not re-created. And once you apply, you can either keep or remove the |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
I use Terraform for creating non-existing repositories as below:
Then run these commands
it creates the repository for me.
However, if I manually create a repository and want to add a description and other metadata as explained here it does not work because it complains
How can I add such metadata data to a repository?
Note that I don't want to recreate the repository because I don't want the content of the repo to be lost. I just want to add the information to an already existing repository
All reactions