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

点赞(0)

评论列表 共有 0 评论

暂无评论

微信服务号

微信客服

淘宝店铺

support@elephdev.com

发表
评论
Go
顶部