Replies: 2 comments
-
Hi @aminbaa, did you try to import the repository? $ terraform import github_repository.terraform terraform |
Beta Was this translation helpful? Give feedback.
-
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.tf Then 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 |
Beta Was this translation helpful? Give feedback.
-
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
Beta Was this translation helpful? Give feedback.
All reactions