-
Notifications
You must be signed in to change notification settings - Fork 777
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into ap_support_individual_repos
- Loading branch information
Showing
24 changed files
with
325 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# GitHub Provider Examples | ||
|
||
This directory contains a set of examples of using various GitHub services with | ||
Terraform. The examples each have their own README containing more details | ||
on what the example does. | ||
|
||
To run any example, clone the repository and run `terraform init`, `terraform plan`, and `terraform apply` within | ||
the example's own directory. | ||
|
||
For example: | ||
|
||
``` | ||
$ git clone https://github.com/terraform-providers/terraform-provider-github | ||
$ cd terraform-provider-github/examples/repository_collaborator | ||
$ terraform init | ||
$ terraform plan | ||
$ terraform apply | ||
... | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Release Example | ||
|
||
This displays retrieval of a GitHub release. | ||
|
||
This example will look up a GitHub release available to the specified `owner` organization or a personal account. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly. | ||
|
||
Alternatively, you may use variables passed via command line: | ||
|
||
```console | ||
export GITHUB_ORG= | ||
export GITHUB_TOKEN= | ||
export RELEASE_OWNER= | ||
export RELEASE_REPOSITORY= | ||
export RELEASE_TAG= | ||
``` | ||
```console | ||
terraform apply \ | ||
-var "organization=${GITHUB_ORG}" \ | ||
-var "github_token=${GITHUB_TOKEN}" \ | ||
-var "owner=${RELEASE_OWNER}" \ | ||
-var "repository=${RELEASE_REPOSITORY}" \ | ||
-var "release_tag=${RELEASE_TAG}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
data "github_release" "by_tag" { | ||
repository = var.repository | ||
owner = var.owner | ||
release_tag = var.release_tag | ||
retrieve_by = "tag" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "github_release_assets_url" { | ||
description = "Asset URL of a GitHub release" | ||
value = data.github_release.by_tag.asserts_url | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
provider "github" { | ||
version = "2.8.0" | ||
organization = var.organization | ||
token = var.github_token | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
variable "organization" { | ||
description = "GitHub organization used to configure the provider" | ||
type = string | ||
} | ||
|
||
variable "github_token" { | ||
description = "GitHub access token used to configure the provider" | ||
type = string | ||
} | ||
|
||
variable "owner" { | ||
description = "GitHub owner of a release to query" | ||
type = string | ||
} | ||
|
||
variable "repository" { | ||
description = "GitHub repository of a release to query" | ||
type = string | ||
} | ||
|
||
variable "release_tag" { | ||
description = "Tag of a release to query" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Repository Collaborator | ||
|
||
This provides a template for managing [repository collaborators](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/inviting-collaborators-to-a-personal-repository). | ||
|
||
This example will also create a repository in the specified `owner` organization. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly. | ||
|
||
Alternatively, you may use variables passed via command line: | ||
|
||
```console | ||
export GITHUB_ORG= | ||
export GITHUB_TOKEN= | ||
export COLLABORATOR_USERNAME= | ||
export COLLABORATOR_PERMISSION= | ||
``` | ||
|
||
```console | ||
terraform apply \ | ||
-var "organization=${GITHUB_ORG}" \ | ||
-var "github_token=${GITHUB_TOKEN}" \ | ||
-var "username=${COLLABORATOR_USERNAME}" \ | ||
-var "permission=${COLLABORATOR_PERMISSION}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
resource "github_repository" "collaboration" { | ||
name = "collaboration" | ||
private = true | ||
description = "A collaborative repository" | ||
} | ||
|
||
resource "github_repository_collaborator" "collaborator" { | ||
repository = github_repository.collaboration.name | ||
username = var.username | ||
permission = var.permission | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "repository" { | ||
description = "Collaborative repository JSON blob" | ||
value = github_repository.collaboration | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
provider "github" { | ||
version = "2.8.0" | ||
organization = var.organization | ||
token = var.github_token | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
variable "username" { | ||
description = "Username of a collaborator" | ||
type = string | ||
} | ||
|
||
variable "permission" { | ||
description = "Permission level for a collaborator" | ||
type = string | ||
} | ||
|
||
variable "organization" { | ||
description = "GitHub organization used to configure the provider" | ||
type = string | ||
} | ||
|
||
variable "github_token" { | ||
description = "GitHub access token used to configure the provider" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Repository `delete_branch_on_merge` Example | ||
|
||
This displays configurability of the `delete_branch_on_merge` feature for GitHub repositories. | ||
|
||
This example will create a repository in the specified `owner` organization. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly. | ||
|
||
Alternatively, you may use variables passed via command line: | ||
|
||
```console | ||
export GITHUB_ORG= | ||
export GITHUB_TOKEN= | ||
``` | ||
|
||
```console | ||
terraform apply \ | ||
-var "organization=${GITHUB_ORG}" \ | ||
-var "github_token=${GITHUB_TOKEN}" | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
resource "github_repository" "delete_branch_on_merge" { | ||
name = "delete_branch_on_merge" | ||
description = "A repository with delete-branch-on-merge configured" | ||
default_branch = "master" | ||
private = true | ||
delete_branch_on_merge = true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
output "repository" { | ||
description = "Example repository JSON blob" | ||
value = github_repository.delete_branch_on_merge | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
provider "github" { | ||
version = "2.8.0" | ||
organization = var.organization | ||
token = var.github_token | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
variable "organization" { | ||
description = "GitHub organization used to configure the provider" | ||
type = string | ||
} | ||
|
||
variable "github_token" { | ||
description = "GitHub access token used to configure the provider" | ||
type = string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.