Using Terraform's GitHub Provider to operate GitHub

Before using it, you need to configure the authentication information for accessing GitHub's API, such as GitHub Personal Access Token

Here's an example of using Terraform to manipulate GitHub:

# Configure GitHub Provider
provider "github" {
   token = "GITHUB_PERSONAL_ACCESS_TOKEN"
}

# Create a new GitHub Repository
resource "github_repository" "example" {
   name = "example-repo"
   description = "This is an example repository"
   visibility = "public"
}

# Add a Collaborators
resource "github_repository_collaborator" "example" {
   repository = github_repository.example.name
   username = "example-collaborator"
   permission = "push"
}

In the example, we use GitHub Provider to create a new public warehouse and add a Collaborator

Likes(0)

Comment list count 0 Comments

No Comments

WeChat Self-Service

WeChat Consult

TaoBao

support@elephdev.com

发表
评论
Go
Top