-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* visibility is required on create and can not be updated * add an example * update logic for testing if there is an adequate change * add visibility tests * add testing for creation of private-visibility repos - removes testing of `internal` repositories - we encountered 500s from the API with the following error message: > Only organizations associated with an enterprise can set visibility to internal - a compatible testing environment is needed for automated testing - manual testing may be successful when running a local github instance - removes conflicting use of `private` and `visibility` - added `calculateVisibility` to account for the different combinations of visibility-related configuration that the provider expects - testing revealed different behaviour from the API documentation: > The visibility parameter overrides the private parameter when you use both parameters with the nebula-preview preview header. * add testing for creation of private-visibility repos - removes testing of `internal` repositories - we encountered 500s from the API with the following error message: > Only organizations associated with an enterprise can set visibility to internal - a compatible testing environment is needed for automated testing - manual testing may be successful when running a local github instance - removes conflicting use of `private` and `visibility` - added `calculateVisibility` to account for the different combinations of visibility-related configuration that the provider expects - testing revealed different behaviour from the API documentation: > The visibility parameter overrides the private parameter when you use both parameters with the nebula-preview preview header. * Uncomment tests * Remove specific configuration and instead link to Building the Provider documentation * Renamed example directory to match existing pattern Co-authored-by: Jurgen Weber <jurgen@space-marine.org> Co-authored-by: Jeremy Udit <jcudit@github.com>
- Loading branch information
1 parent
c2cead9
commit 1fe84bd
Showing
7 changed files
with
302 additions
and
9 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Repository Visibility with Org, type internal | ||
|
||
This demos various repository [visibility settings](https://help.github.com/en/github/administering-a-repository/setting-repository-visibility) for 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. | ||
|
||
In order to build the provider for use with this example, see [Building the Provider docs](https://github.com/integrations/terraform-provider-github/blob/master/CONTRIBUTING.md#building-the-provider) | ||
|
||
Alternatively, you may use variables passed via command line: | ||
|
||
```console | ||
export GITHUB_OWNER= | ||
export GITHUB_TOKEN= | ||
``` | ||
|
||
```console | ||
terraform apply \ | ||
-var "owner=${GITHUB_OWNER}" \ | ||
-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,5 @@ | ||
resource github_repository internal { | ||
name = "internal-visibility" | ||
description = "A internal-visible repository created by Terraform" | ||
visibility = "internal" | ||
} |
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 internal_repository { | ||
description = "Example repository JSON blob" | ||
value = github_repository.internal | ||
} |
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 @@ | ||
provider github { | ||
owner = var.owner | ||
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 owner { | ||
description = "GitHub owner 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