Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
f9312e0
Updates go-github dep to v68
nickfloyd Nov 13, 2025
d5c316c
Vendoring updates
nickfloyd Nov 13, 2025
211cc10
Update to go-github v77
nickfloyd Nov 13, 2025
aaf8089
vendor
nickfloyd Nov 13, 2025
13f6e20
add project item, deprecate project card
nickfloyd Nov 13, 2025
5c5babb
Add project item to the resource map
nickfloyd Nov 13, 2025
6a6163a
make org project read-only
nickfloyd Nov 13, 2025
8064292
Deprecate project column
nickfloyd Nov 13, 2025
bb3b6ed
API renames: edit to update
nickfloyd Nov 13, 2025
808de22
API renames: edit to update
nickfloyd Nov 13, 2025
3a82a12
Use new CreateRef API
nickfloyd Nov 13, 2025
06076f2
Defer ruleset changes - they need to be done in a separate branch to …
nickfloyd Nov 13, 2025
b12b4ad
Adds / Updates rulesets
nickfloyd Nov 14, 2025
24df569
Renames Project V2 and removes legacy/classic projects concerns
nickfloyd Nov 14, 2025
1229e45
Merge remote-tracking branch 'origin/main' into go-github-v68
nickfloyd Nov 14, 2025
5045600
manual updates from merge
nickfloyd Nov 14, 2025
fc9e86e
Linting fixes and updating APIs
nickfloyd Nov 14, 2025
451b1eb
Fix deprecated team APIs
nickfloyd Nov 14, 2025
3ac34e3
go-github v68 to v77 upgrade (without ProjectsV2)
nickfloyd Nov 14, 2025
7df8bfc
adds nolint for depricated teams APIs
nickfloyd Nov 14, 2025
e87f8a9
adds ruleset migrations to signal underlying implemetnation has changed.
nickfloyd Nov 14, 2025
10a6ee7
Adds tests for migrations
nickfloyd Nov 14, 2025
372b95f
Merge branch 'main' into go-github-v68
nickfloyd Nov 18, 2025
75a94a4
Merge branch 'main' into go-github-v68
nickfloyd Nov 18, 2025
be8aaad
updates test to ignore ordinal eval
nickfloyd Nov 18, 2025
2ea09b5
removes docs for deprecated resources
nickfloyd Nov 19, 2025
7f5a0fc
remove out of date comment
nickfloyd Nov 19, 2025
bc76119
removes dup log
nickfloyd Nov 19, 2025
b52b7e8
removes static values on test evaluatations.
nickfloyd Nov 19, 2025
67f2f4b
removes superfluous migrations for rulesets
nickfloyd Nov 19, 2025
72ab80d
Merge remote-tracking branch 'origin/main' into go-github-v68
nickfloyd Dec 3, 2025
4e7fed5
Lint fixes
nickfloyd Dec 3, 2025
ba2a925
go mod update
nickfloyd Dec 3, 2025
cca9980
Update github/resource_github_repository_collaborators.go
nickfloyd Dec 3, 2025
40dfaf5
Update github/resource_github_repository_pull_request.go
nickfloyd Dec 3, 2025
69b2398
Naming and teams clean up.
nickfloyd Dec 3, 2025
15ecb62
Merge branch 'go-github-v68' of github.com:integrations/terraform-pro…
nickfloyd Dec 3, 2025
0bc396c
Fixes from linting changes
nickfloyd Dec 3, 2025
d5dee20
Cleans up multiple calls to the sdk
nickfloyd Dec 3, 2025
7a48a4d
Remove `make tools` as it seems superfluous with `tools.go`
deiga Dec 8, 2025
dc7dc0b
Remove explicit `github.com/client9/misspell` as we don't use it dire…
deiga Dec 8, 2025
d6fd302
Add `tfplugindocs` to `tools.go`
deiga Dec 8, 2025
69c2f78
Return `make tools` and remove `tools.go`
deiga Dec 8, 2025
d1ffc02
Manually move and rename docs files
deiga Dec 8, 2025
54d7b02
Create `examples` and `templates` with `tfplugindocs migrate`
deiga Dec 8, 2025
267eb5e
Generate docs with `tfplugindocs generate`
deiga Dec 8, 2025
db4de81
Delete Org Project and Repo Project docs
deiga Dec 8, 2025
ba62010
Fix validation errors
deiga Dec 8, 2025
734ef9a
Update `github_app` docs with template
deiga Dec 8, 2025
bd30043
Address inconsistent unordered list style
deiga Dec 8, 2025
4bcd0a1
Update `github_repository` docs
deiga Dec 8, 2025
54bbc9b
Updates import doc. Resolves #2582
deiga Dec 8, 2025
c331c93
Update example. Resolves #2718
deiga Dec 8, 2025
724fc45
Add link to `github_default_branch` resource. Resolves #2716
deiga Dec 8, 2025
d88848e
Update docs for `organization_ruleset` to use Schema contents. Resolv…
deiga Dec 8, 2025
4381e31
Add docs validation to CI
deiga Dec 9, 2025
586639f
Add CI check for uncommitted docs changes
deiga Dec 9, 2025
bbfcc45
Update `github_actions_environment_public_key` to generate docs based…
deiga Dec 9, 2025
d9de79c
Fix bash condition syntax
deiga Dec 9, 2025
f974050
Add docs contribution guide
deiga Dec 9, 2025
1f614b7
Standardize docs Markdown format with Markdownlint
deiga Dec 9, 2025
03bb0ef
Unify naming of resources using template variables
deiga Dec 9, 2025
663bd3d
Update `actions_organization_oidc_subject_claim_customization_templat…
deiga Dec 9, 2025
fdee2b3
Fix data source name in example. Resolves #2578
deiga Dec 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
10 changes: 9 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,15 @@ jobs:
cache: true
- run: make tools
- run: make lint
- run: make website-lint
- run: make docs-lint

- name: Check for uncommitted docs changes
run: |
tfplugindocs generate
if ! [[ -z $(git status --porcelain) ]]; then
echo "::error::Uncommitted changes after tfplugindocs generate"
exit 1
fi
- run: make build
- run: make test

Expand Down
4 changes: 4 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ linters:
linters:
- unparam
text: always receives
- path: resource_github_team_repository\.go
linters:
- staticcheck
text: "SA1019.*IsTeamRepoByID.*deprecated"

issues:
max-issues-per-linter: 0
Expand Down
17 changes: 17 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"MD004": {
"style": "dash"
},
"MD007": {
"indent": 4
},
"MD013": false,
"MD014": false,
"MD022": false,
"MD029": {
"style": "ordered"
},
"MD033": {
"allowed_elements": ["a"]
}
}
132 changes: 71 additions & 61 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ Before submitting an issue or a pull request, please search the repository for e

## Submitting a pull request

0. Fork and clone the repository.
0. Create a new branch: `git switch -c my-branch-name`.
0. Make your change, add tests, and make sure the tests still pass.
0. Push to your fork and submit a pull request.
0. Pat yourself on the back and wait for your pull request to be reviewed and merged.
1. Fork and clone the repository.
2. Create a new branch: `git switch -c my-branch-name`.
3. Make your change, add tests, and make sure the tests still pass.
4. Run `make docs-lint` to check if the documentation is up to date.
5. Update the documentation templates if needed.
6. Run `make docs-generate` to generate changes to the documentation.
7. Push to your fork and submit a pull request.
8. Pat yourself on the back and wait for your pull request to be reviewed and merged.

Here are a few things you can do that will increase the likelihood of your pull request being accepted:

Expand All @@ -33,26 +36,31 @@ This section describes a typical sequence performed when developing locally. Ful
Once you have the repository cloned, there's a couple of additional steps you'll need to take. Since most of the testing is acceptance or integration testing, we need to manipulate real GitHub resources in order to run it. Useful setup steps are listed below:

- If you haven't already, [create a GitHub organization you can use for testing](#github-organization).
- Optional: you may find it beneficial to create a test user as well in order to avoid potential rate-limiting issues on your main account.
- Your organization _must_ have a repository called `terraform-template-module`. The [terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) repo is a good, re-usable example.
- You _must_ make sure that the "Template Repository" item in Settings is checked for this repo.
- Optional: you may find it beneficial to create a test user as well in order to avoid potential rate-limiting issues on your main account.
- Your organization _must_ have a repository called `terraform-template-module`. The [terraformtesting/terraform-template-module](https://github.com/terraformtesting/terraform-template-module) repo is a good, re-usable example.
- You _must_ make sure that the "Template Repository" item in Settings is checked for this repo.
- If you haven't already, generate a Personal Access Token (PAT) for authenticating your test runs.
- Export the necessary configuration for authenticating your provider with GitHub

```sh
export GITHUB_TOKEN=<token of a user with an organization account>
export GITHUB_ORGANIZATION=<name of an organization>
```

- Build the project with `make build`
- Try an example test run from the default (`main`) branch, like `TF_LOG=DEBUG TF_ACC=1 go test -v ./... -run ^TestAccGithubRepositories`. All those tests should pass.

### Local Development Iteration

1. Write a test describing what you will fix. See [`github_label`](./github/resource_github_issue_label_test.go) for an example format.
1. Run your test and observe it fail. Enabling debug output allows for observing the underlying requests and responses made as well as viewing state (search `STATE:`) generated during the acceptance test run.
2. Run your test and observe it fail. Enabling debug output allows for observing the underlying requests and responses made as well as viewing state (search `STATE:`) generated during the acceptance test run.

```sh
TF_LOG=DEBUG TF_ACC=1 go test -v ./... -run ^TestAccGithubIssueLabel
```

1. Align the resource's implementation to your test case and observe it pass:

```sh
TF_ACC=1 go test -v ./... -run ^TestAccGithubIssueLabel
```
Expand All @@ -67,27 +75,29 @@ Println debugging can easily be used to obtain information about how code change

If a full debugger is desired, VSCode may be used. In order to do so,

0. Create a launch.json file with this configuration:
1. Create a launch.json file with this configuration:

```json
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 0,
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 0,
}
```

Setting a `processId` of 0 allows a dropdown to select the process of the provider.

0. Add a sleep call (e.g. `time.Sleep(10 * time.Second)`) in the [`func providerConfigure(p *schema.Provider) schema.ConfigureFunc`](https://github.com/integrations/terraform-provider-github/blob/cec7e175c50bb091feecdc96ba117067c35ee351/github/provider.go#L274C1-L274C64) before the immediate `return` call. This will allow time to connect the debugger while the provider is initializing, before any critical logic happens.
1. Add a sleep call (e.g. `time.Sleep(10 * time.Second)`) in the [`func providerConfigure(p *schema.Provider) schema.ConfigureFunc`](https://github.com/integrations/terraform-provider-github/blob/cec7e175c50bb091feecdc96ba117067c35ee351/github/provider.go#L274C1-L274C64) before the immediate `return` call. This will allow time to connect the debugger while the provider is initializing, before any critical logic happens.

0. Build the terraform provider with debug flags enabled and copy it to the appropriate bin folder with a command like `go build -gcflags="all=-N -l" -o ~/go/bin/`.
2. Build the terraform provider with debug flags enabled and copy it to the appropriate bin folder with a command like `go build -gcflags="all=-N -l" -o ~/go/bin/`.

0. Create or edit a `dev.tfrc` that points toward the newly-built binary, and export the `TF_CLI_CONFIG_FILE` variable to point to it. Further instructions on this process may be found in the [Building the provider](#using-a-local-version-of-the-provider) section.
3. Create or edit a `dev.tfrc` that points toward the newly-built binary, and export the `TF_CLI_CONFIG_FILE` variable to point to it. Further instructions on this process may be found in the [Building the provider](#using-a-local-version-of-the-provider) section.

0. Run a terraform command (e.g. `terraform apply`). While the provider pauses on initialization, go to VSCode and click "Attach to Process". In the search box that appears, type `terraform-provi` and select the terraform provider process.
4. Run a terraform command (e.g. `terraform apply`). While the provider pauses on initialization, go to VSCode and click "Attach to Process". In the search box that appears, type `terraform-provi` and select the terraform provider process.

0. The debugger is now connected! During a typical terraform command, the plugin will be invoked multiple times. If the debugger disconnects and the plugin is invoked again later in the run, the developer will have to re-attach each time as the process ID changes.
5. The debugger is now connected! During a typical terraform command, the plugin will be invoked multiple times. If the debugger disconnects and the plugin is invoked again later in the run, the developer will have to re-attach each time as the process ID changes.


## Manual Testing
Expand Down Expand Up @@ -121,7 +131,7 @@ provider_installation {
}
```

See https://www.terraform.io/docs/cli/config/config-file.html for more details.
See [Terraform CLI Config File](https://www.terraform.io/docs/cli/config/config-file.html) for more details.

When running examples, you should spot the following warning to confirm you are using a local build:

Expand Down Expand Up @@ -179,45 +189,45 @@ This may come in handy when debugging both acceptance and manual testing.

```json
{
// for information on how to debug the provider, see the CONTRIBUTING.md file
"version": "0.2.0",
"configurations": [
{
"name": "Launch test function",
"type": "go",
"request": "launch",
"mode": "test",
// note that the program file must be in the same package as the test to run,
// though it does not necessarily have to be the file that contains the test.
"program": "/home/kfcampbell/github/dev/terraform-provider-github/github/resource_github_team_members_test.go",
"args": [
"-test.v",
"-test.run",
"^TestAccGithubRepositoryTopics$" // ^ExactMatch$
],
"env": {
"GITHUB_TEST_COLLABORATOR": "kfcampbell-terraform-test-user",
"GITHUB_TEST_COLLABORATOR_TOKEN": "ghp_xxx",
"GITHUB_TEST_USER": "kfcampbell",
"GITHUB_TOKEN": "ghp_xxx",
"GITHUB_TEMPLATE_REPOSITORY": "terraform-template-module",
"GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID": "12345678",
// "GITHUB_OWNER": "kfcampbell-terraform-provider",
// "GITHUB_OWNER": "kfcampbell",
"GITHUB_ORGANIZATION": "kfcampbell-terraform-provider", // GITHUB_ORGANIZATION is required for organization integration tests
"TF_CLI_CONFIG_FILE": "/home/kfcampbell/github/dev/terraform-provider-github/examples/dev.tfrc",
"TF_ACC": "1",
"TF_LOG": "DEBUG",
"APP_INSTALLATION_ID": "12345678"
}
},
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 0
}
]
// for information on how to debug the provider, see the CONTRIBUTING.md file
"version": "0.2.0",
"configurations": [
{
"name": "Launch test function",
"type": "go",
"request": "launch",
"mode": "test",
// note that the program file must be in the same package as the test to run,
// though it does not necessarily have to be the file that contains the test.
"program": "/home/kfcampbell/github/dev/terraform-provider-github/github/resource_github_team_members_test.go",
"args": [
"-test.v",
"-test.run",
"^TestAccGithubRepositoryTopics$" // ^ExactMatch$
],
"env": {
"GITHUB_TEST_COLLABORATOR": "kfcampbell-terraform-test-user",
"GITHUB_TEST_COLLABORATOR_TOKEN": "ghp_xxx",
"GITHUB_TEST_USER": "kfcampbell",
"GITHUB_TOKEN": "ghp_xxx",
"GITHUB_TEMPLATE_REPOSITORY": "terraform-template-module",
"GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID": "12345678",
// "GITHUB_OWNER": "kfcampbell-terraform-provider",
// "GITHUB_OWNER": "kfcampbell",
"GITHUB_ORGANIZATION": "kfcampbell-terraform-provider", // GITHUB_ORGANIZATION is required for organization integration tests
"TF_CLI_CONFIG_FILE": "/home/kfcampbell/github/dev/terraform-provider-github/examples/dev.tfrc",
"TF_ACC": "1",
"TF_LOG": "DEBUG",
"APP_INSTALLATION_ID": "12345678"
}
},
{
"name": "Attach to Process",
"type": "go",
"request": "attach",
"mode": "local",
"processId": 0
}
]
}
```
36 changes: 14 additions & 22 deletions GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
TEST?=$$(go list ./... |grep -v 'vendor')
WEBSITE_REPO=github.com/hashicorp/terraform-website
PKG_NAME=github

default: build

tools:
go install github.com/client9/misspell/cmd/misspell@v0.3.4
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6.0
go install github.com/golangci/misspell/cmd/misspell@latest
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.6
go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs@v0.24

build: fmtcheck
CGO_ENABLED=0 go build -ldflags="-s -w" ./...
Expand Down Expand Up @@ -37,22 +37,14 @@ test-compile:
fi
CGO_ENABLED=0 go test -c $(TEST) $(TESTARGS)

website:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
endif
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)

website-lint:
@echo "==> Checking website against linters..."
@misspell -error -source=text website/

website-test:
ifeq (,$(wildcard $(GOPATH)/src/$(WEBSITE_REPO)))
echo "$(WEBSITE_REPO) not found in your GOPATH (necessary for layouts and assets), get-ting..."
git clone https://$(WEBSITE_REPO) $(GOPATH)/src/$(WEBSITE_REPO)
endif
@$(MAKE) -C $(GOPATH)/src/$(WEBSITE_REPO) website-provider-test PROVIDER_PATH=$(shell pwd) PROVIDER_NAME=$(PKG_NAME)

.PHONY: build test testacc fmt fmtcheck lint tools test-compile website website-lint website-test
docs-generate:
@echo "==> Generating docs..."
tfplugindocs generate

docs-lint:
@echo "==> Checking docs against linters..."
@misspell -error -source=text docs/
@tfplugindocs validate


.PHONY: build test testacc fmt fmtcheck lint tools test-compile docs-generate docs-lint
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This project is used to manipulate GitHub resources (repositories, teams, files,
## Requirements

- [Terraform](https://www.terraform.io/downloads.html) 0.10.x
- [Go](https://golang.org/doc/install) 1.19.x (to build the provider plugin)
- [Go](https://golang.org/doc/install) 1.24.x (to build the provider plugin)

## Usage

Expand Down
32 changes: 32 additions & 0 deletions docs/data-sources/actions_environment_public_key.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
page_title: "github_actions_environment_public_key Data Source - terraform-provider-github"
description: |-
Get information on a GitHub Actions Environment Public Key.
---

# github_actions_environment_public_key (Data Source)

Use this data source to retrieve information about a GitHub Actions public key of a specific environment. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to a repository to retrieve the action public keys of it's environments.

## Example Usage

```terraform
data "github_actions_environment_public_key" "example" {
repository = "example_repo"
environment = "example_environment"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `environment` (String) Name of the environment to get public key from.
- `repository` (String) Name of the repository to get public key from.

### Read-Only

- `id` (String) The ID of this resource.
- `key` (String) Actual key retrieved.
- `key_id` (String) ID of the key that has been retrieved.
27 changes: 27 additions & 0 deletions docs/data-sources/actions_environment_secrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
page_title: "github_actions_environment_secrets Data Source - terraform-provider-github
description: |-
Get Actions secrets of the repository environment
---

# github_actions_environment_secrets (Data Source)

Use this data source to retrieve the list of secrets of the repository environment.

## Example Usage

```terraform
data "github_actions_environment_secrets" "example" {
name = "exampleRepo"
environment = "exampleEnvironment"
}
```

## Argument Reference

## Attributes Reference

- `secrets` - list of secrets for the environment
- `name` - Name of the secret
- `created_at` - Timestamp of the secret creation
- `updated_at` - Timestamp of the secret last update
28 changes: 28 additions & 0 deletions docs/data-sources/actions_environment_variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
page_title: "github_actions_environment_variables Data Source - terraform-provider-github
description: |-
Get Actions variables of the repository environment
---

# github_actions_environment_variables (Data Source)

Use this data source to retrieve the list of variables of the repository environment.

## Example Usage

```terraform
data "github_actions_environment_variables" "example" {
name = "exampleRepo"
environment = "exampleEnvironment"
}
```

## Argument Reference

## Attributes Reference

- `variables` - list of variables for the environment
- `name` - Name of the variable
- `value` - Value of the variable
- `created_at` - Timestamp of the variable creation
- `updated_at` - Timestamp of the variable last update
Loading