diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index ee010fd2cb..6c294a626d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,12 +7,12 @@ Resolves #ISSUE_NUMBER ### Before the change? -- +- ### After the change? -- +- ### Pull request checklist diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0bdd194767..5ab57d5ec3 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,10 +29,60 @@ jobs: - name: Checkout uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set-up Go - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version-file: go.mod cache: true - run: make tools - run: make build - run: make test + + docs: + name: Documentation + runs-on: ubuntu-latest + permissions: + contents: read + defaults: + run: + shell: bash + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Set-up Go + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 + with: + go-version-file: go.mod + cache: true + - name: Set-up Terraform + uses: hashicorp/setup-terraform@5e8dbf3c6d9deaf4193ca7a8fb23f2ac83bb6c85 # v4.0.0 + with: + terraform_version: latest + terraform_wrapper: false + - run: make checkdocs + - run: make validatedocs + - uses: rvben/rumdl@f3ca9f4962234c3d2b73ac2ce15c0b6ca654d510 # v0.1.84 + with: + path: ./docs + report-type: annotations + + check: + name: Check + needs: + - ci + - docs + if: always() + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - name: Check + run: | + set -euo pipefail + results=( ${{ join(needs.*.result, ' ') }} ) + for result in "${results[@]}"; do + if [[ "${result}" == "failure" ]] || [[ "${result}" == "cancelled" ]]; then + echo "::error::Workflow failed!" + exit 1 + fi + done diff --git a/.github/workflows/codeql.yaml b/.github/workflows/codeql.yaml index 609a3a0f9b..5a11799c3b 100644 --- a/.github/workflows/codeql.yaml +++ b/.github/workflows/codeql.yaml @@ -3,10 +3,10 @@ name: CodeQL on: workflow_dispatch: push: - branches: ["main"] + branches: [ "main" ] pull_request: # The branches below must be a subset of the branches above - branches: ["main"] + branches: [ "main" ] schedule: - cron: "16 7 * * 5" @@ -42,7 +42,7 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 - name: Set-up Go - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 if: matrix.language == 'go' with: go-version-file: go.mod diff --git a/.github/workflows/dotcom-acceptance-tests.yaml b/.github/workflows/dotcom-acceptance-tests.yaml index 31ee00d2c2..1779c33c17 100644 --- a/.github/workflows/dotcom-acceptance-tests.yaml +++ b/.github/workflows/dotcom-acceptance-tests.yaml @@ -1,8 +1,8 @@ name: Acceptance Tests (github.com) on: - workflow_dispatch: - # push: + workflow_dispatch: # push: + # branches: # - main # - release-v* @@ -25,7 +25,9 @@ permissions: read-all jobs: test: name: Test ${{ matrix.mode }} - if: (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || contains(github.event.pull_request.labels.*.name, 'acctest') + if: (github.event_name != 'pull_request' && github.event_name != + 'pull_request_target') || + contains(github.event.pull_request.labels.*.name, 'acctest') runs-on: ubuntu-latest permissions: contents: read @@ -34,7 +36,7 @@ jobs: deployment: false strategy: matrix: - mode: [anonymous, individual, organization] # team, enterprise + mode: [ anonymous, individual, organization ] # team, enterprise fail-fast: true max-parallel: 1 defaults: @@ -47,7 +49,8 @@ jobs: - name: Check secrets if: github.event_name == 'pull_request_target' env: - INPUT_ALLOWED_SECRETS: ${{ vars.DOTCOM_ACCEPTANCE_TESTS_ALLOWED_SECRETS || 'GH_TEST_TOKEN' }} + INPUT_ALLOWED_SECRETS: ${{ vars.DOTCOM_ACCEPTANCE_TESTS_ALLOWED_SECRETS || + 'GH_TEST_TOKEN' }} INPUT_SECRETS: ${{ toJSON(secrets) }} run: | set -eou pipefail @@ -74,7 +77,7 @@ jobs: echo "token=${GH_TEST_TOKEN}" >> "${GITHUB_OUTPUT}" - name: Set-up Go - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version-file: go.mod cache: true @@ -104,7 +107,8 @@ jobs: TF_LOG: WARN GITHUB_TOKEN: ${{ steps.credentials.outputs.token }} GITHUB_BASE_URL: https://api.github.com/ - GITHUB_OWNER: ${{ (matrix.mode == 'individual' && vars.GH_TEST_LOGIN) || (matrix.mode == 'organization' && vars.GH_TEST_ORG_NAME) || '' }} + GITHUB_OWNER: ${{ (matrix.mode == 'individual' && vars.GH_TEST_LOGIN) || + (matrix.mode == 'organization' && vars.GH_TEST_ORG_NAME) || '' }} GITHUB_USERNAME: ${{ vars.GH_TEST_LOGIN }} GITHUB_ENTERPRISE_SLUG: ${{ vars.GH_TEST_ENTERPRISE_SLUG }} GH_TEST_AUTH_MODE: ${{ matrix.mode }} diff --git a/.github/workflows/ghes-acceptance-tests.yaml b/.github/workflows/ghes-acceptance-tests.yaml index 00b6f708a0..ebb309b694 100644 --- a/.github/workflows/ghes-acceptance-tests.yaml +++ b/.github/workflows/ghes-acceptance-tests.yaml @@ -2,15 +2,15 @@ name: Acceptance Tests (GHES) on: workflow_dispatch: - # pull_request_target: - # types: - # - opened - # - synchronize - # - reopened - # - labeled - # branches: - # - main - # - release-v* + # pull_request_target: + # types: + # - opened + # - synchronize + # - reopened + # - labeled + # branches: + # - main + # - release-v* concurrency: group: acctest-ghes-${{ github.ref }} @@ -37,7 +37,8 @@ jobs: - name: Check secrets if: github.event_name == 'pull_request_target' env: - INPUT_ALLOWED_SECRETS: ${{ vars.GHES_ACCEPTANCE_TESTS_ALLOWED_SECRETS || 'GHES_TEST_USER_TOKEN' }} + INPUT_ALLOWED_SECRETS: ${{ vars.GHES_ACCEPTANCE_TESTS_ALLOWED_SECRETS || + 'GHES_TEST_USER_TOKEN' }} INPUT_SECRETS: ${{ toJSON(secrets) }} run: | set -eou pipefail @@ -86,7 +87,7 @@ jobs: echo "token=${TEST_USER_TOKEN}" >> "${GITHUB_OUTPUT}" - name: Set-up Go - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version-file: go.mod cache: true diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 51f5bfdc79..c2c78de745 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -36,7 +36,7 @@ jobs: fetch-depth: 0 - name: Set-up Go - uses: actions/setup-go@7a3fe6cf4cb3a834922a1244abfce67bcef6a0c5 # v6.2.0 + uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 with: go-version-file: go.mod cache: true @@ -67,4 +67,5 @@ jobs: - name: Attest artifacts uses: actions/attest-build-provenance@96278af6caaf10aea03fd8d33a09a777ca52d62f # v3.2.0 with: - subject-checksums: ./dist/${{ github.event.repository.name }}_${{ fromJSON(steps.goreleaser.outputs.metadata).version }}_SHA256SUMS + subject-checksums: ./dist/${{ github.event.repository.name }}_${{ + fromJSON(steps.goreleaser.outputs.metadata).version }}_SHA256SUMS diff --git a/.markdownlint.yaml b/.markdownlint.yaml deleted file mode 100644 index 518e76a2af..0000000000 --- a/.markdownlint.yaml +++ /dev/null @@ -1,4 +0,0 @@ -MD013: false -MD024: - siblings_only: true -MD028: false diff --git a/.rumdl.toml b/.rumdl.toml new file mode 100644 index 0000000000..5b663e193e --- /dev/null +++ b/.rumdl.toml @@ -0,0 +1,18 @@ +[global] +disable = ["MD013", "MD028"] + +[per-file-ignores] +".github/pull_request_template.md" = ["MD041"] +"docs/**/*.md" = ["MD059"] + +[MD004] +style = "dash" + +[MD024] +siblings-only = true + +[MD033] +allowed-elements = ["a", "br", "details", "img", "summary", "sub", "sup"] + +[MD052] +shortcut-syntax = true diff --git a/CHANGELOG.md b/CHANGELOG.md deleted file mode 100644 index 98b391f118..0000000000 --- a/CHANGELOG.md +++ /dev/null @@ -1,809 +0,0 @@ -# NOTE: CHANGELOG.md is deprecated - -After the release of v4.24.0, please see the [GitHub release notes](https://github.com/integrations/terraform-provider-github/releases) for the provider in order to view the most up-to-date changes. - -# 4.24.0 (Apr 28, 2022) - -ENHANCEMENTS: -* Support for allow_forking on a repository/update to go-github v42 by @diogopms in https://github.com/integrations/terraform-provider-github/pull/1033 -* Upgrade go-github to v43.0.0 by @btkostner in https://github.com/integrations/terraform-provider-github/pull/1087 - -BUG FIXES: - -* Fix go module path by @turkenh in https://github.com/integrations/terraform-provider-github/pull/961 -* fix: remove incorrect required schema key on ref data source by @youcandanch in https://github.com/integrations/terraform-provider-github/pull/1109 -* Bump Go version for Actions release CI to 1.18 by @kfcampbell in https://github.com/integrations/terraform-provider-github/pull/1134 -* build(deps): bump actions/setup-go from 2 to 3 by @dependabot in https://github.com/integrations/terraform-provider-github/pull/1110 -* Fix linting issues by @kfcampbell in https://github.com/integrations/terraform-provider-github/pull/1107 - - -# 4.23.0 (Mar 25, 2022) - -ENHANCEMENTS: - -* Add support for disabling the use of the vulnerability management endpoint by @enieuw in https://github.com/integrations/terraform-provider-github/pull/1022 -* Added orgname in github_orgranization attributes by @Kavinraja-G in https://github.com/integrations/terraform-provider-github/pull/1052 -* Add a data source for refs. by @youcandanch in https://github.com/integrations/terraform-provider-github/pull/1084 -* build(deps): bump actions/checkout from 2 to 3 by @dependabot in https://github.com/integrations/terraform-provider-github/pull/1086 - -BUG FIXES: - -* fix: use pagination to fetch all team members by @carocad in https://github.com/integrations/terraform-provider-github/pull/1092 -* docs: fix typos in d/users.html.markdown by @pallxk in https://github.com/integrations/terraform-provider-github/pull/1049 - -# 4.22.0 (Mar 18, 2022) - -ENHANCEMENTS: - -* feat: add `tree` data source by @jasonwalsh in https://github.com/integrations/terraform-provider-github/pull/1027 -* feat: support for issues using github_issue resource by @ewilde in https://github.com/integrations/terraform-provider-github/pull/1047 -* feat: add configurable read_delay_ms by @morremeyer in https://github.com/integrations/terraform-provider-github/pull/1054 - -## 4.21.0 (Mar 11, 2022) - -ENHANCEMENTS: - -* Adding BypassPullRequestActorIDs to branch protection by @jtyr in https://github.com/integrations/terraform-provider-github/pull/1030 -* Adding suspended_at attribute to github_user data source by @mrobinson-anaplan in https://github.com/integrations/terraform-provider-github/pull/1070 -* Documentation: Add id to github_user data dource by @kangaechu in https://github.com/integrations/terraform-provider-github/pull/1061 - -BUG FIXES: - -* fix: use the appropriate ID when trying to import `github_team_members` objects by @bison-brandon in https://github.com/integrations/terraform-provider-github/pull/1074 -* Environment ID gets set incorrectly on update by @aceresia-bg in https://github.com/integrations/terraform-provider-github/pull/1058 -* Fix whitespace in documentation for branch_protection_v3 by @JCradock in https://github.com/integrations/terraform-provider-github/pull/1059 - -## 4.20.1 (Mar 3, 2022) - -BUG FIXES: - -* Remove team from state if deletion failed and it does not exist by @cytopia in https://github.com/integrations/terraform-provider-github/pull/1039 - * Note that this is a behavior change from previous GitHub Terraform provider releases: now, if a GitHub team deletion operation fails and the team does not exist, the team will be automatically removed from state. -* Make data_github_repository work with non-existing repositories by @tobiassjosten in https://github.com/integrations/terraform-provider-github/pull/1031 -* Standardize logs by @kfcampbell in https://github.com/integrations/terraform-provider-github/pull/1053 - -## 4.20.0 (Feb 3, 2022) - -ENHANCEMENTS: - -* Add new resource `github_team_members` to allow authoritative team management by @stawik-mesa in https://github.com/integrations/terraform-provider-github/pull/975 - -BUG FIXES: - -* test: checkout pull request via sha instead of ref by @jcudit in https://github.com/integrations/terraform-provider-github/pull/1043 -* Small CI cleanup by @kfcampbell in https://github.com/integrations/terraform-provider-github/pull/1048 - -**Full Changelog**: https://github.com/integrations/terraform-provider-github/compare/v4.19.2...v4.20.0 - - -## 4.19.2 (Jan 20, 2022) - -BUG FIXES: - -- Update `go-github` to v42.0.0 ([#1035](https://github.com/integrations/terraform-provider-github/pull/1035)) -- Adjust count requirement of `required_approving_review_count` option for `github_branch_protection` ([#971](https://github.com/integrations/terraform-provider-github/pull/971)) -- Add `nil` check for `require_conversation_resolution` field of `github_branch_protection` resource ([#1032](https://github.com/integrations/terraform-provider-github/pull/1032)) - -## 4.19.1 (Jan 5, 2022) - -BUG FIXES: - -- Update `go-github` to v41.0.0 ([#993](https://github.com/integrations/terraform-provider-github/pull/993)) -- Add `nil` check for `plan` field of `github_organization` data source ([#1016](https://github.com/integrations/terraform-provider-github/pull/1016)) - - -## 4.19.0 (Dec 13, 2021) - -ENHANCEMENTS: - -- Export `branches` attribute of `github_repository` resource ([[#959](https://github.com/integrations/terraform-provider-github/pull/959)]) -- Add `require_conversation_resolution` support for `github_branch_protection` resource ([[#904](https://github.com/integrations/terraform-provider-github/pull/904)]) - -BUG FIXES: - -- Adjust length requirement to `topics` option for `github_repository` ([[#996](https://github.com/integrations/terraform-provider-github/pull/996)]) -- Add `required_linear_history` support for `github_branch_protection` resource ([[#935](https://github.com/integrations/terraform-provider-github/pull/935)]) - - -## 4.18.2 (Nov 30, 2021) - -BUG FIXES: - -- Add length requirement to `name` option for `github_repository` ([[#965](https://github.com/integrations/terraform-provider-github/pull/965)]) -- Various documentation fixes 🙇 - -## 4.18.1 (Nov 22, 2021) - -BUG FIXES: - -- Add length requirement to `topics` option for `github_repository` ([[#951](https://github.com/integrations/terraform-provider-github/pull/951)]) -- Add pagination to `selected_repositories` option for `github_actions_runner_group` ([[#970](https://github.com/integrations/terraform-provider-github/pull/970)]) -- Add handling for new `node_id` format introduced to the GitHub GraphQL API (`github_repository`) ([[#914](https://github.com/integrations/terraform-provider-github/pull/914)]) - -## 4.18.0 (Nov 8, 2021) - -ENHANCEMENTS: - -- **New Resource:** `github_actions_organization_permissions` ([[#920](https://github.com/integrations/terraform-provider-github/pull/920)]) - -BUG FIXES: - -- Add newline compatbility to GitHub App provider authentication ([[#931](https://github.com/integrations/terraform-provider-github/pull/931)]) -- Fix `strict` setting of `required_status_checks` for `github_branch_protection` resource ([[#880](https://github.com/integrations/terraform-provider-github/issues/880)]) - - -## 4.17.0 (Oct 17, 2021) - -ENHANCEMENTS: - -- **New Resource:** `github_repository_autolink_reference` ([[#924](https://github.com/integrations/terraform-provider-github/pull/924)]) -- **New Data Sources** `github_users` ([#900](https://github.com/integrations/terraform-provider-github/pull/900)) -- Add `allow_auto_merge` option for `github_repository` ([#923](https://github.com/integrations/terraform-provider-github/pull/923)) - -BUG FIXES: - -- Various documentation fixes 🙇 - -## 4.16.0 (Oct 5, 2021) - -ENHANCEMENTS: - -* **New Data Source:** `github_repository_file` ([#896](https://github.com/integrations/terraform-provider-github/pull/896)) -- Add `write_delay_ms` provider option [#907](https://github.com/integrations/terraform-provider-github/pull/907)) - -BUG FIXES: - -- Update `go-github` to v39.0.0 ([#905](https://github.com/integrations/terraform-provider-github/pull/905)) - -## 4.15.1 (Sep 23, 2021) - -BUG FIXES: - -- Revert suppression of `etag` changes for `github_repository` resources ([[#910](https://github.com/integrations/terraform-provider-github/issues/910)]) - -## 4.15.0 (Sep 22, 2021) - -ENHANCEMENTS: - -- **New Resource:** `github_actions_organization_secret_repositories` ([[#882](https://github.com/integrations/terraform-provider-github/issues/882)]) -- **New Resource:** `github_actions_runner_group` ([[#821](https://github.com/integrations/terraform-provider-github/issues/821)]) -- Add `require_linear_history` to `github_branch_protection` resource ([[#887](https://github.com/integrations/terraform-provider-github/issues/887)]) -- Add `branches` attribute to `github_repository` resource ([[#892](https://github.com/integrations/terraform-provider-github/issues/892)]) - - -BUG FIXES: - -- Update documentation for `d/github_ip_ranges` ([#895](https://github.com/integrations/terraform-provider-github/issues/895)) -- Update `go-github` to v38 ([#901](https://github.com/integrations/terraform-provider-github/issues/901)) -- Suppress `etag` changes for `github_repository` resources ([[#909](https://github.com/integrations/terraform-provider-github/issues/909)]) - - -## 4.14.0 (Sep 2, 2021) - -BUG FIXES: - -- Adds support for recreating a `github_team_repository` when repository is renamed ([#870](https://github.com/integrations/terraform-provider-github/issues/870)) -- Adds logging of configured authentication on provider startup ([#867](https://github.com/integrations/terraform-provider-github/issues/867)) -- Update documentation for `github_ip_ranges` data source ([#857](https://github.com/integrations/terraform-provider-github/issues/857)) -- Add support for IPv6 addresses returned by `github_ip_ranges` data source ([#883](https://github.com/integrations/terraform-provider-github/issues/883)) -- Update `go-github` to v37.0.0 ([#893](https://github.com/integrations/terraform-provider-github/issues/893)) - -## 4.13.0 (Jul 26, 2021) - -BUG FIXES: - -- Fix setting `vulnerability_alerts` on private `github_repository` creation ([#768](https://github.com/integrations/terraform-provider-github/issues/768)) - -ENHANCEMENTS: - -- Add `restrict_dismissals` option to `github_branch_protection` resource ([#839](https://github.com/integrations/terraform-provider-github/issues/839)) - -## 4.12.2 (Jul 12, 2021) - -BUG FIXES: - -- Update `go-github` to v36.0.0 ([#841](https://github.com/integrations/terraform-provider-github/issues/841)) - -## 4.12.0 (Jun 18, 2021) - -ENHANCEMENTS: - -* **New Resource:** `github_actions_environment_secret` ([[#805](https://github.com/integrations/terraform-provider-github/issues/805)]) -* **New Resource:** `github_repository_environment` ([[#805](https://github.com/integrations/terraform-provider-github/issues/805)]) -* Add `members` field to `github_organization` data source ([[#811](https://github.com/integrations/terraform-provider-github/issues/811)]) -* Add `repositories` field to `github_team` data source ([[#791](https://github.com/integrations/terraform-provider-github/issues/791)]) -* Add `repositories` field to `github_organization_teams` data source ([[#791](https://github.com/integrations/terraform-provider-github/issues/791)]) - - -BUG FIXES: - -- Document incompatibility between `github_app_installation_repository` and GitHub App authentication ([#818](https://github.com/integrations/terraform-provider-github/issues/818)) -- Document migration from `hashicorp/terraform-provider-github ([#816](https://github.com/integrations/terraform-provider-github/issues/816)) -- Allow users and apps to also be applied to push restrictions for `github_branch_protection` ([#824](https://github.com/integrations/terraform-provider-github/issues/824)) - - -## 4.11.0 (Jun 7, 2021) - -BREAKING CHANGES: - -- Allow PEM data to be passed directly for GitHub App provider authentication ([#803](https://github.com/integrations/terraform-provider-github/issues/803)) - -ENHANCEMENTS: - -- Add `encrypted_value` field to `github_actions_secret` and `github_actions_organization_secret` resources ([#807](https://github.com/integrations/terraform-provider-github/issues/807)) - -BUG FIXES: - -- Fix error handling when branch does not exist for `github_branch` resource ([#806](https://github.com/integrations/terraform-provider-github/issues/806)) - -## 4.10.1 (May 25, 2021) - -BUG FIXES: - -* Improve documentation for provider authentication options ([#801](https://github.com/integrations/terraform-provider-github/issues/801)) - - -## 4.10.0 (May 21, 2021) - -ENHANCEMENTS: - -* Add GitHub App authentication option to provider ([#753](https://github.com/integrations/terraform-provider-github/issues/753)) -* Add Actions and Dependabot IP ranges to `github_ip_ranges` data source ([#784](https://github.com/integrations/terraform-provider-github/issues/784)) -* Add additional fields to `github_repository` data source ([#778](https://github.com/integrations/terraform-provider-github/issues/778)) - -## 4.9.4 (May 11, 2021) - -BUG FIXES: - -- Add EMU support by allowing `internal` visibility to be configured for `github_repository` ([#781](https://github.com/integrations/terraform-provider-github/issues/781)) -- Update `go-github` to 35.1.0 ([#772](https://github.com/integrations/terraform-provider-github/issues/772)) - -## 4.9.3 (May 7, 2021) - -BUG FIXES: - -- Mark `slug` as `computed` when `name` is changed for `github_team` ([#757](https://github.com/integrations/terraform-provider-github/issues/757)) - -## 4.9.2 (April 18, 2021) - -BUG FIXES: - -- correct visibility for repositories created via a template ([#761](https://github.com/integrations/terraform-provider-github/issues/761)) - - -## 4.9.1 (April 17, 2021) - -BUG FIXES: - -- Bump Go version to 1.16 for acceptance tests and darwin/arm64 releases -- Update acceptance tests to v2.2.0 -- Re-instate releases of darwin/arm64 - -## 4.9.0 (April 17, 2021) - -ENHANCEMENTS: - -* **New Data Sources** `github_repository_pull_request` / `github_repository_pull_requests` ([#739](https://github.com/integrations/terraform-provider-github/issues/739)) -* **New Resource** `github_repository_pull_request` ([#739](https://github.com/integrations/terraform-provider-github/issues/739)) -* Add `repositories` attribute for `github_organization` data source ([#750](https://github.com/integrations/terraform-provider-github/issues/750)) -* Add import functionality for `github_actions_organization_secret` ([#745](https://github.com/integrations/terraform-provider-github/issues/745)) - -BUG FIXES: - -- Detect and overwrite value drift for `github_actions_secret` and `github_actions_organization_secret` ([#740](https://github.com/integrations/terraform-provider-github/pull/740)) -- Do not destroy repositories when `name` attribute changes ([#699](https://github.com/integrations/terraform-provider-github/pull/699)) - -## 4.8.0 (April 9, 2021) - -BUG FIXES: - -- Deprecate `organization` / `GITHUB_ORGANIZATION` provider configuration options ([#735](https://github.com/integrations/terraform-provider-github/pull/735)) - -## 4.7.0 (April 9, 2021) - -REGRESSIONS: - -- new repositories created via a template have a public visibility ([#758](https://github.com/integrations/terraform-provider-github/issues/758)) - - workaround: a subsequent plan / apply will set the visibility to what is configured - - fix: see v4.9.2 - -ENHANCEMENTS: - -* **New Data Source** `github_organization_teams` ([#725](https://github.com/integrations/terraform-provider-github/issues/725)) - -BUG FIXES: - -- Set visibility on create instead of update for `github_repository` ([#746](https://github.com/integrations/terraform-provider-github/pull/746)) -- Various documentation updates - -## 4.6.0 (March 23, 2021) - -ENHANCEMENTS: - -* **New Resource** `github_app_installation_repository` ([#690](https://github.com/integrations/terraform-provider-github/issues/690)) - -BUG FIXES: - -- Fix panic for `github_repository_file` ([#732](https://github.com/integrations/terraform-provider-github/pull/732)) -- Improve error messaging for `github_branch` ([#734](https://github.com/integrations/terraform-provider-github/pull/734)) -- Improve error messaging for `github_branch_protection` ([#721](https://github.com/integrations/terraform-provider-github/pull/721)) -- Fix update operation for `github_default_branch` ([#719](https://github.com/integrations/terraform-provider-github/pull/719)) -- Add name validation for `github_actions_organization_secret` ([#714](https://github.com/integrations/terraform-provider-github/pull/714)) - - -## 4.5.2 (March 16, 2021) - -BUG FIXES: - -- Fix updating `default_branch` on `github_repository` ([#719](https://github.com/integrations/terraform-provider-github/pull/719)) - - -## 4.5.1 (March 3, 2021) - -BUG FIXES: - -- Fix `github_branch_protection` import by repository node ID and pattern ([#713](https://github.com/integrations/terraform-provider-github/pull/713)) -- Add pagination when retrieving team members for `data_source_github_team` ([#702](https://github.com/integrations/terraform-provider-github/pull/702)) - - -## 4.5.0 (February 17, 2021) - -ENHANCEMENTS: - -- Add ability for `github_team_repository` to accept slug as a valid `team_id` ([#693](https://github.com/integrations/terraform-provider-github/pull/693)) - -BUG FIXES: - -- Add more context to error messaging for `github_branch_protection` ([#691](https://github.com/integrations/terraform-provider-github/pull/691)) -- Satisfy linter recommendation for `github_branch_protection` ([#694](https://github.com/integrations/terraform-provider-github/pull/694)) - -## 4.4.0 (February 5, 2021) - -BUG FIXES: - -- Add `create_default_maintainer` option to `github_team` ([#527](https://github.com/integrations/terraform-provider-github/pull/527)), ([#104](https://github.com/integrations/terraform-provider-github/pull/104)), ([#130](https://github.com/integrations/terraform-provider-github/pull/130)) -- Add diff-suppression option to `repository_collaborator` ([#683](https://github.com/integrations/terraform-provider-github/pull/683)) - - -## 4.3.2 (February 2, 2021) - -BUG FIXES: - -* Improved detection of repository name for `github_branch_protection` ([#684](https://github.com/integrations/terraform-provider-github/issues/684)) -* Reverts error handling in provider configuration ([#685](https://github.com/integrations/terraform-provider-github/issues/685)) - -## 4.3.1 (January 22, 2021) - -REGRESSIONS: - -- provider configuration breaks for individual accounts ([#678](https://github.com/integrations/terraform-provider-github/issues/678)) - -BUG FIXES: - -* Send valid payload when editing a repository resource with `github_branch_default` ([#666](https://github.com/integrations/terraform-provider-github/issues/666)) -* Add handling to surface errors in provider configuration ([#668](https://github.com/integrations/terraform-provider-github/issues/668)) - -## 4.3.0 (January 14, 2021) - -ENHANCEMENTS: - -* **New Resource** `github_branch_protection_v3` ([#642](https://github.com/integrations/terraform-provider-github/issues/642)) -* Add `pages` feature to `github_repository` ([#490](https://github.com/integrations/terraform-provider-github/issues/490)) - - -## 4.2.0 (January 07, 2021) - -BREAKING CHANGES: - -- Project transfer from `terraform-providers` organization to `integrations` - - See [#652](https://github.com/integrations/terraform-provider-github/issues/652) for migration steps and [#656](https://github.com/integrations/terraform-provider-github/issues/656) for discussion - -ENHANCEMENTS: - -- Add `allowDeletions` and `allowsForcePushes` to `github_branch_protection` ([#623](https://github.com/integrations/terraform-provider-github/pull/623)) -- Add GitHub App actor support to `github_branch_protection` ([#615](https://github.com/integrations/terraform-provider-github/pull/615)) - -BUG FIXES: - -- Allow `required_status_checks` `strict` to be `false` for `github_branch_protection` ([#614](https://github.com/integrations/terraform-provider-github/pull/614)) -- Remove `ForceNew` on template-related options for `github_repository` ([#609](https://github.com/integrations/terraform-provider-github/pull/609)) -- Fix parsing of input during imports of `github_branch_protection` ([#610](https://github.com/integrations/terraform-provider-github/pull/610)) -- `github_repository_file` resource no longer iterates through all commits ([#644](https://github.com/integrations/terraform-provider-github/pull/644)) - -## 4.1.0 (December 01, 2020) - -ENHANCEMENTS: - -- Add `github_actions_organization_secret` resource ([#261](https://github.com/integrations/terraform-provider-github/pull/261)) -- Add `github_repository_milestone` resource ([#470](https://github.com/integrations/terraform-provider-github/pull/470)) -- Add `github_repository_milestone` data source ([#470](https://github.com/integrations/terraform-provider-github/pull/470)) -- Add `github_project_card` resource ([#460](https://github.com/integrations/terraform-provider-github/pull/460)) -- Add `github_branch_default` resource ([#194](https://github.com/integrations/terraform-provider-github/pull/194)) - - -## 4.0.1 (November 18, 2020) - -BUG FIXES: - -- `github_team` data source query no longer iterates through a list of teams ([#579](https://github.com/integrations/terraform-provider-github/pull/579)) -- `github_repository_file` resource no longer iterates through all commits ([#589](https://github.com/integrations/terraform-provider-github/pull/589)) -- fix parsing of `repo:pattern` format during `github_branch_protection` import ([#599](https://github.com/integrations/terraform-provider-github/pull/599)) - - -## 4.0.0 (November 10, 2020) - -REGRESSIONS: - -- fails parsing of `repo:pattern` format during `github_branch_protection` import ([#597](https://github.com/integrations/terraform-provider-github/issues/597)) - -BREAKING CHANGES: - -- `pattern` replaces `branch` in changes to `github_branch_protection` introduced in `v3.1.0` ([#566](https://github.com/integrations/terraform-provider-github/issues/566)) -- `dismissal_restrictions` documented for `github_branch_protection` ([#569](https://github.com/integrations/terraform-provider-github/pull/569)) -- project license changes from MPL2 to MIT ([#591](https://github.com/integrations/terraform-provider-github/pull/591)) - -BUG FIXES: - -- `repository_id` for `github_branch_protection` accepts repository name as well as node ID ([#593](https://github.com/integrations/terraform-provider-github/issues/593)) - -ENHANCEMENTS: - -- Add support to get currently authenticated user to `data_source_github_user` ([#261](https://github.com/integrations/terraform-provider-github/pull/261)) -- Add importing to `github_organization_webhook` ([#487](https://github.com/integrations/terraform-provider-github/pull/487)) - - -## 3.1.0 (October 12, 2020) - -REGRESSIONS: - -- undocumented, breaking configuration changes to `github_branch_protection` ([#566](https://github.com/integrations/terraform-provider-github/issues/566)) -- slowed performance of `github_branch_protection` ([#567](https://github.com/integrations/terraform-provider-github/issues/567)) -- change to default branch breaks refresh of existing `github_repository_file` resources ([#564](https://github.com/integrations/terraform-provider-github/issues/564)) - -BREAKING CHANGES: - -- Deprecate `anonymous` Flag For Provider Configuration ([#506](https://github.com/integrations/terraform-provider-github/issues/506)) - -BUG FIXES: - -- re-instante resources unavailable in the context of an organization ([#501](https://github.com/integrations/terraform-provider-github/issues/501)) -- allow overwrite-on-create behaviour for `github_repository_file` resource ([#459](https://github.com/integrations/terraform-provider-github/issues/459)) - - -ENHANCEMENTS: - -- update `go-github` to `v32.1.0` ([#475](https://github.com/integrations/terraform-provider-github/issues/475)) -- add `vulnerability_alerts` to `github_repository` ([#444](https://github.com/integrations/terraform-provider-github/issues/444)) -- add `archive_on_destroy` to `github_repository` ([#432](https://github.com/integrations/terraform-provider-github/issues/432)) -- uplift `branch_protection` to GraphQL ([#337](https://github.com/integrations/terraform-provider-github/issues/337)) - - -## 3.0.0 (September 08, 2020) - -BREAKING CHANGES: - -- `token` becomes optional -- `organization` no longer deprecated -- `individual` and `anonymous` removed -- `owner` inferred from `organization` -- `base_url` provider parameter no longer requires `/api/v3` suffix - -BUG FIXES: - -- `terraform validate` fails because of missing token ([#503](https://github.com/integrations/terraform-provider-github/issues/503)) -- organization support for various resources ([#501](https://github.com/integrations/terraform-provider-github/issues/501)) - -ENHANCEMENTS: - -* **New Data Source** `github_organization` ([#521](https://github.com/integrations/terraform-provider-github/issues/521)) - - -## 2.9.2 (July 14, 2020) - -- Adds deprecation of `anonymous` flag for provider configuration ahead of next major release ([#506](https://github.com/integrations/terraform-provider-github/issues/506)) -- Adds deprecation of `individual` flag for provider configuration ahead of next major release ([#512](https://github.com/integrations/terraform-provider-github/issues/512)) - -## 2.9.1 (July 01, 2020) - -BUG FIXES: - -- Reverts changes introduced in v2.9.0, deferring to the next major release - -## 2.9.0 (June 29, 2020) - -**NOTE**: This release introduced a provider-level breaking change around `anonymous` use. -See [here](https://github.com/integrations/terraform-provider-github/pull/464#discussion_r427961161) for details and [here](https://github.com/integrations/terraform-provider-github/issues/502#issuecomment-652379322) to discuss a fix. - -ENHANCEMENTS: -* Add Ability To Manage Resources For Non-Organization Accounts ([#464](https://github.com/integrations/terraform-provider-github/issues/464)) -* resource/github_repository: Add "internal" Visibility Option ([#454](https://github.com/integrations/terraform-provider-github/issues/454)) - -## 2.8.1 (June 09, 2020) - -BUG FIXES: - -* resource/github_repository_file: Reduce API requests when looping through commits ([[#466](https://github.com/integrations/terraform-provider-github/issues/466)]) -* resource/github_repository: Fix `auto_init` Destroying Repositories ([[#317](https://github.com/integrations/terraform-provider-github/issues/317)]) -* resource/github_repository_deploy_key: Fix acceptance test approach ([[#471](https://github.com/integrations/terraform-provider-github/issues/471)]) -* resource/github_actions_secret: Fix Case Where Secret Removed Outside Of Terraform ([[#482](https://github.com/integrations/terraform-provider-github/issues/482)]) -* Documentation Addition Of `examples/` Directory - -## 2.8.0 (May 15, 2020) - -BUG FIXES: - -* resource/github_branch_protection: Prevent enabling `dismissal_restrictions` in GitHub console if `dismissal_users` and `dismissal_teams` are not set ([#453](https://github.com/integrations/terraform-provider-github/issues/453)) -* resource/github_repository_collaborator: Allow modifying permissions from `maintain` and `triage` ([#457](https://github.com/integrations/terraform-provider-github/issues/457)) -* Documentation Fix for `github_actions_public_key` data-source ([#458](https://github.com/integrations/terraform-provider-github/issues/458)) -* Documentation Fix for `github_branch_protection` resource ([#410](https://github.com/integrations/terraform-provider-github/issues/410)) -* Documentation Layout Fix for `github_ip_ranges` and `github_membership` data sources ([#423](https://github.com/integrations/terraform-provider-github/issues/423)) -* Documentation Fix for `github_repository_file` import ([#443](https://github.com/integrations/terraform-provider-github/issues/443)) -* Update `go-github` to `v31.0.0` ([#424](https://github.com/integrations/terraform-provider-github/issues/424)) - -ENHANCEMENTS: -* **New Data Source** `github_organization_team_sync_groups` ([#400](https://github.com/integrations/terraform-provider-github/issues/400)) -* **New Resource** `github_team_sync_group_mapping` ([#400](https://github.com/integrations/terraform-provider-github/issues/400)) - -## 2.7.0 (May 01, 2020) - -BUG FIXES: - -* Add Missing Acceptance Test ([#427](https://github.com/integrations/terraform-provider-github/issues/427)) - -ENHANCEMENTS: - -* Add GraphQL Client ([#331](https://github.com/integrations/terraform-provider-github/issues/331)) -* **New Data Source** `github_branch` ([#364](https://github.com/integrations/terraform-provider-github/issues/364)) -* **New Resource** `github_branch` ([#364](https://github.com/integrations/terraform-provider-github/issues/364)) - - -## 2.6.1 (April 07, 2020) - -BUG FIXES: - -* Documentation Fix For Option To Manage `Delete Branch on Merge` ([#408](https://github.com/integrations/terraform-provider-github/issues/408)) -* Documentation Fix For `github_actions_secret` / `github_actions_public_key` ([#413](https://github.com/integrations/terraform-provider-github/issues/413)) - -## 2.6.0 (April 03, 2020) - -ENHANCEMENTS: - -* resource/github_repository: Introduce Option To Manage `Delete Branch on Merge` ([#399](https://github.com/integrations/terraform-provider-github/issues/399)) -* resource/github_repository: Configure Repository As Template ([#357](https://github.com/integrations/terraform-provider-github/issues/357)) -* **New Data Source** `github_membership` ([#396](https://github.com/integrations/terraform-provider-github/issues/396)) - -## 2.5.1 (April 02, 2020) - -BUG FIXES: - -* Fix Broken Link For `github_actions_secret` Documentation ([#405](https://github.com/integrations/terraform-provider-github/issues/405)) - -## 2.5.0 (March 30, 2020) - -REGRESSION: - -* `go-github` `v29.03` is incompatible with versions of GitHub Enterprise Server prior to `v2.21.5`. ([[#404](https://github.com/integrations/terraform-provider-github/issues/404)]) - -ENHANCEMENTS: - -* Add `apps` To `github_branch_protection` Restrictions -* **New Data Source** `github_actions_public_key` ([[#362](https://github.com/integrations/terraform-provider-github/issues/362)]) -* **New Data Source** `github_actions_secrets` ([[#362](https://github.com/integrations/terraform-provider-github/issues/362)]) -* **New Resource:** `github_actions_secret` ([[#362](https://github.com/integrations/terraform-provider-github/issues/362)]) - -BUG FIXES: - -* Prevent Panic From DismissalRestrictions ([[#385](https://github.com/integrations/terraform-provider-github/issues/385)]) -* Update `go-github` to `v29.0.3` ([[#369](https://github.com/integrations/terraform-provider-github/issues/369)]) -* Update `go` to `1.13` ([[#372](https://github.com/integrations/terraform-provider-github/issues/372)]) -* Documentation Fixes For Consistency And Typography - - -## 2.4.1 (March 05, 2020) - -BUG FIXES: - -* Updates `go-github` to `v29` to unblock planned feature development ([#342](https://github.com/integrations/terraform-provider-github/issues/342)) -* Fixes `insecure_ssl` parameter behaviour for `github_organization_webhook` and `github_repository_webhook` ([#365](https://github.com/integrations/terraform-provider-github/issues/365)) -* Fixes label behaviour to not create new labels when renaming a `github_issue_label` ([#288](https://github.com/integrations/terraform-provider-github/issues/288)) - -## 2.4.0 (February 26, 2020) - -ENHANCEMENTS: - -* **New Data Source** `github_release` ([#356](https://github.com/integrations/terraform-provider-github/pull/356)) - -* **New Resource:** `github_repository_file` ([#318](https://github.com/integrations/terraform-provider-github/pull/318)) - -## 2.3.2 (February 05, 2020) - -BUG FIXES: - -* Handle repository 404 for `github_repository_collaborator` resource ([#348](https://github.com/integrations/terraform-provider-github/issues/348)) - -## 2.3.1 (January 27, 2020) - -BUG FIXES: - -* Add support for `triage` and `maintain` permissions in some resources ([#303](https://github.com/integrations/terraform-provider-github/issues/303)) - -## 2.3.0 (January 22, 2020) - -BUG FIXES: - -* `resource/resource_github_team_membership`: Prevent spurious diffs caused by upstream API change made on 17th January ([#325](https://github.com/integrations/terraform-provider-github/issues/325)) - -ENHANCEMENTS: - -* `resource/repository`: Added functionality to generate a new repository from a Template Repository ([#309](https://github.com/integrations/terraform-provider-github/issues/309)) - -## 2.2.1 (September 04, 2019) - -ENHANCEMENTS: - -* dependencies: Updated module `hashicorp/terraform` to `v0.12.7` ([#273](https://github.com/integrations/terraform-provider-github/issues/273)) -* `resource/github_branch_protection`: Will now return an error when users are not correctly added ([#158](https://github.com/integrations/terraform-provider-github/issues/158)) -* `provider`: Added optional `anonymous` attribute, and made `token` optional ([#255](https://github.com/integrations/terraform-provider-github/issues/255)) - -BUG FIXES: -* `resource/github_repository`: Allow setting `default_branch` to `master` on creation ([#150](https://github.com/integrations/terraform-provider-github/issues/150)) -* `resource/github_team_repository`: Validation of `team_id` ([#253](https://github.com/integrations/terraform-provider-github/issues/253)) -* `resource/github_team_membership`: Validation of `team_id` ([#253](https://github.com/integrations/terraform-provider-github/issues/253)) -* `resource/github_organization_webhook`: Properly set webhook secret in state ([#251](https://github.com/integrations/terraform-provider-github/issues/251)) -* `resource/github_repository_webhook`: Properly set webhook secret in state ([#251](https://github.com/integrations/terraform-provider-github/issues/251)) - -## 2.2.0 (June 28, 2019) - -FEATURES: - -* **New Data Source** `github_collaborators` ([#239](https://github.com/integrations/terraform-provider-github/issues/239)) - -ENHANCEMENTS: - -* `provider`: Added optional `individual` attribute, and made `organization` optional ([#242](https://github.com/integrations/terraform-provider-github/issues/242)) -* `resource/github_branch_protection`: Added `require_signed_commits` property ([#214](https://github.com/integrations/terraform-provider-github/issues/214)) - -BUG FIXES: - -* `resource/github_membership`: `username` property is now case insensitive ([#241](https://github.com/integrations/terraform-provider-github/issues/241)) -* `resource/github_repository`: `has_projects` can now be imported ([#237](https://github.com/integrations/terraform-provider-github/issues/237)) -* `resource/github_repository_collaborator`: `username` property is now case insensitive [[#241](https://github.com/integrations/terraform-provider-github/issues/241)) -* `resource/github_team_membership`: `username` property is now case insensitive ([#241](https://github.com/integrations/terraform-provider-github/issues/241)) - - -## 2.1.0 (May 15, 2019) - -ENHANCEMENTS: - -* `resource/github_repository`: Added validation for lowercase topics ([#223](https://github.com/integrations/terraform-provider-github/issues/223)) -* `resource/github_organization_webhook`: Added back removed `name` attribute, `name` is now flagged as `Removed` ([#226](https://github.com/integrations/terraform-provider-github/issues/226)) -* `resource/github_repository_webhook`: Added back removed `name` attribute, `name` is now flagged as `Removed` ([#226](https://github.com/integrations/terraform-provider-github/issues/226)) - -## 2.0.0 (May 02, 2019) - -* This release adds support for Terraform 0.12 ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) - -BREAKING CHANGES: - -* `resource/github_repository_webhook`: Removed `name` attribute ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) -* `resource/github_organization_webhook`: Removed `name` attribute ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) - -FEATURES: - -* **New Resource:** `github_organization_block` ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) -* **New Resource:** `github_user_invitation_accepter` ([#161](https://github.com/integrations/terraform-provider-github/issues/161)) -* `resource/github_branch_protection`: Added `required_approving_review_count` property ([#181](https://github.com/integrations/terraform-provider-github/issues/181)) - -BUG FIXES: - -* `resource/github_repository`: Prefill `auto_init` during import ([#154](https://github.com/integrations/terraform-provider-github/issues/154)) - -## 1.3.0 (September 07, 2018) - -FEATURES: - -* **New Resource:** `github_project_column` ([#139](https://github.com/integrations/terraform-provider-github/issues/139)) - -ENHANCEMENTS: - -* _all resources_: Use `Etag` to save API quota (~ 33%) ([#143](https://github.com/integrations/terraform-provider-github/issues/143)) -* _all resources_: Implement & use RateLimitTransport to avoid hitting API rate limits ([#145](https://github.com/integrations/terraform-provider-github/issues/145)) - -BUG FIXES: - -* `resource/github_issue_label`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) -* `resource/github_membership`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) -* `resource/github_repository_deploy_key`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) -* `resource/github_team`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) -* `resource/github_team_membership`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) -* `resource/github_team_repository`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) -* `resource/github_user_gpg_key`: Return genuine errors instead of ignoring them when reading existing resource ([#142](https://github.com/integrations/terraform-provider-github/issues/142)) - -## 1.2.1 (August 17, 2018) - -BUG FIXES: - -* `resource/github_repository`: Avoid spurious diff for `topics` ([#138](https://github.com/integrations/terraform-provider-github/issues/138)) - -## 1.2.0 (August 17, 2018) - -FEATURES: - -* **New Data Source:** `github_repository` ([#109](https://github.com/integrations/terraform-provider-github/issues/109)) -* **New Data Source:** `github_repositories` ([#129](https://github.com/integrations/terraform-provider-github/issues/129)) -* **New Resource:** `github_organization_project` ([#111](https://github.com/integrations/terraform-provider-github/issues/111)) -* **New Resource:** `github_repository_project` ([#115](https://github.com/integrations/terraform-provider-github/issues/115)) -* **New Resource:** `github_user_gpg_key` ([#120](https://github.com/integrations/terraform-provider-github/issues/120)) -* **New Resource:** `github_user_ssh_key` ([#119](https://github.com/integrations/terraform-provider-github/issues/119)) - -ENHANCEMENTS: - -* `provider`: Add `insecure` mode ([#48](https://github.com/integrations/terraform-provider-github/issues/48)) -* `data-source/github_ip_ranges`: Add importer IPs ([#100](https://github.com/integrations/terraform-provider-github/issues/100)) -* `resource/github_issue_label`: Add support for `description` ([#118](https://github.com/integrations/terraform-provider-github/issues/118)) -* `resource/github_repository`: Add support for `topics` ([#97](https://github.com/integrations/terraform-provider-github/issues/97)) -* `resource/github_team`: Expose `slug` ([#136](https://github.com/integrations/terraform-provider-github/issues/136)) -* `resource/github_team_membership`: Make role updatable ([#137](https://github.com/integrations/terraform-provider-github/issues/137)) - -BUG FIXES: - -* `resource/github_*`: Prevent crashing on invalid ID format ([#108](https://github.com/integrations/terraform-provider-github/issues/108)) -* `resource/github_organization_webhook`: Avoid spurious diff of `secret` ([#134](https://github.com/integrations/terraform-provider-github/issues/134)) -* `resource/github_repository`: Make non-updatable fields `ForceNew` ([#135](https://github.com/integrations/terraform-provider-github/issues/135)) -* `resource/github_repository_deploy_key`: Avoid spurious diff of `key` ([#132](https://github.com/integrations/terraform-provider-github/issues/132)) -* `resource/github_repository_webhook`: Avoid spurious diff of `secret` ([#133](https://github.com/integrations/terraform-provider-github/issues/133)) - - -## 1.1.0 (May 11, 2018) - -FEATURES: - -* **New Data Source:** `github_ip_ranges` ([#82](https://github.com/integrations/terraform-provider-github/issues/82)) - -ENHANCEMENTS: - -* `resource/github_repository`: Add support for archiving ([#64](https://github.com/integrations/terraform-provider-github/issues/64)) -* `resource/github_repository`: Add `html_url` ([#93](https://github.com/integrations/terraform-provider-github/issues/93)) -* `resource/github_repository`: Add `has_projects` ([#92](https://github.com/integrations/terraform-provider-github/issues/92)) -* `resource/github_team`: Add `parent_team_id` ([#54](https://github.com/integrations/terraform-provider-github/issues/54)) - -## 1.0.0 (February 20, 2018) - -ENHANCEMENTS: - -* `resource/github_branch_protection`: Add support for `require_code_owners_review` ([#51](https://github.com/integrations/terraform-provider-github/issues/51)) - -## 0.1.2 (February 12, 2018) - -BUG FIXES: - -* `resource/github_membership`: Fix a crash when bad import input is given ([#72](https://github.com/integrations/terraform-provider-github/issues/72)) - -## 0.1.1 (July 18, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* `resource/github_branch_protection`: The `include_admin` attributes haven't been working for quite some time due to upstream API changes. These attributes are now deprecated in favor of the new top-level `enforce_admins` attribute. The `include_admin` attributes currently have no affect on the resource, and will yield a `DEPRECATED` notice to the user. - -IMPROVEMENTS: - -* `resource/github_repository`: Allow updating default_branch ([#23](https://github.com/integrations/terraform-provider-github/issues/23)) -* `resource/github_repository`: Add license_template and gitignore_template ([#24](https://github.com/integrations/terraform-provider-github/issues/24)) -* `resource/github_repository_webhook`: Add import ([#29](https://github.com/integrations/terraform-provider-github/issues/29)) -* `resource/github_branch_protection`: Support enforce_admins ([#26](https://github.com/integrations/terraform-provider-github/issues/26)) -* `resource/github_team`: Supports managing a team's LDAP DN in GitHub Enterprise ([#39](https://github.com/integrations/terraform-provider-github/issues/39)) - -BUG FIXES: - -* `resource/github_branch_protection`: Fix crash on nil values ([#26](https://github.com/integrations/terraform-provider-github/issues/26)) - -## 0.1.0 (June 20, 2017) - -FEATURES: - -* **New Resource:** `github_repository_deploy_key` [[#15215](https://github.com/integrations/terraform-provider-github/issues/15215)](https://github.com/hashicorp/terraform/pull/15215) - -IMPROVEMENTS: - -* `resource/github_repository`: Adding merge types ([#1](https://github.com/integrations/terraform-provider-github/issues/1)) -* `data-source/github_user` and `data-source/github_team`: Added attributes ([#2](https://github.com/integrations/terraform-provider-github/issues/2)) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3a64696bc2..f9dded31d4 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,21 +14,21 @@ appearance, race, religion, or sexual identity and orientation. Examples of behavior that contributes to creating a positive environment include: -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members +- Using welcoming and inclusive language +- Being respectful of differing viewpoints and experiences +- Gracefully accepting constructive criticism +- Focusing on what is best for the community +- Showing empathy towards other community members Examples of unacceptable behavior by participants include: -* The use of sexualized language or imagery and unwelcome sexual attention or +- The use of sexualized language or imagery and unwelcome sexual attention or advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic +- Trolling, insulting/derogatory comments, and personal or political attacks +- Public or private harassment +- Publishing others' private information, such as a physical or electronic address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a +- Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities @@ -55,7 +55,7 @@ a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by contacting the project team at opensource@github.com. All +reported by contacting the project team at . All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. @@ -68,9 +68,9 @@ members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html +available at [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a924c1be9f..d6a3ebf64c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,8 +13,9 @@ Before submitting an issue or a pull request, please search the repository for e 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. Push to your fork and submit a pull request. -5. Pat yourself on the back and wait for your pull request to be reviewed and merged. +4. Make sure the documentation has been updated, and run `make generatedocs`. +5. Push to your fork and submit a pull request. +6. 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: @@ -33,9 +34,9 @@ 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 diff --git a/GNUmakefile b/GNUmakefile index 0409d0b9ed..73891ad622 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,10 +1,11 @@ SWEEP?=repositories,teams PKG_NAME=github TEST?=./$(PKG_NAME)/... -WEBSITE_REPO=github.com/hashicorp/terraform-website COVERAGEARGS?=-race -coverprofile=coverage.txt -covermode=atomic +RUMDL_ARGS?=--output-format text + # VARIABLE REFERENCE: # # Test-specific variables: @@ -28,7 +29,7 @@ endif default: build tools: - go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.10.1 + go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@latest build: lintcheck CGO_ENABLED=0 go build -ldflags="-s -w" ./... @@ -65,18 +66,29 @@ sweep: @echo "WARNING: This will destroy infrastructure. Use only in development accounts." go test $(TEST) -v -sweep=$(SWEEP) $(SWEEPARGS) -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) +generatedocs: + @cd tools; go generate ./... -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) +validatedocs: + @cd tools; go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs validate --provider-dir .. + +fmtdocs: + @rumdl fmt --fix ./docs + +lintdocs: validatedocs + @rumdl check $(RUMDL_ARGS) ./docs + +checkdocs: generatedocs + @git diff --quiet ||\ + { echo "New file modification detected in the Git working tree. Please check in before commit."; git --no-pager diff --name-only | uniq | awk '{print " - " $$0}'; \ + if [ "${CI}" = true ]; then\ + exit 1;\ + fi;} + +mdfmt: + @rumdl fmt --fix . + +mdlint: + @rumdl check $(RUMDL_ARGS) . -.PHONY: build test testacc fmt lint lintcheck tools website website-test sweep +.PHONY: build test testacc fmt lint lintcheck tools sweep generatedocs validatedocs fmtdocs lintdocs checkdocs mdfmt mdlint diff --git a/README.md b/README.md index 6e9aff2259..3605aee51b 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,21 @@ # Terraform Provider GitHub -========================= - +| | | - - -This project is used to manipulate GitHub resources (repositories, teams, files, etc.) using Terraform. Its Terraform Registry page can be found [here](https://registry.terraform.io/providers/integrations/github/). +This project is used to manipulate GitHub resources (repositories, teams, files, etc.) using Terraform; it can be found in the [Terraform Registry](https://registry.terraform.io/providers/integrations/github). ## Requirements - [Terraform](https://www.terraform.io/downloads.html) 1.x -- [Go](https://golang.org/doc/install) 1.26.x (to build the provider plugin) +- [Go](https://golang.org/doc/install) 1.24.x (to build the provider plugin) ## Usage -Detailed documentation for the GitHub provider can be found [here](https://registry.terraform.io/providers/integrations/github). +Detailed documentation for the GitHub provider can be found in the [Terraform Registry](https://registry.terraform.io/providers/integrations/github). ## Contributing -Detailed documentation for contributing to the GitHub provider can be found [here](CONTRIBUTING.md). +Detailed documentation for contributing to the GitHub provider can be found in the [contributing guide](CONTRIBUTING.md). ## Roadmap diff --git a/RELEASE.md b/RELEASE.md index 1384bf3e01..1844a3424c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,4 +1,4 @@ -## Release Flow +# Release Flow The release process uses GitHub Actions and [`goreleaser`](https://github.com/goreleaser/goreleaser) to build, sign, and upload provider binaries to a GitHub release. Release are triggered by a tag with the pattern `v*` (e.g. `v1.2.3`); these tags may only be created from the default branch (`main`) or branches that match the pattern `release-v*`. diff --git a/SECURITY.md b/SECURITY.md index 798d64bce9..b83f8bf3b7 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -1,3 +1,5 @@ +# Security Policy + If you discover a security issue in this repo, please submit it through the [GitHub Security Bug Bounty](https://hackerone.com/github) Thanks for helping make this project safe for everyone. diff --git a/docs/data-sources/actions_environment_public_key.md b/docs/data-sources/actions_environment_public_key.md new file mode 100644 index 0000000000..7d4283825f --- /dev/null +++ b/docs/data-sources/actions_environment_public_key.md @@ -0,0 +1,28 @@ +--- +page_title: "github_actions_environment_public_key (Data Source) - 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" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. +- `environment` - (Required) Name of the environment to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/docs/data-sources/actions_environment_secrets.md b/docs/data-sources/actions_environment_secrets.md new file mode 100644 index 0000000000..06f0989ba3 --- /dev/null +++ b/docs/data-sources/actions_environment_secrets.md @@ -0,0 +1,27 @@ +--- +page_title: "github_actions_environment_secrets (Data Source) - GitHub" +description: |- + Get Actions secrets of the repository environment +--- + +# github\_actions\_environment\_secrets + +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 diff --git a/docs/data-sources/actions_environment_variables.md b/docs/data-sources/actions_environment_variables.md new file mode 100644 index 0000000000..a5076bf32e --- /dev/null +++ b/docs/data-sources/actions_environment_variables.md @@ -0,0 +1,28 @@ +--- +page_title: "github_actions_environment_variables (Data Source) - GitHub" +description: |- + Get Actions variables of the repository environment +--- + +# github\_actions\_environment\_variables + +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 diff --git a/website/docs/d/actions_organization_oidc_subject_claim_customization_template.html.markdown b/docs/data-sources/actions_organization_oidc_subject_claim_customization_template.md similarity index 70% rename from website/docs/d/actions_organization_oidc_subject_claim_customization_template.html.markdown rename to docs/data-sources/actions_organization_oidc_subject_claim_customization_template.md index 30da16efd7..f67d5f083d 100644 --- a/website/docs/d/actions_organization_oidc_subject_claim_customization_template.html.markdown +++ b/docs/data-sources/actions_organization_oidc_subject_claim_customization_template.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: actions_organization_oidc_subject_claim_customization_template" +page_title: "github_actions_organization_oidc_subject_claim_customization_template (Data Source) - GitHub" description: |- Get a GitHub Actions organization OpenID Connect customization template --- @@ -11,7 +10,7 @@ Use this data source to retrieve the OpenID Connect subject claim customization ## Example Usage -```hcl +```terraform data "github_actions_organization_oidc_subject_claim_customization_template" "example" { } ``` @@ -20,4 +19,4 @@ data "github_actions_organization_oidc_subject_claim_customization_template" "ex ## Attributes Reference - * `include_claim_keys` - The list of OpenID Connect claim keys. +- `include_claim_keys` - The list of OpenID Connect claim keys. diff --git a/docs/data-sources/actions_organization_public_key.md b/docs/data-sources/actions_organization_public_key.md new file mode 100644 index 0000000000..5078afdff5 --- /dev/null +++ b/docs/data-sources/actions_organization_public_key.md @@ -0,0 +1,20 @@ +--- +page_title: "github_actions_organization_public_key (Data Source) - GitHub" +description: |- + Get information on a GitHub Actions Organization Public Key. +--- + +# github_actions_organization_public_key (Data Source) + +Use this data source to retrieve information about a GitHub Actions Organization public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an organization to retrieve it's action public key. + +## Example Usage + +```terraform +data "github_actions_organization_public_key" "example" {} +``` + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/website/docs/d/actions_organization_registration_token.html.markdown b/docs/data-sources/actions_organization_registration_token.md similarity index 67% rename from website/docs/d/actions_organization_registration_token.html.markdown rename to docs/data-sources/actions_organization_registration_token.md index 937afccfb9..1d7a958c1d 100644 --- a/website/docs/d/actions_organization_registration_token.html.markdown +++ b/docs/data-sources/actions_organization_registration_token.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: actions_organization_registration_token" +page_title: "github_actions_organization_registration_token (Data Source) - GitHub" description: |- Get a GitHub Actions organization registration token. --- @@ -11,7 +10,7 @@ Use this data source to retrieve a GitHub Actions organization registration toke ## Example Usage -```hcl +```terraform data "github_actions_organization_registration_token" "example" { } ``` @@ -20,5 +19,5 @@ data "github_actions_organization_registration_token" "example" { ## Attributes Reference - * `token` - The token that has been retrieved. - * `expires_at` - The token expiration date. +- `token` - The token that has been retrieved. +- `expires_at` - The token expiration date. diff --git a/website/docs/d/actions_organization_secrets.html.markdown b/docs/data-sources/actions_organization_secrets.md similarity index 50% rename from website/docs/d/actions_organization_secrets.html.markdown rename to docs/data-sources/actions_organization_secrets.md index 840ab2cfc9..5a2fd5ccf7 100644 --- a/website/docs/d/actions_organization_secrets.html.markdown +++ b/docs/data-sources/actions_organization_secrets.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_secrets" +page_title: "github_actions_organization_secrets (Data Source) - GitHub" description: |- Get actions secrets of the organization --- @@ -11,7 +10,7 @@ Use this data source to retrieve the list of secrets of the organization. ## Example Usage -```hcl +```terraform data "github_actions_organization_secrets" "example" { } ``` @@ -20,9 +19,8 @@ data "github_actions_organization_secrets" "example" { ## Attributes Reference - * `secrets` - list of secrets for the repository - * `name` - Secret name - * `visibility` - Secret visibility - * `created_at` - Timestamp of the secret creation - * `updated_at` - Timestamp of the secret last update - +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/docs/data-sources/actions_organization_variables.md b/docs/data-sources/actions_organization_variables.md new file mode 100644 index 0000000000..9af1d95f9f --- /dev/null +++ b/docs/data-sources/actions_organization_variables.md @@ -0,0 +1,27 @@ +--- +page_title: "github_actions_organization_variables (Data Source) - GitHub" +description: |- + Get Actions variables of the organization +--- + +# github\_actions\_organization\_variables + +Use this data source to retrieve the list of variables of the organization. + +## Example Usage + +```terraform +data "github_actions_organization_variables" "example" { +} +``` + +## Argument Reference + +## Attributes Reference + +- `variables` - list of variables for the repository + - `name` - Name of the variable + - `value` - Value of the variable + - `visibility` - Visibility of the variable + - `created_at` - Timestamp of the variable creation + - `updated_at` - Timestamp of the variable last update diff --git a/docs/data-sources/actions_public_key.md b/docs/data-sources/actions_public_key.md new file mode 100644 index 0000000000..9c96f273be --- /dev/null +++ b/docs/data-sources/actions_public_key.md @@ -0,0 +1,26 @@ +--- +page_title: "github_actions_public_key (Data Source) - GitHub" +description: |- + Get information on a GitHub Actions Public Key. +--- + +# github_actions_public_key (Data Source) + +Use this data source to retrieve information about a GitHub Actions public key. 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 it's action public key. + +## Example Usage + +```terraform +data "github_actions_public_key" "example" { + repository = "example_repo" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/website/docs/d/actions_registration_token.html.markdown b/docs/data-sources/actions_registration_token.md similarity index 59% rename from website/docs/d/actions_registration_token.html.markdown rename to docs/data-sources/actions_registration_token.md index 26598437a2..9e03c70d91 100644 --- a/website/docs/d/actions_registration_token.html.markdown +++ b/docs/data-sources/actions_registration_token.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: actions_registration_token" +page_title: "github_actions_registration_token (Data Source) - GitHub" description: |- Get a GitHub Actions repository registration token. --- @@ -11,7 +10,7 @@ Use this data source to retrieve a GitHub Actions repository registration token. ## Example Usage -```hcl +```terraform data "github_actions_registration_token" "example" { repository = "example_repo" } @@ -19,9 +18,9 @@ data "github_actions_registration_token" "example" { ## Argument Reference - * `repository` - (Required) Name of the repository to get a GitHub Actions registration token for. +- `repository` - (Required) Name of the repository to get a GitHub Actions registration token for. ## Attributes Reference - * `token` - The token that has been retrieved. - * `expires_at` - The token expiration date. +- `token` - The token that has been retrieved. +- `expires_at` - The token expiration date. diff --git a/website/docs/d/actions_repository_oidc_subject_claim_customization_template.html.markdown b/docs/data-sources/actions_repository_oidc_subject_claim_customization_template.md similarity index 61% rename from website/docs/d/actions_repository_oidc_subject_claim_customization_template.html.markdown rename to docs/data-sources/actions_repository_oidc_subject_claim_customization_template.md index 7dfefdec32..953b637c36 100644 --- a/website/docs/d/actions_repository_oidc_subject_claim_customization_template.html.markdown +++ b/docs/data-sources/actions_repository_oidc_subject_claim_customization_template.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: actions_repository_oidc_subject_claim_customization_template" +page_title: "github_actions_repository_oidc_subject_claim_customization_template (Data Source) - GitHub" description: |- Get a GitHub Actions repository's OpenID Connect customization template --- @@ -11,7 +10,7 @@ Use this data source to retrieve the OpenID Connect subject claim customization ## Example Usage -```hcl +```terraform data "github_actions_repository_oidc_subject_claim_customization_template" "example" { name = "example_repository" } @@ -19,9 +18,9 @@ data "github_actions_repository_oidc_subject_claim_customization_template" "exam ## Argument Reference -* `name` - (Required) Name of the repository to get the OpenID Connect subject claim customization template for. +- `name` - (Required) Name of the repository to get the OpenID Connect subject claim customization template for. ## Attributes Reference - * `use_default` - Whether the repository uses the default template. - * `include_claim_keys` - The list of OpenID Connect claim keys. +- `use_default` - Whether the repository uses the default template. +- `include_claim_keys` - The list of OpenID Connect claim keys. diff --git a/docs/data-sources/actions_secrets.md b/docs/data-sources/actions_secrets.md new file mode 100644 index 0000000000..24d489f488 --- /dev/null +++ b/docs/data-sources/actions_secrets.md @@ -0,0 +1,29 @@ +--- +page_title: "github_actions_secrets (Data Source) - GitHub" +description: |- + Get actions secrets for a repository +--- + +# github\_actions\_secrets + +Use this data source to retrieve the list of secrets for a GitHub repository. + +## Example Usage + +```terraform +data "github_actions_secrets" "example" { + name = "example" +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/docs/data-sources/actions_variables.md b/docs/data-sources/actions_variables.md new file mode 100644 index 0000000000..0e9b2d176f --- /dev/null +++ b/docs/data-sources/actions_variables.md @@ -0,0 +1,30 @@ +--- +page_title: "github_actions_variables (Data Source) - GitHub" +description: |- + Get Actions variables for a repository +--- + +# github\_actions\_variables + +Use this data source to retrieve the list of variables for a GitHub repository. + +## Example Usage + +```terraform +data "github_actions_variables" "example" { + name = "example" +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `variables` - list of variables for the repository + - `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 diff --git a/website/docs/d/app.html.markdown b/docs/data-sources/app.md similarity index 59% rename from website/docs/d/app.html.markdown rename to docs/data-sources/app.md index 45c52c87b2..9db371e0ac 100644 --- a/website/docs/d/app.html.markdown +++ b/docs/data-sources/app.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_app" +page_title: "github_app (Data Source) - GitHub" description: |- Get information about an app. --- @@ -11,7 +10,7 @@ Use this data source to retrieve information about an app. ## Example Usage -```hcl +```terraform data "github_app" "foobar" { slug = "foobar" } @@ -21,15 +20,14 @@ data "github_app" "foobar" { The following arguments are supported: -* `slug` - (Required) The URL-friendly name of your GitHub App. - +- `slug` - (Required) The URL-friendly name of your GitHub App. ## Attribute Reference The following additional attributes are exported: -* `description` - The app's description. +- `description` - The app's description. -* `name` - The app's full name. +- `name` - The app's full name. -* `node_id` - The Node ID of the app. +- `node_id` - The Node ID of the app. diff --git a/website/docs/d/app_token.html.markdown b/docs/data-sources/app_token.md similarity index 67% rename from website/docs/d/app_token.html.markdown rename to docs/data-sources/app_token.md index b224b5f609..180b8c8f53 100644 --- a/website/docs/d/app_token.html.markdown +++ b/docs/data-sources/app_token.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_app_token" +page_title: "github_app_token (Data Source) - GitHub" description: |- Generate a GitHub APP JWT. --- @@ -11,7 +10,7 @@ Use this data source to generate a [GitHub App JWT](https://docs.github.com/en/a ## Example Usage -```hcl +```terraform data "github_app_token" "this" { app_id = "123456" installation_id = "78910" @@ -23,14 +22,14 @@ data "github_app_token" "this" { The following arguments are supported: -* `app_id` - (Required) This is the ID of the GitHub App. +- `app_id` - (Required) This is the ID of the GitHub App. -* `installation_id` - (Required) This is the ID of the GitHub App installation. +- `installation_id` - (Required) This is the ID of the GitHub App installation. -* `pem_file` - (Required) This is the contents of the GitHub App private key PEM file. +- `pem_file` - (Required) This is the contents of the GitHub App private key PEM file. ## Attribute Reference The following additional attributes are exported: -* `token` - The generated GitHub APP JWT. +- `token` - The generated GitHub APP JWT. diff --git a/website/docs/d/branch.html.markdown b/docs/data-sources/branch.md similarity index 55% rename from website/docs/d/branch.html.markdown rename to docs/data-sources/branch.md index b7348f57dd..4a8a4b28d7 100644 --- a/website/docs/d/branch.html.markdown +++ b/docs/data-sources/branch.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_branch" +page_title: "github_branch (Data Source) - GitHub" description: |- Get information about a repository branch. --- @@ -11,7 +10,7 @@ Use this data source to retrieve information about a repository branch. ## Example Usage -```hcl +```terraform data "github_branch" "development" { repository = "example" branch = "development" @@ -22,16 +21,16 @@ data "github_branch" "development" { The following arguments are supported: -* `repository` - (Required) The GitHub repository name. +- `repository` - (Required) The GitHub repository name. -* `branch` - (Required) The repository branch to retrieve. +- `branch` - (Required) The repository branch to retrieve. ## Attribute Reference The following additional attributes are exported: -* `etag` - An etag representing the Branch object. +- `etag` - An etag representing the Branch object. -* `ref` - A string representing a branch reference, in the form of `refs/heads/`. +- `ref` - A string representing a branch reference, in the form of `refs/heads/`. -* `sha` - A string storing the reference's `HEAD` commit's SHA1. +- `sha` - A string storing the reference's `HEAD` commit's SHA1. diff --git a/website/docs/d/branch_protection_rules.html.markdown b/docs/data-sources/branch_protection_rules.md similarity index 62% rename from website/docs/d/branch_protection_rules.html.markdown rename to docs/data-sources/branch_protection_rules.md index 5189ddbca6..ebe48542fe 100644 --- a/website/docs/d/branch_protection_rules.html.markdown +++ b/docs/data-sources/branch_protection_rules.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_branch_protection_rules" +page_title: "github_branch_protection_rules (Data Source) - GitHub" description: |- Get information about a repository branch protection rules. --- @@ -11,7 +10,7 @@ Use this data source to retrieve a list of repository branch protection rules. ## Example Usage -```hcl +```terraform data "github_branch_protection_rules" "example" { repository = "example" } @@ -21,10 +20,10 @@ data "github_branch_protection_rules" "example" { The following arguments are supported: -* `repository` - (Required) The GitHub repository name. +- `repository` - (Required) The GitHub repository name. ## Attribute Reference -* `rules` - Collection of Branch Protection Rules. Each of the results conforms to the following scheme: +- `rules` - Collection of Branch Protection Rules. Each of the results conforms to the following scheme: - * `pattern` - Identifies the protection rule pattern. + - `pattern` - Identifies the protection rule pattern. diff --git a/docs/data-sources/codespaces_organization_public_key.md b/docs/data-sources/codespaces_organization_public_key.md new file mode 100644 index 0000000000..4c612cb17f --- /dev/null +++ b/docs/data-sources/codespaces_organization_public_key.md @@ -0,0 +1,20 @@ +--- +page_title: "github_codespaces_organization_public_key (Data Source) - GitHub" +description: |- + Get information on a GitHub Codespaces Organization Public Key. +--- + +# github_codespaces_organization_public_key (Data Source) + +Use this data source to retrieve information about a GitHub Codespaces Organization public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an organization to retrieve it's Codespaces public key. + +## Example Usage + +```terraform +data "github_codespaces_organization_public_key" "example" {} +``` + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/website/docs/d/codespaces_organization_secrets.html.markdown b/docs/data-sources/codespaces_organization_secrets.md similarity index 51% rename from website/docs/d/codespaces_organization_secrets.html.markdown rename to docs/data-sources/codespaces_organization_secrets.md index 1368cc1d0e..ff7d2e5ea5 100644 --- a/website/docs/d/codespaces_organization_secrets.html.markdown +++ b/docs/data-sources/codespaces_organization_secrets.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_codespaces_organization_secrets" +page_title: "github_codespaces_organization_secrets (Data Source) - GitHub" description: |- Get codespaces secrets of the organization --- @@ -11,7 +10,7 @@ Use this data source to retrieve the list of codespaces secrets of the organizat ## Example Usage -```hcl +```terraform data "github_codespaces_organization_secrets" "example" { } ``` @@ -20,9 +19,8 @@ data "github_codespaces_organization_secrets" "example" { ## Attributes Reference - * `secrets` - list of secrets for the repository - * `name` - Secret name - * `visibility` - Secret visibility - * `created_at` - Timestamp of the secret creation - * `updated_at` - Timestamp of the secret last update - +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/docs/data-sources/codespaces_public_key.md b/docs/data-sources/codespaces_public_key.md new file mode 100644 index 0000000000..7bfc4fc514 --- /dev/null +++ b/docs/data-sources/codespaces_public_key.md @@ -0,0 +1,26 @@ +--- +page_title: "github_codespaces_public_key (Data Source) - GitHub" +description: |- + Get information on a GitHub Codespaces Public Key. +--- + +# github_codespaces_public_key (Data Source) + +Use this data source to retrieve information about a GitHub Codespaces public key. 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 it's Codespaces public key. + +## Example Usage + +```terraform +data "github_codespaces_public_key" "example" { + repository = "example_repo" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/website/docs/d/codespaces_secrets.html.markdown b/docs/data-sources/codespaces_secrets.md similarity index 51% rename from website/docs/d/codespaces_secrets.html.markdown rename to docs/data-sources/codespaces_secrets.md index 5574013514..5d80942573 100644 --- a/website/docs/d/codespaces_secrets.html.markdown +++ b/docs/data-sources/codespaces_secrets.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_codespaces_secrets" +page_title: "github_codespaces_secrets (Data Source) - GitHub" description: |- Get codespaces secrets for a repository --- @@ -11,7 +10,7 @@ Use this data source to retrieve the list of codespaces secrets for a GitHub rep ## Example Usage -```hcl +```terraform data "github_codespaces_secrets" "example" { name = "example_repository" } @@ -23,13 +22,12 @@ data "github_codespaces_secrets" "example_2" { ## Argument Reference - * `name` - (Optional) The name of the repository. - * `full_name` - (Optional) Full name of the repository (in `org/name` format). +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). ## Attributes Reference - * `secrets` - list of codespaces secrets for the repository - * `name` - Secret name - * `created_at` - Timestamp of the secret creation - * `updated_at` - Timestamp of the secret last update - +- `secrets` - list of codespaces secrets for the repository + - `name` - Secret name + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/docs/data-sources/codespaces_user_public_key.md b/docs/data-sources/codespaces_user_public_key.md new file mode 100644 index 0000000000..29ef9a0b06 --- /dev/null +++ b/docs/data-sources/codespaces_user_public_key.md @@ -0,0 +1,20 @@ +--- +page_title: "github_codespaces_user_public_key (Data Source) - GitHub" +description: |- + Get information on a GitHub Codespaces User Public Key. +--- + +# github_codespaces_user_public_key (Data Source) + +Use this data source to retrieve information about a GitHub Codespaces User public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an user to retrieve it's Codespaces public key. + +## Example Usage + +```terraform +data "github_codespaces_user_public_key" "example" {} +``` + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/docs/data-sources/codespaces_user_secrets.md b/docs/data-sources/codespaces_user_secrets.md new file mode 100644 index 0000000000..fc95178354 --- /dev/null +++ b/docs/data-sources/codespaces_user_secrets.md @@ -0,0 +1,26 @@ +--- +page_title: "github_codespaces_user_secrets (Data Source) - GitHub" +description: |- + Get codespaces secrets of the user +--- + +# github\_codespaces\_user\_secrets + +Use this data source to retrieve the list of codespaces secrets of the user. + +## Example Usage + +```terraform +data "github_codespaces_user_secrets" "example" { +} +``` + +## Argument Reference + +## Attributes Reference + +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/docs/data-sources/collaborators.md b/docs/data-sources/collaborators.md new file mode 100644 index 0000000000..532a7d762a --- /dev/null +++ b/docs/data-sources/collaborators.md @@ -0,0 +1,68 @@ +--- +page_title: "github_collaborators (Data Source) - GitHub" +description: |- + Get the collaborators for a given repository. +--- + +# github_collaborators (Data Source) + +Use this data source to retrieve the collaborators for a given repository. + +## Example Usage + +```terraform +data "github_collaborators" "test" { + owner = "example_owner" + repository = "example_repository" +} +``` + +## Arguments Reference + +- `owner` - (Required) The organization that owns the repository. + +- `repository` - (Required) The name of the repository. + +- `affiliation` - (Optional) Filter collaborators returned by their affiliation. Can be one of: `outside`, `direct`, `all`. Defaults to `all`. + +- `permission` - (Optional) Filter collaborators returned by their permission. Can be one of: `pull`, `triage`, `push`, `maintain`, `admin`. Defaults to not doing any filtering on permission. + +## Attributes Reference + +- `collaborator` - An Array of GitHub collaborators. Each `collaborator` block consists of the fields documented below. + +--- + +The `collaborator` block consists of: + +- `login` - The collaborator's login. + +- `id` - The ID of the collaborator. + +- `url` - The GitHub API URL for the collaborator. + +- `html_url` - The GitHub HTML URL for the collaborator. + +- `followers_url` - The GitHub API URL for the collaborator's followers. + +- `following_url` - The GitHub API URL for those following the collaborator. + +- `gists_url` - The GitHub API URL for the collaborator's gists. + +- `starred_url` - The GitHub API URL for the collaborator's starred repositories. + +- `subscriptions_url` - The GitHub API URL for the collaborator's subscribed repositories. + +- `organizations_url` - The GitHub API URL for the collaborator's organizations. + +- `repos_url` - The GitHub API URL for the collaborator's repositories. + +- `events_url` - The GitHub API URL for the collaborator's events. + +- `received_events_url` - The GitHub API URL for the collaborator's received events. + +- `type` - The type of the collaborator (ex. `user`). + +- `site_admin` - Whether the user is a GitHub admin. + +- `permission` - The permission of the collaborator. diff --git a/docs/data-sources/dependabot_organization_public_key.md b/docs/data-sources/dependabot_organization_public_key.md new file mode 100644 index 0000000000..14e52b4b87 --- /dev/null +++ b/docs/data-sources/dependabot_organization_public_key.md @@ -0,0 +1,20 @@ +--- +page_title: "github_dependabot_organization_public_key (Data Source) - GitHub" +description: |- + Get information on a GitHub Dependabot Organization Public Key. +--- + +# github_dependabot_organization_public_key (Data Source) + +Use this data source to retrieve information about a GitHub Dependabot Organization public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an organization to retrieve it's Dependabot public key. + +## Example Usage + +```terraform +data "github_dependabot_organization_public_key" "example" {} +``` + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/website/docs/d/dependabot_organization_secrets.html.markdown b/docs/data-sources/dependabot_organization_secrets.md similarity index 51% rename from website/docs/d/dependabot_organization_secrets.html.markdown rename to docs/data-sources/dependabot_organization_secrets.md index bf7f624844..c3fe6da2a4 100644 --- a/website/docs/d/dependabot_organization_secrets.html.markdown +++ b/docs/data-sources/dependabot_organization_secrets.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_dependabot_organization_secrets" +page_title: "github_dependabot_organization_secrets (Data Source) - GitHub" description: |- Get dependabot secrets of the organization --- @@ -11,7 +10,7 @@ Use this data source to retrieve the list of dependabot secrets of the organizat ## Example Usage -```hcl +```terraform data "github_dependabot_organization_secrets" "example" { } ``` @@ -20,9 +19,8 @@ data "github_dependabot_organization_secrets" "example" { ## Attributes Reference - * `secrets` - list of secrets for the repository - * `name` - Secret name - * `visibility` - Secret visibility - * `created_at` - Timestamp of the secret creation - * `updated_at` - Timestamp of the secret last update - +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/docs/data-sources/dependabot_public_key.md b/docs/data-sources/dependabot_public_key.md new file mode 100644 index 0000000000..9540c60c2d --- /dev/null +++ b/docs/data-sources/dependabot_public_key.md @@ -0,0 +1,26 @@ +--- +page_title: "github_dependabot_public_key (Data Source) - GitHub" +description: |- + Get information on a GitHub Dependabot Public Key. +--- + +# github_dependabot_public_key (Data Source) + +Use this data source to retrieve information about a GitHub Dependabot public key. 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 it's Dependabot public key. + +## Example Usage + +```terraform +data "github_dependabot_public_key" "example" { + repository = "example_repo" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/docs/data-sources/dependabot_secrets.md b/docs/data-sources/dependabot_secrets.md new file mode 100644 index 0000000000..68d4b79818 --- /dev/null +++ b/docs/data-sources/dependabot_secrets.md @@ -0,0 +1,29 @@ +--- +page_title: "github_dependabot_secrets (Data Source) - GitHub" +description: |- + Get dependabot secrets for a repository +--- + +# github\_dependabot\_secrets + +Use this data source to retrieve the list of dependabot secrets for a GitHub repository. + +## Example Usage + +```terraform +data "github_dependabot_secrets" "example" { + name = "example" +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `secrets` - list of dependabot secrets for the repository + - `name` - Secret name + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/docs/data-sources/enterprise.md b/docs/data-sources/enterprise.md new file mode 100644 index 0000000000..b9e1cf9d4d --- /dev/null +++ b/docs/data-sources/enterprise.md @@ -0,0 +1,27 @@ +--- +page_title: "github_enterprise (Data Source) - GitHub" +description: |- + Get an enterprise. +--- + +# github_enterprise (Data Source) + +Use this data source to retrieve basic information about a GitHub enterprise. + +## Example Usage + +```hcl +data "github_enterprise" "example" { + slug = "example-co" +} +``` + +## Attributes Reference + +- `id` - The ID of the enterprise. +- `database_id` - The database ID of the enterprise. +- `slug` - The URL slug identifying the enterprise. +- `name` - The name of the enterprise. +- `description` - The description of the enterprise. +- `created_at` - The time the enterprise was created. +- `url` - The url for the enterprise. diff --git a/website/docs/d/external_groups.html.markdown b/docs/data-sources/external_groups.md similarity index 53% rename from website/docs/d/external_groups.html.markdown rename to docs/data-sources/external_groups.md index 0560dd00cd..1974238b02 100644 --- a/website/docs/d/external_groups.html.markdown +++ b/docs/data-sources/external_groups.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_external_groups" +page_title: "github_external_groups (Data Source) - GitHub" description: |- Retrieve external groups belonging to an organization. --- @@ -11,11 +10,11 @@ Use this data source to retrieve external groups belonging to an organization. ## Example Usage -```hcl +```terraform data "github_external_groups" "example_external_groups" {} locals { - local_groups = "${data.github_external_groups.example_external_groups}" + local_groups = data.github_external_groups.example_external_groups } output "groups" { @@ -29,12 +28,10 @@ N/A. This resource will retrieve all the external groups belonging to an organiz ## Attributes Reference - * `external_groups` - an array of external groups belonging to the organization. Each group consists of the fields documented below. +- `external_groups` - an array of external groups belonging to the organization. Each group consists of the fields documented below. -___ - - - * `group_id` - the ID of the group. - * `group_name` - the name of the group. - * `updated_at` - the date the group was last updated. +--- +- `group_id` - the ID of the group. +- `group_name` - the name of the group. +- `updated_at` - the date the group was last updated. diff --git a/website/docs/d/ip_ranges.html.markdown b/docs/data-sources/ip_ranges.md similarity index 97% rename from website/docs/d/ip_ranges.html.markdown rename to docs/data-sources/ip_ranges.md index 58c3ceebc1..caeb7a51b2 100644 --- a/website/docs/d/ip_ranges.html.markdown +++ b/docs/data-sources/ip_ranges.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_ip_ranges" +page_title: "github_ip_ranges (Data Source) - GitHub" description: |- Get information on GitHub's IP addresses. --- -# github_ip_ranges +# github_ip_ranges (Data Source) Use this data source to retrieve information about GitHub's IP addresses. ## Example Usage -```hcl +```terraform data "github_ip_ranges" "test" {} ``` diff --git a/docs/data-sources/issue_labels.md b/docs/data-sources/issue_labels.md new file mode 100644 index 0000000000..643bc0b972 --- /dev/null +++ b/docs/data-sources/issue_labels.md @@ -0,0 +1,29 @@ +--- +page_title: "github_issue_labels (Data Source) - GitHub" +description: |- + Get the labels for a given repository. +--- + +# github_issue_labels (Data Source) + +Use this data source to retrieve the labels for a given repository. + +## Example Usage + +```terraform +data "github_labels" "test" { + repository = "example_repository" +} +``` + +## Arguments Reference + +- `repository` - (Required) The name of the repository. + +## Attributes Reference + +- `labels` - The list of this repository's labels. Each element of `labels` has the following attributes: + - `name` - The name of the label. + - `color` - The hexadecimal color code for the label, without the leading #. + - `description` - A short description of the label. + - `url` - The URL of the label. diff --git a/docs/data-sources/membership.md b/docs/data-sources/membership.md new file mode 100644 index 0000000000..4bb9284f27 --- /dev/null +++ b/docs/data-sources/membership.md @@ -0,0 +1,30 @@ +--- +page_title: "github_membership (Data Source) - GitHub" +description: |- + Get information on user membership in an organization. +--- + +# github_membership (Data Source) + +Use this data source to find out if a user is a member of your organization, as well as what role they have within it. If the user's membership in the organization is pending their acceptance of an invite, the role they would have once they accept will be returned. + +## Example Usage + +```terraform +data "github_membership" "membership_for_some_user" { + username = "SomeUser" +} +``` + +## Argument Reference + +- `username` - (Required) The username to lookup in the organization. + +- `organization` - (Optional) The organization to check for the above username. + +## Attributes Reference + +- `username` - The username. +- `role` - `admin` or `member` -- the role the user has within the organization. +- `etag` - An etag representing the membership object. +- `state` - `active` or `pending` -- the state of membership within the organization. `active` if the member has accepted the invite, or `pending` if the invite is still pending. diff --git a/docs/data-sources/organization.md b/docs/data-sources/organization.md new file mode 100644 index 0000000000..def786ba5d --- /dev/null +++ b/docs/data-sources/organization.md @@ -0,0 +1,58 @@ +--- +page_title: "github_organization (Data Source) - GitHub" +description: |- + Get an organization. +--- + +# github_organization (Data Source) + +Use this data source to retrieve basic information about a GitHub Organization. + +## Example Usage + +```terraform +data "github_organization" "example" { + name = "github" +} +``` + +## Argument Reference + +- `name` - (Required) The name of the organization. +- `ignore_archived_repos` - (Optional) Whether or not to include archived repos in the `repositories` list. Defaults to `false`. +- `summary_only` - (Optional) Exclude the repos, members and other attributes from the returned result. Defaults to `false`. + +## Attributes Reference + +- `id` - The ID of the organization +- `node_id` - GraphQL global node ID for use with the v4 API +- `name` - The organization's public profile name +- `orgname` - The organization's name as used in URLs and the API +- `login` - The organization account login +- `description` - The organization account description +- `plan` - The organization account plan name +- `repositories` - (`list`) A list of the full names of the repositories in the organization formatted as `owner/name` strings +- `members` - **Deprecated**: use `users` instead by replacing `github_organization.example.members` to `github_organization.example.users[*].login` which will give you the same value, expect this field to be removed in next major version +- `users` - (`list`) A list with the members of the organization with following fields: + - `id` - The ID of the member + - `login` - The members login + - `email` - Publicly available email + - `role` - Member role `ADMIN`, `MEMBER` +- `two_factor_requirement_enabled` - Whether two-factor authentication is required for all members of the organization. +- `default_repository_permission` - Default permission level members have for organization repositories. +- `members_allowed_repository_creation_type` - The type of repository allowed to be created by members of the organization. Can be one of `ALL`, `PUBLIC`, `PRIVATE`, `NONE`. +- `members_can_create_repositories` - Whether non-admin organization members can create repositories. +- `members_can_create_internal_repositories` - Whether organization members can create internal repositories. +- `members_can_create_private_repositories` - Whether organization members can create private repositories. +- `members_can_create_public_repositories` - Whether organization members can create public repositories. +- `members_can_create_pages` - Whether organization members can create pages sites. +- `members_can_create_public_pages` - Whether organization members can create public pages sites. +- `members_can_create_private_pages` - Whether organization members can create private pages sites. +- `members_can_fork_private_repositories` - Whether organization members can create private repository forks. +- `web_commit_signoff_required` - Whether organization members must sign all commits. +- `advanced_security_enabled_for_new_repositories` - Whether advanced security is enabled for new repositories. +- `dependabot_alerts_enabled_for_new_repositories` - Whether Dependabot alerts is automatically enabled for new repositories. +- `dependabot_security_updates_enabled_for_new_repositories` - Whether Dependabot security updates is automatically enabled for new repositories. +- `dependency_graph_enabled_for_new_repositories` - Whether dependency graph is automatically enabled for new repositories. +- `secret_scanning_enabled_for_new_repositories` - Whether secret scanning is automatically enabled for new repositories. +- `secret_scanning_push_protection_enabled_for_new_repositories` - Whether secret scanning push protection is automatically enabled for new repositories. diff --git a/docs/data-sources/organization_app_installations.md b/docs/data-sources/organization_app_installations.md new file mode 100644 index 0000000000..db10890fbd --- /dev/null +++ b/docs/data-sources/organization_app_installations.md @@ -0,0 +1,39 @@ +--- +page_title: "github_organization_app_installations (Data Source) - GitHub" +description: |- + Get information on all GitHub App installations of the organization. +--- + +# github_organization_app_installations (Data Source) + +Use this data source to retrieve all GitHub App installations of the organization. + +## Example Usage + +To retrieve *all* GitHub App installations of the organization: + +```terraform +data "github_organization_app_installations" "all" {} +``` + +## Attributes Reference + +- `installations` - List of GitHub App installations in the organization. Each `installation` block consists of the fields documented below. + +--- + +The `installation` block consists of: + +- `id` - The ID of the GitHub App installation. +- `app_slug` - The URL-friendly name of the GitHub App. +- `app_id` - The ID of the GitHub App. +- `repository_selection` - Whether the installation has access to all repositories or only selected ones. Possible values are `all` or `selected`. +- `permissions` - A map of the permissions granted to the GitHub App installation. +- `events` - The list of events the GitHub App installation subscribes to. +- `client_id` - The OAuth client ID of the GitHub App. +- `target_id` - The ID of the account the GitHub App is installed on. +- `target_type` - The type of account the GitHub App is installed on. Possible values are `Organization` or `User`. +- `suspended` - Whether the GitHub App installation is currently suspended. +- `single_file_paths` - The list of single file paths the GitHub App installation has access to. +- `created_at` - The date the GitHub App installation was created. +- `updated_at` - The date the GitHub App installation was last updated. diff --git a/docs/data-sources/organization_custom_properties.md b/docs/data-sources/organization_custom_properties.md new file mode 100644 index 0000000000..1564509fd7 --- /dev/null +++ b/docs/data-sources/organization_custom_properties.md @@ -0,0 +1,39 @@ +--- +page_title: "github_organization_custom_properties (Data Source) - GitHub" +description: |- + Get information about a GitHub organization custom property +--- + +# github_organization_custom_properties (Data Source) + +Use this data source to retrieve information about a GitHub organization custom property. + +## Example Usage + +```terraform +data "github_organization_custom_properties" "environment" { + property_name = "environment" +} +``` + +## Argument Reference + +The following arguments are supported: + +- `property_name` - (Required) The name of the custom property to retrieve. + +## Attributes Reference + +- `property_name` - The name of the custom property. + +- `value_type` - The type of the custom property. Can be one of `string`, `single_select`, `multi_select`, or `true_false`. + +- `required` - Whether the custom property is required. + +- `description` - The description of the custom property. + +- `default_value` - The default value of the custom property. + +- `allowed_values` - List of allowed values for the custom property. Only populated when `value_type` is `single_select` or `multi_select`. + +- `values_editable_by` - Who can edit the values of the custom property. Can be one of `org_actors` or `org_and_repo_actors`. diff --git a/website/docs/d/organization_custom_role.html.markdown b/docs/data-sources/organization_custom_role.md similarity index 65% rename from website/docs/d/organization_custom_role.html.markdown rename to docs/data-sources/organization_custom_role.md index 3e3b1f4429..ec8ba63610 100644 --- a/website/docs/d/organization_custom_role.html.markdown +++ b/docs/data-sources/organization_custom_role.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_custom_role" +page_title: "github_organization_custom_role (Data Source) - GitHub" description: |- Get a custom role from a GitHub Organization for use in repositories. --- @@ -15,7 +14,7 @@ Use this data source to retrieve information about a custom role in a GitHub Org ## Example Usage -```hcl +```terraform data "github_organization_custom_role" "example" { name = "example" } @@ -25,13 +24,13 @@ data "github_organization_custom_role" "example" { The following arguments are supported: -* `name` - (Required) The name of the custom role. +- `name` - (Required) The name of the custom role. ## Attributes Reference The following additional attributes are exported: -* `id` - The ID of the custom role. -* `description` - The description for the custom role. -* `base_role` - The system role from which the role inherits permissions. -* `permissions` - A list of additional permissions included in this role. +- `id` - The ID of the custom role. +- `description` - The description for the custom role. +- `base_role` - The system role from which the role inherits permissions. +- `permissions` - A list of additional permissions included in this role. diff --git a/website/docs/d/organization_external_identities.markdown b/docs/data-sources/organization_external_identities.md similarity index 77% rename from website/docs/d/organization_external_identities.markdown rename to docs/data-sources/organization_external_identities.md index 3c077b7745..02456099e1 100644 --- a/website/docs/d/organization_external_identities.markdown +++ b/docs/data-sources/organization_external_identities.md @@ -1,18 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_organization_external_identities" +page_title: "github_organization_external_identities (Data Source) - GitHub" description: |- Get a list of organization members and their SAML linked external identity NameID --- -# github_organization_external_identities +# github_organization_external_identities (Data Source) -Use this data source to retrieve each organization member's SAML or SCIM user -attributes. +Use this data source to retrieve each organization member's SAML or SCIM user attributes. ## Example Usage -```hcl +```terraform data "github_organization_external_identities" "all" {} ``` @@ -25,10 +23,8 @@ data "github_organization_external_identities" "all" {} Each element in the `identities` block consists of: - `login` - The username of the GitHub user -- `saml_identity` - An Object containing the user's SAML data. This object will - be empty if the user is not managed by SAML. -- `scim_identity` - An Object contining the user's SCIM data. This object will - be empty if the user is not managed by SCIM. +- `saml_identity` - An Object containing the user's SAML data. This object will be empty if the user is not managed by SAML. +- `scim_identity` - An Object contining the user's SCIM data. This object will be empty if the user is not managed by SCIM. --- @@ -43,8 +39,7 @@ If a user is managed by SAML, the `saml_identity` object will contain: If a user is managed by SCIM, the `scim_identity` object will contain: -- `username` - The member's SCIM Username. (will be empty string if user is not - managed by SCIM) +- `username` - The member's SCIM Username. (will be empty string if user is not managed by SCIM) - `groups` - The member's SCIM Groups - `family_name` - The member's SCIM Family Name - `given_name` - The member's SCIM Given Name diff --git a/docs/data-sources/organization_ip_allow_list.md b/docs/data-sources/organization_ip_allow_list.md new file mode 100644 index 0000000000..ea3984ea0b --- /dev/null +++ b/docs/data-sources/organization_ip_allow_list.md @@ -0,0 +1,30 @@ +--- +page_title: "github_organization_ip_allow_list (Data Source) - GitHub" +description: |- + Get the IP allow list of an organization. +--- + +# github_organization_ip_allow_list (Data Source) + +Use this data source to retrieve information about the IP allow list of an organization. The allow list for IP addresses will block access to private resources via the web, API, and Git from any IP addresses that are not on the allow list. + +## Example Usage + +```terraform +data "github_organization_ip_allow_list" "all" {} +``` + +## Attributes Reference + +- `ip_allow_list` - An Array of allowed IP addresses. + +--- + +Each element in the `ip_allow_list` block consists of: + +- `id` - The ID of the IP allow list entry. +- `name` - The name of the IP allow list entry. +- `allow_list_value` - A single IP address or range of IP addresses in CIDR notation. +- `is_active` - Whether the entry is currently active. +- `created_at` - Identifies the date and time when the object was created. +- `updated_at` - Identifies the date and time when the object was last updated. diff --git a/website/docs/d/organization_repository_role.html.markdown b/docs/data-sources/organization_repository_role.md similarity index 90% rename from website/docs/d/organization_repository_role.html.markdown rename to docs/data-sources/organization_repository_role.md index 1ef13f6d08..596342c5b8 100644 --- a/website/docs/d/organization_repository_role.html.markdown +++ b/docs/data-sources/organization_repository_role.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_repository_role Data Source" +page_title: "github_organization_repository_role (Data Source) - GitHub" description: |- Lookup a custom organization repository role. --- diff --git a/website/docs/d/organization_repository_roles.html.markdown b/docs/data-sources/organization_repository_roles.md similarity index 91% rename from website/docs/d/organization_repository_roles.html.markdown rename to docs/data-sources/organization_repository_roles.md index 2b65549adb..ea436cce8d 100644 --- a/website/docs/d/organization_repository_roles.html.markdown +++ b/docs/data-sources/organization_repository_roles.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_repository_roles Data Source" +page_title: "github_organization_repository_roles (Data Source) - GitHub" description: |- Lookup all custom repository roles in an organization. --- diff --git a/website/docs/d/organization_role.html.markdown b/docs/data-sources/organization_role.md similarity index 90% rename from website/docs/d/organization_role.html.markdown rename to docs/data-sources/organization_role.md index a6990af53d..9eb8d25c05 100644 --- a/website/docs/d/organization_role.html.markdown +++ b/docs/data-sources/organization_role.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_role Data Source" +page_title: "github_organization_role (Data Source) - GitHub" description: |- Lookup a custom organization role. --- diff --git a/website/docs/d/organization_role_teams.html.markdown b/docs/data-sources/organization_role_teams.md similarity index 90% rename from website/docs/d/organization_role_teams.html.markdown rename to docs/data-sources/organization_role_teams.md index 6dfe676109..0d6e957a30 100644 --- a/website/docs/d/organization_role_teams.html.markdown +++ b/docs/data-sources/organization_role_teams.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_role_teams Data Source" +page_title: "github_organization_role_teams (Data Source) - GitHub" description: |- Lookup all teams assigned to a custom organization role. --- diff --git a/website/docs/d/organization_role_users.html.markdown b/docs/data-sources/organization_role_users.md similarity index 88% rename from website/docs/d/organization_role_users.html.markdown rename to docs/data-sources/organization_role_users.md index 6ff6d46668..f2d799038c 100644 --- a/website/docs/d/organization_role_users.html.markdown +++ b/docs/data-sources/organization_role_users.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_role_users Data Source" +page_title: "github_organization_role_users (Data Source) - GitHub" description: |- Lookup all users assigned to a custom organization role. --- diff --git a/website/docs/d/organization_roles.html.markdown b/docs/data-sources/organization_roles.md similarity index 91% rename from website/docs/d/organization_roles.html.markdown rename to docs/data-sources/organization_roles.md index 78890f6d49..0ed41aaee8 100644 --- a/website/docs/d/organization_roles.html.markdown +++ b/docs/data-sources/organization_roles.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_roles Data Source" +page_title: "github_organization_roles (Data Source) - GitHub" description: |- Lookup all custom roles in an organization. --- diff --git a/docs/data-sources/organization_security_managers.md b/docs/data-sources/organization_security_managers.md new file mode 100644 index 0000000000..9c53bb523f --- /dev/null +++ b/docs/data-sources/organization_security_managers.md @@ -0,0 +1,30 @@ +--- +page_title: "github_organization_security_managers (Data Source) - GitHub" +description: |- + Get the security managers for an organization. +--- + +# github_organization_security_managers (Data Source) + +~> **Note:** This data source is deprecated, please use the `github_organization_role_team` resource instead. + +Use this data source to retrieve the security managers for an organization. + +## Example Usage + +```terraform +data "github_organization_security_managers" "test" {} +``` + +## Attributes Reference + +- `teams` - An list of GitHub teams. Each `team` block consists of the fields documented below. + +---___ + +The `team` block consists of: + +- `id` - Unique identifier of the team. +- `slug` - Name based identifier of the team. +- `name` - Name of the team. +- `permission` - Permission that the team will have for its repositories. diff --git a/docs/data-sources/organization_team_sync_groups.md b/docs/data-sources/organization_team_sync_groups.md new file mode 100644 index 0000000000..c3a23f7aff --- /dev/null +++ b/docs/data-sources/organization_team_sync_groups.md @@ -0,0 +1,29 @@ +--- +page_title: "github_organization_team_sync_groups (Data Source) - GitHub" +description: |- + Get the external identity provider (IdP) groups for an organization. +--- + +# github_organization_team_sync_groups (Data Source) + +Use this data source to retrieve the identity provider (IdP) groups for an organization. + +## Example Usage + +```terraform +data "github_organization_team_sync_groups" "test" {} +``` + +## Attributes Reference + +- `groups` - An Array of GitHub Identity Provider Groups. Each `group` block consists of the fields documented below. + +--- + +The `group` block consists of: + +- `group_id` - The ID of the IdP group. + +- `group_name` - The name of the IdP group. + +- `group_description` - The description of the IdP group. diff --git a/docs/data-sources/organization_teams.md b/docs/data-sources/organization_teams.md new file mode 100644 index 0000000000..2b9855e99b --- /dev/null +++ b/docs/data-sources/organization_teams.md @@ -0,0 +1,48 @@ +--- +page_title: "github_organization_teams (Data Source) - GitHub" +description: |- + Get information on all GitHub teams of an organization. +--- + +# github\_organization\_teams + +Use this data source to retrieve information about all GitHub teams in an organization. + +## Example Usage + +To retrieve *all- teams of the organization: + +```terraform +data "github_organization_teams" "all" {} +``` + +To retrieve only the team's at the root of the organization: + +```terraform +data "github_organization_teams" "root_teams" { + root_teams_only = true +} +``` + +## Attributes Reference + +- `teams` - (Required) An Array of GitHub Teams. Each `team` block consists of the fields documented below. +- `root_teams_only` - (Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to `false`. +- `summary_only` - (Optional) Exclude the members and repositories of the team from the returned result. Defaults to `false`. +- `results_per_page` - (Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to `100`. + +--- + +The `team` block consists of: + +- `id` - The ID of the team. +- `node_id` - The Node ID of the team. +- `slug` - The slug of the team. +- `name` - The team's full name. +- `description` - The team's description. +- `privacy` - The team's privacy type. +- `members` - List of team members. Not returned if `summary_only = true` +- `repositories` - List of team repositories. Not returned if `summary_only = true` +- `parent_team_id` - The ID of the parent team, if there is one. +- `parent_team_slug` - The slug of the parent team, if there is one. +- `parent` - (**DEPRECATED**) The parent team, use `parent_team_id` or `parent_team_slug` instead. diff --git a/docs/data-sources/organization_webhooks.md b/docs/data-sources/organization_webhooks.md new file mode 100644 index 0000000000..48d161c00a --- /dev/null +++ b/docs/data-sources/organization_webhooks.md @@ -0,0 +1,31 @@ +--- +page_title: "github_organization_webhooks (Data Source) - GitHub" +description: |- + Get information on all GitHub webhooks of the organization. +--- + +# github\_organization\_webhooks + +Use this data source to retrieve all webhooks of the organization. + +## Example Usage + +To retrieve *all- webhooks of the organization: + +```terraform +data "github_organization_webhooks" "all" {} +``` + +## Attributes Reference + +- `webhooks` - An Array of GitHub Webhooks. Each `webhook` block consists of the fields documented below. + +--- + +The `webhook` block consists of: + +- `id` - the ID of the webhook. +- `type` - the type of the webhook. +- `name` - the name of the webhook. +- `url` - the url of the webhook. +- `active` - `true` if the webhook is active. diff --git a/website/docs/d/ref.html.markdown b/docs/data-sources/ref.md similarity index 53% rename from website/docs/d/ref.html.markdown rename to docs/data-sources/ref.md index 2e2c2fd853..e5c980896b 100644 --- a/website/docs/d/ref.html.markdown +++ b/docs/data-sources/ref.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_ref" +page_title: "github_ref (Data Source) - GitHub" description: |- Get information about a repository ref. --- -# github_ref +# github_ref (Data Source) Use this data source to retrieve information about a repository ref. ## Example Usage -```hcl +```terraform data "github_ref" "development" { owner = "example" repository = "example" @@ -23,18 +22,18 @@ data "github_ref" "development" { The following arguments are supported: -* `owner` - (Required) Owner of the repository. +- `owner` - (Required) Owner of the repository. -* `repository` - (Required) The GitHub repository name. +- `repository` - (Required) The GitHub repository name. -* `ref` - (Required) The repository ref to look up. Must be formatted `heads/` for branches, and `tags/` for tags. +- `ref` - (Required) The repository ref to look up. Must be formatted `heads/` for branches, and `tags/` for tags. ## Attribute Reference The following additional attributes are exported: -* `etag` - An etag representing the ref. +- `etag` - An etag representing the ref. -* `id` - A string storing a reference to the repository name and ref. +- `id` - A string storing a reference to the repository name and ref. -* `sha` - A string storing the reference's `HEAD` commit's SHA1. +- `sha` - A string storing the reference's `HEAD` commit's SHA1. diff --git a/docs/data-sources/release.md b/docs/data-sources/release.md new file mode 100644 index 0000000000..84944f819b --- /dev/null +++ b/docs/data-sources/release.md @@ -0,0 +1,85 @@ +--- +page_title: "github_release (Data Source) - GitHub" +description: |- + Get information on a GitHub release. +--- + +# github\_release + +Use this data source to retrieve information about a GitHub release in a specific repository. + +## Example Usage + +To retrieve the latest release that is present in a repository: + +```terraform +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "latest" +} +``` + +To retrieve a specific release from a repository based on its ID: + +```terraform +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "id" + id = 12345 +} +``` + +Finally, to retrieve a release based on its tag: + +```terraform +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "tag" + release_tag = "v1.0.0" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the release from. + +- `owner` - (Required) Owner of the repository. + +- `retrieve_by` - (Required) Describes how to fetch the release. Valid values are `id`, `tag`, `latest`. + +- `release_id` - (Optional) ID of the release to retrieve. Must be specified when `retrieve_by` = `id`. + +- `release_tag` - (Optional) Tag of the release to retrieve. Must be specified when `retrieve_by` = `tag`. + +## Attributes Reference + +- `release_tag` - Tag of release +- `release_id` - ID of release +- `target_commitish` - Commitish value that determines where the Git release is created from +- `name` - Name of release +- `body` - Contents of the description (body) of a release +- `draft` - (`Boolean`) indicates whether the release is a draft +- `prerelease` - (`Boolean`) indicates whether the release is a prerelease +- `created_at` - Date of release creation +- `published_at` - Date of release publishing +- `url` - Base URL of the release +- `html_url` - URL directing to detailed information on the release +- `assets_url` - URL of any associated assets with the release +- `asserts_url` - **Deprecated**: Use `assets_url` resource instead +- `upload_url` - URL that can be used to upload Assets to the release +- `zipball_url` - Download URL of a specific release in `zip` format +- `tarball_url` - Download URL of a specific release in `tar.gz` format +- `assets` - Collection of assets for the release. Each asset conforms to the following schema: + - `id` - ID of the asset + - `url` - URL of the asset + - `node_id` - Node ID of the asset + - `name` - The file name of the asset + - `label` - Label for the asset + - `content_type` - MIME type of the asset + - `size` - Size in byte + - `created_at` - Date the asset was created + - `updated_at` - Date the asset was last updated + - `browser_download_url` - Browser download URL diff --git a/docs/data-sources/release_asset.md b/docs/data-sources/release_asset.md new file mode 100644 index 0000000000..3111c4a47a --- /dev/null +++ b/docs/data-sources/release_asset.md @@ -0,0 +1,86 @@ +--- +page_title: "github_release_asset (Data Source) - GitHub" +description: |- + Get information on a GitHub release asset. +--- + +# github\_release\_asset + +Use this data source to retrieve information about a GitHub release asset. + +## Example Usage + +To retrieve a specific release asset from a repository based on its ID: + +```terraform +data "github_release_asset" "example" { + repository = "example-repository" + owner = "example-owner" + asset_id = 12345 +} +``` + +To retrieve a specific release asset from a repository, and download the file into a `file` attribute on the data source: + +```terraform +data "github_release_asset" "example" { + repository = "example-repository" + owner = "example-owner" + asset_id = 12345 + download_file = true +} +``` + +To retrieve the first release asset associated with the latest release in a repository: + +```terraform +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "latest" +} + +data "github_release_asset" "example" { + repository = "example-repository" + owner = "example-owner" + asset_id = data.github_release.example.assets[0].id +} +``` + +To retrieve all release assets associated with the the latest release in a repository: + +```terraform +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "latest" +} + +data "github_release_asset" "example" { + count = length(data.github_release.example.assets) + repository = "example-repository" + owner = "example-owner" + asset_id = data.github_release.example.assets[count.index].id +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the release from +- `owner` - (Required) Owner of the repository +- `asset_id` - (Required) ID of the release asset to retrieve +- `download_file_contents` - (Optional) Whether to download the asset file content into the `file_contents` attribute (defaults to `false`) + +## Attributes Reference + +- `id` - ID of the asset +- `url` - URL of the asset +- `node_id` - Node ID of the asset +- `name` - The file name of the asset +- `label` - Label for the asset +- `content_type` - MIME type of the asset +- `size` - Asset size in bytes +- `created_at` - Date the asset was created +- `updated_at` - Date the asset was last updated +- `browser_download_url` - Browser URL from which the release asset can be downloaded +- `file_contents` - The base64-encoded release asset file contents (requires `download_file_contents` to be `true`) diff --git a/website/docs/d/repositories.html.markdown b/docs/data-sources/repositories.md similarity index 51% rename from website/docs/d/repositories.html.markdown rename to docs/data-sources/repositories.md index a08df0d648..7e83f1f5c8 100644 --- a/website/docs/d/repositories.html.markdown +++ b/docs/data-sources/repositories.md @@ -1,22 +1,20 @@ --- -layout: "github" -page_title: "GitHub: github_repositories" +page_title: "github_repositories (Data Source) - GitHub" description: |- Search for GitHub repositories --- -# github_repositories +# github_repositories (Data Source) --> **Note:** The data source will return a maximum of `1000` repositories - [as documented in official API docs](https://developer.github.com/v3/search/#about-the-search-api). +-> **Note:** The data source will return a maximum of `1000` repositories [as documented in official API docs](https://developer.github.com/v3/search/#about-the-search-api). Use this data source to retrieve a list of GitHub repositories using a search query. ## Example Usage -```hcl +```terraform data "github_repositories" "example" { - query = "org:hashicorp language:Go" + query = "org:hashicorp language:Go" include_repo_id = true } ``` @@ -25,13 +23,13 @@ data "github_repositories" "example" { The following arguments are supported: -* `query` - (Required) Search query. See [documentation for the search syntax](https://help.github.com/articles/understanding-the-search-syntax/). -* `sort` - (Optional) Sorts the repositories returned by the specified attribute. Valid values include `stars`, `fork`, and `updated`. Defaults to `updated`. -* `include_repo_id` - (Optional) Returns a list of found repository IDs -* `results_per_page` - (Optional) Set the number of repositories requested per API call. Can be useful to decrease if requests are timing out or to increase to reduce the number of API calls. Defaults to 100. +- `query` - (Required) Search query. See [documentation for the search syntax](https://help.github.com/articles/understanding-the-search-syntax/). +- `sort` - (Optional) Sorts the repositories returned by the specified attribute. Valid values include `stars`, `fork`, and `updated`. Defaults to `updated`. +- `include_repo_id` - (Optional) Returns a list of found repository IDs +- `results_per_page` - (Optional) Set the number of repositories requested per API call. Can be useful to decrease if requests are timing out or to increase to reduce the number of API calls. Defaults to 100. ## Attributes Reference -* `full_names` - A list of full names of found repositories (e.g. `hashicorp/terraform`) -* `names` - A list of found repository names (e.g. `terraform`) -* `repo_ids` - (Optional) A list of found repository IDs (e.g. `449898861`) +- `full_names` - A list of full names of found repositories (e.g. `hashicorp/terraform`) +- `names` - A list of found repository names (e.g. `terraform`) +- `repo_ids` - (Optional) A list of found repository IDs (e.g. `449898861`) diff --git a/website/docs/d/repository.html.markdown b/docs/data-sources/repository.md similarity index 97% rename from website/docs/d/repository.html.markdown rename to docs/data-sources/repository.md index 2c4475edfa..3dee5e1460 100644 --- a/website/docs/d/repository.html.markdown +++ b/docs/data-sources/repository.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_repository" +page_title: "github_repository (Data Source) - GitHub" description: |- Get details about GitHub repository --- -# github_repository +# github_repository (Data Source) Use this data source to retrieve information about a GitHub repository. ## Example Usage -```hcl +```terraform data "github_repository" "example" { full_name = "hashicorp/terraform" } @@ -97,7 +96,7 @@ The following arguments are supported: - `repository_license` - An Array of GitHub repository licenses. Each `repository_license` block consists of the fields documented below. -___ +--- The `repository_license` block consists of: diff --git a/docs/data-sources/repository_autolink_references.md b/docs/data-sources/repository_autolink_references.md new file mode 100644 index 0000000000..4c01bbff30 --- /dev/null +++ b/docs/data-sources/repository_autolink_references.md @@ -0,0 +1,28 @@ +--- +page_title: "github_repository_autolink_references (Data Source) - GitHub" +description: |- + Get autolink references for a Github repository. +--- + +# github_repository_autolink_references (Data Source) + +Use this data source to retrieve autolink references for a repository. + +## Example Usage + +```terraform +data "github_repository_autolink_references" "example" { + repository = "example-repository" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the autolink references from. + +## Attributes Reference + +- `autolink_references` - The list of this repository's autolink references. Each element of `autolink_references` has the following attributes: + - `key_prefix` - Key prefix. + - `target_url_template` - Target url template. + - `is_alphanumeric` - True if alphanumeric. diff --git a/website/docs/d/repository_branches.html.markdown b/docs/data-sources/repository_branches.md similarity index 50% rename from website/docs/d/repository_branches.html.markdown rename to docs/data-sources/repository_branches.md index 105f9dd8fa..bc809e0f38 100644 --- a/website/docs/d/repository_branches.html.markdown +++ b/docs/data-sources/repository_branches.md @@ -1,32 +1,31 @@ --- -layout: "github" -page_title: "GitHub: repository_branches" +page_title: "github_repository_branches (Data Source) - GitHub" description: |- Get information on a GitHub repository's branches. --- -# github_repository_branches +# github_repository_branches (Data Source) Use this data source to retrieve information about branches in a repository. ## Example Usage -```hcl +```terraform data "github_repository_branches" "example" { - repository = "example-repository" + repository = "example-repository" } ``` ## Argument Reference -* `repository` - (Required) Name of the repository to retrieve the branches from. +- `repository` - (Required) Name of the repository to retrieve the branches from. -* `only_protected_branches` - (Optional). If true, the `branches` attributes will be populated only with protected branches. Default: `false`. +- `only_protected_branches` - (Optional). If true, the `branches` attributes will be populated only with protected branches. Default: `false`. -* `only_non_protected_branches` - (Optional). If true, the `branches` attributes will be populated only with non protected branches. Default: `false`. +- `only_non_protected_branches` - (Optional). If true, the `branches` attributes will be populated only with non protected branches. Default: `false`. ## Attributes Reference -* `branches` - The list of this repository's branches. Each element of `branches` has the following attributes: - * `name` - Name of the branch. - * `protected` - Whether the branch is protected. +- `branches` - The list of this repository's branches. Each element of `branches` has the following attributes: + - `name` - Name of the branch. + - `protected` - Whether the branch is protected. diff --git a/docs/data-sources/repository_custom_properties.md b/docs/data-sources/repository_custom_properties.md new file mode 100644 index 0000000000..60a3f6b588 --- /dev/null +++ b/docs/data-sources/repository_custom_properties.md @@ -0,0 +1,27 @@ +--- +page_title: "github_repository_custom_properties (Data Source) - GitHub" +description: |- + Get all custom properties of a repository +--- + +# github_repository_custom_properties (Data Source) + +Use this data source to retrieve all custom properties of a repository. + +## Example Usage + +```terraform +data "github_repository_custom_properties" "example" { + repository = "example-repository" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the custom properties from. + +## Attributes Reference + +- `property` - The list of this repository's custom properties. Each element of `property` has the following attributes: + - `property_name` - Name of the property + - `property_value` - Value of the property diff --git a/docs/data-sources/repository_deploy_keys.md b/docs/data-sources/repository_deploy_keys.md new file mode 100644 index 0000000000..94ac3f9d3c --- /dev/null +++ b/docs/data-sources/repository_deploy_keys.md @@ -0,0 +1,29 @@ +--- +page_title: "github_repository_deploy_keys (Data Source) - GitHub" +description: |- + Get all deploy keys of a repository +--- + +# github_repository_deploy_keys (Data Source) + +Use this data source to retrieve all deploy keys of a repository. + +## Example Usage + +```terraform +data "github_repository_deploy_keys" "example" { + repository = "example-repository" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the branches from. + +## Attributes Reference + +- `keys` - The list of this repository's deploy keys. Each element of `keys` has the following attributes: + - `id` - Key id + - `title` - Key title + - `key` - Key itself + - `verified` - `true` if the key was verified. diff --git a/website/docs/d/repository_deployment_branch_policies.html.markdown b/docs/data-sources/repository_deployment_branch_policies.md similarity index 53% rename from website/docs/d/repository_deployment_branch_policies.html.markdown rename to docs/data-sources/repository_deployment_branch_policies.md index d0ec6debec..1c7978e53e 100644 --- a/website/docs/d/repository_deployment_branch_policies.html.markdown +++ b/docs/data-sources/repository_deployment_branch_policies.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_repository_deployment_branch_policies" +page_title: "github_repository_deployment_branch_policies (Data Source) - GitHub" description: |- Get the list of deployment branch policies for a given repo / env. --- -# github_repository_deployment_branch_policies +# github_repository_deployment_branch_policies (Data Source) ~> **Note:** This data source is deprecated, please use the `github_repository_environment_deployment_policies` data source instead. @@ -13,21 +12,21 @@ Use this data source to retrieve deployment branch policies for a repository / e ## Example Usage -```hcl +```terraform data "github_repository_deployment_branch_policies" "example" { - repository = "example-repository" - environment_name = "env_name" + repository = "example-repository" + environment_name = "env_name" } ``` ## Argument Reference -* `repository` - (Required) Name of the repository to retrieve the deployment branch policies from. +- `repository` - (Required) Name of the repository to retrieve the deployment branch policies from. -* `environment_name` - (Required) Name of the environment to retrieve the deployment branch policies from. +- `environment_name` - (Required) Name of the environment to retrieve the deployment branch policies from. ## Attributes Reference -* `deployment_branch_policies` - The list of this repository / environment deployment policies. Each element of `deployment_branch_policies` has the following attributes: - * `id` - Id of the policy. - * `name` - The name pattern that branches must match in order to deploy to the environment. +- `deployment_branch_policies` - The list of this repository / environment deployment policies. Each element of `deployment_branch_policies` has the following attributes: + - `id` - Id of the policy. + - `name` - The name pattern that branches must match in order to deploy to the environment. diff --git a/docs/data-sources/repository_environment_deployment_policies.md b/docs/data-sources/repository_environment_deployment_policies.md new file mode 100644 index 0000000000..d71d717492 --- /dev/null +++ b/docs/data-sources/repository_environment_deployment_policies.md @@ -0,0 +1,30 @@ +--- +page_title: "github_repository_environment_deployment_policies (Data Source) - GitHub" +description: |- + Get the list of environment deployment policies for a given repository environment. +--- + +# github_repository_environment_deployment_policies (Data Source) + +Use this data source to retrieve deployment branch policies for a repository environment. + +## Example Usage + +```terraform +data "github_repository_environment_deployment_policies" "example" { + repository = "example-repository" + environment = "env-name" +} +``` + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the deployment branch policies from. + +- `environment` - (Required) Name of the environment to retrieve the deployment branch policies from. + +## Attributes Reference + +- `policies` - The list of deployment policies for the repository environment. Each element of `policies` has the following attributes: + - `type` - Type of the policy; this could be `branch` or `tag`. + - `pattern` - The pattern that branch or tag names must match in order to deploy to the environment. diff --git a/website/docs/d/repository_environments.html.markdown b/docs/data-sources/repository_environments.md similarity index 50% rename from website/docs/d/repository_environments.html.markdown rename to docs/data-sources/repository_environments.md index 62831ef48c..4f922e8baf 100644 --- a/website/docs/d/repository_environments.html.markdown +++ b/docs/data-sources/repository_environments.md @@ -1,28 +1,27 @@ --- -layout: "github" -page_title: "GitHub: repository_environments" +page_title: "github_repository_environments (Data Source) - GitHub" description: |- Get information on a GitHub repository's environments. --- -# github_repository_environments +# github_repository_environments (Data Source) Use this data source to retrieve information about environments for a repository. ## Example Usage -```hcl +```terraform data "github_repository_environments" "example" { - repository = "example-repository" + repository = "example-repository" } ``` ## Argument Reference -* `repository` - (Required) Name of the repository to retrieve the environments from. +- `repository` - (Required) Name of the repository to retrieve the environments from. ## Attributes Reference -* `environments` - The list of this repository's environments. Each element of `environments` has the following attributes: - * `name` - Environment name. - * `node_id` - Environment node id. +- `environments` - The list of this repository's environments. Each element of `environments` has the following attributes: + - `name` - Environment name. + - `node_id` - Environment node id. diff --git a/docs/data-sources/repository_file.md b/docs/data-sources/repository_file.md new file mode 100644 index 0000000000..9b59757879 --- /dev/null +++ b/docs/data-sources/repository_file.md @@ -0,0 +1,47 @@ +--- +page_title: "github_repository_file (Data Source) - GitHub" +description: |- + Reads files within a GitHub repository +--- + +# github_repository_file (Data Source) + +This data source allows you to read files within a GitHub repository. + +## Example Usage + +```terraform +data "github_repository_file" "foo" { + repository = github_repository.foo.name + branch = "main" + file = ".gitignore" +} +``` + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token. + +- `file` - (Required) The path of the file to read. + +- `branch` - (Optional) Git branch. Defaults to the repository's default branch. + +## Attributes Reference + +The following additional attributes are exported: + +- `content` - The file content. + +- `commit_sha` - The SHA of the commit that modified the file. + +- `sha` - The SHA blob of the file. + +- `commit_author` - Committer author name. + +- `commit_email` - Committer email address. + +- `commit_message` - Commit message when file was last updated. + +- `ref` - The name of the commit/branch/tag. diff --git a/docs/data-sources/repository_milestone.md b/docs/data-sources/repository_milestone.md new file mode 100644 index 0000000000..13e138b0cd --- /dev/null +++ b/docs/data-sources/repository_milestone.md @@ -0,0 +1,34 @@ +--- +page_title: "github_repository_milestone (Data Source) - GitHub" +description: |- + Get information on a GitHub Repository Milestone. +--- + +# github_repository_milestone (Data Source) + +Use this data source to retrieve information about a specific GitHub milestone in a repository. + +## Example Usage + +```terraform +data "github_repository_milestone" "example" { + owner = "example-owner" + repository = "example-repository" + number = 1 +} +``` + +## Argument Reference + +- `owner` - (Required) Owner of the repository. + +- `repository` - (Required) Name of the repository to retrieve the milestone from. + +- `number` - (Required) The number of the milestone. + +## Attributes Reference + +- `description` - Description of the milestone. +- `due_date` - The milestone due date (in ISO-8601 `yyyy-mm-dd` format). +- `state` - State of the milestone. +- `title` - Title of the milestone. diff --git a/website/docs/d/repository_pages.html.markdown b/docs/data-sources/repository_pages.md similarity index 92% rename from website/docs/d/repository_pages.html.markdown rename to docs/data-sources/repository_pages.md index 95c5cb73cc..110fcc8318 100644 --- a/website/docs/d/repository_pages.html.markdown +++ b/docs/data-sources/repository_pages.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_repository_pages" +page_title: "github_repository_pages (Data Source) - GitHub" description: |- Get information on GitHub Pages for a repository --- -# github_repository_pages +# github_repository_pages (Data Source) Use this data source to retrieve GitHub Pages configuration for a repository. ## Example Usage -```hcl +```terraform data "github_repository_pages" "example" { repository = "my-repo" } diff --git a/docs/data-sources/repository_pull_request.md b/docs/data-sources/repository_pull_request.md new file mode 100644 index 0000000000..97c4715eb3 --- /dev/null +++ b/docs/data-sources/repository_pull_request.md @@ -0,0 +1,56 @@ +--- +page_title: "github_repository_pull_request (Data Source) - GitHub" +description: |- + Get information on a single GitHub Pull Request. +--- + +# github_repository_pull_request (Data Source) + +Use this data source to retrieve information about a specific GitHub Pull Request in a repository. + +## Example Usage + +```terraform +data "github_repository_pull_request" "example" { + base_repository = "example_repository" + number = 1 +} +``` + +## Argument Reference + +- `base_repository` - (Required) Name of the base repository to retrieve the Pull Request from. + +- `number` - (Required) The number of the Pull Request within the repository. + +- `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. + +## Attributes Reference + +- `base_ref` - Name of the ref (branch) of the Pull Request base. + +- `base_sha` - Head commit SHA of the Pull Request base. + +- `body` - Body of the Pull Request. + +- `draft` - Indicates Whether this Pull Request is a draft. + +- `head_owner` - Owner of the Pull Request head repository. + +- `head_repository` - Name of the Pull Request head repository. + +- `head_sha` - Head commit SHA of the Pull Request head. + +- `labels` - List of label names set on the Pull Request. + +- `maintainer_can_modify` - Indicates whether the base repository maintainers can modify the Pull Request. + +- `opened_at` - Unix timestamp indicating the Pull Request creation time. + +- `opened_by` - GitHub login of the user who opened the Pull Request. + +- `state` - the current Pull Request state - can be "open", "closed" or "merged". + +- `title` - The title of the Pull Request. + +- `updated_at` - The timestamp of the last Pull Request update. diff --git a/docs/data-sources/repository_pull_requests.md b/docs/data-sources/repository_pull_requests.md new file mode 100644 index 0000000000..ac2fb21cd2 --- /dev/null +++ b/docs/data-sources/repository_pull_requests.md @@ -0,0 +1,73 @@ +--- +page_title: "github_repository_pull_requests (Data Source) - GitHub" +description: |- + Get information on multiple GitHub Pull Requests. +--- + +# github_repository_pull_requests (Data Source) + +Use this data source to retrieve information about multiple GitHub Pull Requests in a repository. + +## Example Usage + +```terraform +data "github_repository_pull_requests" "example" { + base_repository = "example-repository" + base_ref = "main" + sort_by = "updated" + sort_direction = "desc" + state = "open" +} +``` + +## Argument Reference + +- `base_repository` - (Required) Name of the base repository to retrieve the Pull Requests from. + +- `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. + +- `base_ref` - (Optional) If set, filters Pull Requests by base branch name. + +- `head_ref` - (Optional) If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch". + +- `sort_by` - (Optional) If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created". + +- `sort_direction` - (Optional) If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc". + +- `state` - (Optional) If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open". + +## Attributes Reference + +- `results` - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme: + + - `base_ref` - Name of the ref (branch) of the Pull Request base. + + - `base_sha` - Head commit SHA of the Pull Request base. + + - `body` - Body of the Pull Request. + + - `draft` - Indicates Whether this Pull Request is a draft. + + - `head_owner` - Owner of the Pull Request head repository. + + - `head_ref` - Value of the Pull Request `HEAD` reference. + + - `head_repository` - Name of the Pull Request head repository. + + - `head_sha` - Head commit SHA of the Pull Request head. + + - `labels` - List of label names set on the Pull Request. + + - `maintainer_can_modify` - Indicates whether the base repository maintainers can modify the Pull Request. + + - `number` - The number of the Pull Request within the repository. + + - `opened_at` - Unix timestamp indicating the Pull Request creation time. + + - `opened_by` - GitHub login of the user who opened the Pull Request. + + - `state` - the current Pull Request state - can be "open", "closed" or "merged". + + - `title` - The title of the Pull Request. + + - `updated_at` - The timestamp of the last Pull Request update. diff --git a/docs/data-sources/repository_teams.md b/docs/data-sources/repository_teams.md new file mode 100644 index 0000000000..de8a739bdf --- /dev/null +++ b/docs/data-sources/repository_teams.md @@ -0,0 +1,29 @@ +--- +page_title: "github_repository_teams (Data Source) - GitHub" +description: |- + Get teams which have permission on the given repo. +--- + +# github\_repository\_teams + +Use this data source to retrieve the list of teams which have access to a GitHub repository. + +## Example Usage + +```terraform +data "github_repository_teams" "example" { + name = "example" +} +``` + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `teams` - List of teams which have access to the repository + - `name` - Team name + - `slug` - Team slug + - `permission` - Team permission diff --git a/website/docs/d/repository_webhooks.html.markdown b/docs/data-sources/repository_webhooks.md similarity index 50% rename from website/docs/d/repository_webhooks.html.markdown rename to docs/data-sources/repository_webhooks.md index 071e935a47..9087ab06c7 100644 --- a/website/docs/d/repository_webhooks.html.markdown +++ b/docs/data-sources/repository_webhooks.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_repository_webhooks" +page_title: "github_repository_webhooks (Data Source) - GitHub" description: |- Get information on all GitHub webhooks of the organization. --- @@ -13,7 +12,7 @@ Use this data source to retrieve webhooks for a given repository. To retrieve webhooks of a repository: -```hcl +```terraform data "github_repository_webhooks" "repo" { repository = "foo" } @@ -21,13 +20,14 @@ data "github_repository_webhooks" "repo" { ## Attributes Reference -* `webhooks` - An Array of GitHub Webhooks. Each `webhook` block consists of the fields documented below. -___ +- `webhooks` - An Array of GitHub Webhooks. Each `webhook` block consists of the fields documented below. + +--- The `webhook` block consists of: - * `id` - the ID of the webhook. - * `type` - the type of the webhook. - * `name` - the name of the webhook. - * `url` - the url of the webhook. - * `active` - `true` if the webhook is active. +- `id` - the ID of the webhook. +- `type` - the type of the webhook. +- `name` - the name of the webhook. +- `url` - the url of the webhook. +- `active` - `true` if the webhook is active. diff --git a/docs/data-sources/rest_api.md b/docs/data-sources/rest_api.md new file mode 100644 index 0000000000..4927920c95 --- /dev/null +++ b/docs/data-sources/rest_api.md @@ -0,0 +1,29 @@ +--- +page_title: "github_rest_api (Data Source) - GitHub" +description: |- + Get information on a GitHub resource with a custom GET request to GitHub REST API. +--- + +# github_rest_api (Data Source) + +Use this data source to retrieve information about a GitHub resource through REST API. + +## Example Usage + +```terraform +data "github_rest_api" "example" { + endpoint = "repos/example_repo/git/refs/heads/main" +} +``` + +## Argument Reference + +- `endpoint` - (Required) REST API endpoint to send the GET request to. + +## Attributes Reference + +- `id` - The GitHub API Request ID +- `code` - A response status code. +- `status` - A response status string. +- `headers` - A JSON string containing response headers. +- `body` - A JSON string containing response body. diff --git a/website/docs/d/ssh_keys.html.markdown b/docs/data-sources/ssh_keys.md similarity index 59% rename from website/docs/d/ssh_keys.html.markdown rename to docs/data-sources/ssh_keys.md index a484c85a74..6ab48892f2 100644 --- a/website/docs/d/ssh_keys.html.markdown +++ b/docs/data-sources/ssh_keys.md @@ -1,20 +1,19 @@ --- -layout: "github" -page_title: "GitHub: github_ssh_keys" +page_title: "github_ssh_keys (Data Source) - GitHub" description: |- Get information on GitHub's SSH keys. --- -# github_ssh_keys +# github_ssh_keys (Data Source) Use this data source to retrieve information about GitHub's SSH keys. ## Example Usage -```hcl +```terraform data "github_ssh_keys" "test" {} ``` ## Attributes Reference - * `keys` - An array of GitHub's SSH public keys. +- `keys` - An array of GitHub's SSH public keys. diff --git a/docs/data-sources/team.md b/docs/data-sources/team.md new file mode 100644 index 0000000000..cc1cde8cb7 --- /dev/null +++ b/docs/data-sources/team.md @@ -0,0 +1,37 @@ +--- +page_title: "github_team (Data Source) - GitHub" +description: |- + Get information on a GitHub team. +--- + +# github\_team + +Use this data source to retrieve information about a GitHub team. + +## Example Usage + +```terraform +data "github_team" "example" { + slug = "example" +} +``` + +## Argument Reference + +- `slug` - (Required) The team slug. +- `membership_type` - (Optional) Type of membership to be requested to fill the list of members. Can be either `all` *(default)- or `immediate`. +- `summary_only` - (Optional) Exclude the members and repositories of the team from the returned result. Defaults to `false`. +- `results_per_page` - (**DEPRECATED**) (Optional) Set the number of results per REST API query. Accepts a value between 0 - 100 *(defaults to `100`)*. + +## Attributes Reference + +- `id` - ID of the team. +- `node_id` - Node ID of the team. +- `name` - Team's full name. +- `description` - Team's description. +- `privacy` - Team's privacy type. Can either be `closed` or `secret`. +- `notification_setting` - Teams's notification setting. Can be either `notifications_enabled` or `notifications_disabled`. +- `permission` - (**DEPRECATED**) The permission that new repositories will be added to the team with when none is specified. +- `members` - List of team members (list of GitHub usernames). Not returned if `summary_only = true`. +- `repositories` - (**DEPRECATED**) List of team repositories (list of repo names). Not returned if `summary_only = true`. +- `repositories_detailed` - List of team repositories (each item comprises of `repo_id`, `repo_name` & [`role_name`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository#permission)). Not returned if `summary_only = true`. diff --git a/website/docs/d/tree.html.markdown b/docs/data-sources/tree.md similarity index 91% rename from website/docs/d/tree.html.markdown rename to docs/data-sources/tree.md index 6c254b9f22..8dd0ce3985 100644 --- a/website/docs/d/tree.html.markdown +++ b/docs/data-sources/tree.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_tree" +page_title: "github_tree (Data Source) - GitHub" description: |- Returns a single tree using the SHA1 value for that tree. --- -# github_tree +# github_tree (Data Source) Use this data source to retrieve information about a single tree. ## Example Usage -```hcl +```terraform data "github_repository" "this" { name = "example" } @@ -30,7 +29,6 @@ data "github_tree" "this" { output "entries" { value = data.github_tree.this.entries } - ``` ## Argument Reference diff --git a/docs/data-sources/user.md b/docs/data-sources/user.md new file mode 100644 index 0000000000..b5df33a68d --- /dev/null +++ b/docs/data-sources/user.md @@ -0,0 +1,55 @@ +--- +page_title: "github_user (Data Source) - GitHub" +description: |- + Get information on a GitHub user. +--- + +# github\_user + +Use this data source to retrieve information about a GitHub user. + +## Example Usage + +```terraform +# Retrieve information about a GitHub user. +data "github_user" "example" { + username = "example" +} + +# Retrieve information about the currently authenticated user. +data "github_user" "current" { + username = "" +} + +output "current_github_login" { + value = data.github_user.current.login +} +``` + +## Argument Reference + +- `username` - (Required) The username. Use an empty string `""` to retrieve information about the currently authenticated user. + +## Attributes Reference + +- `id` - the ID of the user. +- `node_id` - the Node ID of the user. +- `login` - the user's login. +- `avatar_url` - the user's avatar URL. +- `gravatar_id` - the user's gravatar ID. +- `site_admin` - whether the user is a GitHub admin. +- `name` - the user's full name. +- `company` - the user's company name. +- `blog` - the user's blog location. +- `location` - the user's location. +- `email` - the user's email. +- `gpg_keys` - list of user's GPG keys. +- `ssh_keys` - list of user's SSH keys. +- `bio` - the user's bio. +- `public_repos` - the number of public repositories. +- `public_gists` - the number of public gists. +- `followers` - the number of followers. +- `following` - the number of following users. +- `created_at` - the creation date. +- `updated_at` - the update date. +- `suspended_at` - the suspended date if the user is suspended. diff --git a/website/docs/d/user_external_identity.html.markdown b/docs/data-sources/user_external_identity.md similarity index 77% rename from website/docs/d/user_external_identity.html.markdown rename to docs/data-sources/user_external_identity.md index 7dbb9bf2fa..2129e8ac95 100644 --- a/website/docs/d/user_external_identity.html.markdown +++ b/docs/data-sources/user_external_identity.md @@ -1,18 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_user_external_identity" +page_title: "github_user_external_identity (Data Source) - GitHub" description: |- - Get a specific organization member's SAML/SCIM linked external identity + Get a specific organization member's SAML/SCIM linked external identity --- -# github_user_external_identity +# github_user_external_identity (Data Source) -Use this data source to retrieve a specific organization member's SAML or SCIM user -attributes. +Use this data source to retrieve a specific organization member's SAML or SCIM user attributes. ## Example Usage -```hcl +```terraform data "github_user_external_identity" "example_user" { username = "example-user" } @@ -27,10 +25,8 @@ The following arguments are supported: ## Attributes Reference - `login` - The username of the GitHub user -- `saml_identity` - An Object containing the user's SAML data. This object will - be empty if the user is not managed by SAML. -- `scim_identity` - An Object contining the user's SCIM data. This object will - be empty if the user is not managed by SCIM. +- `saml_identity` - An Object containing the user's SAML data. This object will be empty if the user is not managed by SAML. +- `scim_identity` - An Object contining the user's SCIM data. This object will be empty if the user is not managed by SCIM. --- @@ -45,7 +41,6 @@ If a user is managed by SAML, the `saml_identity` object will contain: If a user is managed by SCIM, the `scim_identity` object will contain: -- `scim_username` - The member's SCIM Username. (will be empty string if user is - not managed by SCIM) +- `scim_username` - The member's SCIM Username. (will be empty string if user is not managed by SCIM) - `scim_family_name` - The member's SCIM Family Name - `scim_given_name` - The member's SCIM Given Name diff --git a/docs/data-sources/users.md b/docs/data-sources/users.md new file mode 100644 index 0000000000..e73c35c6e1 --- /dev/null +++ b/docs/data-sources/users.md @@ -0,0 +1,37 @@ +--- +page_title: "github_users (Data Source) - GitHub" +description: |- + Get information about multiple GitHub users. +--- + +# github\_users + +Use this data source to retrieve information about multiple GitHub users at once. + +## Example Usage + +```terraform +# Retrieve information about multiple GitHub users. +data "github_users" "example" { + usernames = ["example1", "example2", "example3"] +} + +output "valid_users" { + value = data.github_users.example.logins +} + +output "invalid_users" { + value = data.github_users.example.unknown_logins +} +``` + +## Argument Reference + +- `usernames` - (Required) List of usernames. + +## Attributes Reference + +- `node_ids` - list of Node IDs of users that could be found. +- `logins` - list of logins of users that could be found. +- `emails` - list of the user's publicly visible profile email (will be empty string in case if user decided not to show it). +- `unknown_logins` - list of logins without matching user. diff --git a/website/docs/index.html.markdown b/docs/index.md similarity index 77% rename from website/docs/index.html.markdown rename to docs/index.md index 28408af769..c7066b81d8 100644 --- a/website/docs/index.html.markdown +++ b/docs/index.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "Provider: GitHub" +page_title: "GitHub Provider" description: |- The GitHub provider is used to interact with GitHub resources. --- @@ -9,8 +8,7 @@ description: |- The GitHub provider is used to interact with GitHub resources. -The provider allows you to manage your GitHub organization's members and teams easily. -It needs to be configured with the proper credentials before it can be used. +The provider allows you to manage your GitHub organization's members and teams easily. It needs to be configured with the proper credentials before it can be used. Use the navigation to the left to read about the available resources. @@ -37,7 +35,7 @@ resource "github_membership" "membership_for_user_x" { } ``` -- You **must** add a `required_providers` block to every module that will create resources with this provider. If you do not explicitly require `integrations/github` in a submodule, your terraform run may [break in hard-to-troubleshoot ways](https://github.com/integrations/terraform-provider-github/issues/876#issuecomment-1303790559). +- You **must*- add a `required_providers` block to every module that will create resources with this provider. If you do not explicitly require `integrations/github` in a submodule, your terraform run may [break in hard-to-troubleshoot ways](https://github.com/integrations/terraform-provider-github/issues/876#issuecomment-1303790559). Terraform 0.12 and earlier: @@ -52,6 +50,7 @@ resource "github_membership" "membership_for_user_x" { # ... } ``` + ~> **Note:** When upgrading from `hashicorp/github` to `integrations/github`, use `terraform state replace-provider`. Otherwise, Terraform will still require the old provider to interact with the state file. ## Authentication @@ -74,8 +73,7 @@ provider "github" { ### GitHub App Installation -To authenticate using a GitHub App installation, ensure that arguments in the `app_auth` block or the `GITHUB_APP_XXX` environment variables are set. -The `owner` parameter required in this situation. Leaving out will throw a `403 "Resource not accessible by integration"` error. +To authenticate using a GitHub App installation, ensure that arguments in the `app_auth` block or the `GITHUB_APP_XXX` environment variables are set. The `owner` parameter required in this situation. Leaving out will throw a `403 "Resource not accessible by integration"` error. Some API operations may not be available when using a GitHub App installation configuration. For more information, refer to the list of [supported endpoints](https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps). @@ -90,7 +88,7 @@ provider "github" { } ``` -~> **Note:** When using environment variables, an empty `app_auth` block is required to allow provider configurations from environment variables to be specified. See: https://github.com/hashicorp/terraform-plugin-sdk/issues/142 +~> **Note:** When using environment variables, an empty `app_auth` block is required to allow provider configurations from environment variables to be specified. See: ```terraform provider "github" { @@ -103,40 +101,36 @@ provider "github" { The following arguments are supported in the `provider` block: -* `token` - (Optional) A GitHub OAuth / Personal Access Token. When not provided or made available via the `GITHUB_TOKEN` environment variable, the provider can only access resources available anonymously. +- `token` - (Optional) A GitHub OAuth / Personal Access Token. When not provided or made available via the `GITHUB_TOKEN` environment variable, the provider can only access resources available anonymously. -* `base_url` - (Optional) This is the target GitHub base API endpoint. Providing a value is a requirement when working with GitHub Enterprise. It is optional to provide this value and it can also be sourced from the `GITHUB_BASE_URL` environment variable. The value must end with a slash, for example: `https://terraformtesting-ghe.westus.cloudapp.azure.com/` +- `base_url` - (Optional) This is the target GitHub base API endpoint. Providing a value is a requirement when working with GitHub Enterprise. It is optional to provide this value and it can also be sourced from the `GITHUB_BASE_URL` environment variable. The value must end with a slash, for example: `https://terraformtesting-ghe.westus.cloudapp.azure.com/` -* `owner` - (Optional) This is the target GitHub organization or individual user account to manage. For example, `torvalds` and `github` are valid owners. It is optional to provide this value and it can also be sourced from the `GITHUB_OWNER` environment variable. When not provided and a `token` is available, the individual user account owning the `token` will be used. When not provided and no `token` is available, the provider may not function correctly. It is required in case of GitHub App Installation. +- `owner` - (Optional) This is the target GitHub organization or individual user account to manage. For example, `torvalds` and `github` are valid owners. It is optional to provide this value and it can also be sourced from the `GITHUB_OWNER` environment variable. When not provided and a `token` is available, the individual user account owning the `token` will be used. When not provided and no `token` is available, the provider may not function correctly. It is required in case of GitHub App Installation. -* `organization` - (Deprecated) This behaves the same as `owner`, which should be used instead. This value can also be sourced from the `GITHUB_ORGANIZATION` environment variable. +- `organization` - (Deprecated) This behaves the same as `owner`, which should be used instead. This value can also be sourced from the `GITHUB_ORGANIZATION` environment variable. -* `app_auth` - (Optional) Configuration block to use GitHub App installation token. When not provided, the provider can only access resources available anonymously. - * `id` - (Required) This is the ID of the GitHub App. It can sourced from the `GITHUB_APP_ID` environment variable. - * `installation_id` - (Required) This is the ID of the GitHub App installation. It can sourced from the `GITHUB_APP_INSTALLATION_ID` environment variable. - * `pem_file` - (Required) This is the contents of the GitHub App private key PEM file. It can also be sourced from the `GITHUB_APP_PEM_FILE` environment variable and may use `\n` instead of actual new lines. +- `app_auth` - (Optional) Configuration block to use GitHub App installation token. When not provided, the provider can only access resources available anonymously. + - `id` - (Required) This is the ID of the GitHub App. It can sourced from the `GITHUB_APP_ID` environment variable. + - `installation_id` - (Required) This is the ID of the GitHub App installation. It can sourced from the `GITHUB_APP_INSTALLATION_ID` environment variable. + - `pem_file` - (Required) This is the contents of the GitHub App private key PEM file. It can also be sourced from the `GITHUB_APP_PEM_FILE` environment variable and may use `\n` instead of actual new lines. -* `write_delay_ms` - (Optional) The number of milliseconds to sleep in between write operations in order to satisfy the GitHub API rate limits. Note that requests to the GraphQL API are implemented as ``POST`` requests under the hood, so this setting affects those calls as well. Defaults to 1000ms or 1 second if not provided. +- `write_delay_ms` - (Optional) The number of milliseconds to sleep in between write operations in order to satisfy the GitHub API rate limits. Note that requests to the GraphQL API are implemented as `POST` requests under the hood, so this setting affects those calls as well. Defaults to 1000ms or 1 second if not provided. -* `retry_delay_ms` - (Optional) Amount of time in milliseconds to sleep in between requests to GitHub API after an error response. Defaults to 1000ms or 1 second if not provided, the max_retries must be set to greater than zero. +- `retry_delay_ms` - (Optional) Amount of time in milliseconds to sleep in between requests to GitHub API after an error response. Defaults to 1000ms or 1 second if not provided, the max_retries must be set to greater than zero. -* `read_delay_ms` - (Optional) The number of milliseconds to sleep in between non-write operations in order to satisfy the GitHub API rate limits. Defaults to 0ms. +- `read_delay_ms` - (Optional) The number of milliseconds to sleep in between non-write operations in order to satisfy the GitHub API rate limits. Defaults to 0ms. -* `retryable_errors` - (Optional) "Allow the provider to retry after receiving an error status code, the max_retries should be set for this to work. Defaults to [500, 502, 503, 504] +- `retryable_errors` - (Optional) "Allow the provider to retry after receiving an error status code, the max_retries should be set for this to work. Defaults to [500, 502, 503, 504] -* `max_retries` - (Optional) Number of times to retry a request after receiving an error status code. Defaults to 3 +- `max_retries` - (Optional) Number of times to retry a request after receiving an error status code. Defaults to 3 Note: If you have a PEM file on disk, you can pass it in via `pem_file = file("path/to/file.pem")`. -For backwards compatibility, if more than one of `owner`, `organization`, -`GITHUB_OWNER` and `GITHUB_ORGANIZATION` are set, the first in this -list takes priority. +For backwards compatibility, if more than one of `owner`, `organization`, `GITHUB_OWNER` and `GITHUB_ORGANIZATION` are set, the first in this list takes priority. 1. Setting `organization` in the GitHub provider configuration. 2. Setting the `GITHUB_ORGANIZATION` environment variable. 3. Setting the `GITHUB_OWNER` environment variable. 4. Setting `owner` in the GitHub provider configuration. -~> It is a bug that `GITHUB_OWNER` takes precedence over `owner`, which may -be fixed in a future major release. For compatibility with future releases, -please set only one of `GITHUB_OWNER` and `owner`. +~> It is a bug that `GITHUB_OWNER` takes precedence over `owner`, which may be fixed in a future major release. For compatibility with future releases, please set only one of `GITHUB_OWNER` and `owner`. diff --git a/website/docs/r/actions_environment_secret.html.markdown b/docs/resources/actions_environment_secret.md similarity index 71% rename from website/docs/r/actions_environment_secret.html.markdown rename to docs/resources/actions_environment_secret.md index 5d332c8f8c..a8766dec48 100644 --- a/website/docs/r/actions_environment_secret.html.markdown +++ b/docs/resources/actions_environment_secret.md @@ -1,32 +1,25 @@ --- -layout: "github" -page_title: "GitHub: github_actions_environment_secret" +page_title: "github_actions_environment_secret (Resource) - GitHub" description: |- Creates and manages an Action Secret within a GitHub repository environment --- -# github_actions_environment_secret +# github_actions_environment_secret (Resource) -This resource allows you to create and manage GitHub Actions secrets within your GitHub repository environments. -You must have write access to a repository to use this resource. +This resource allows you to create and manage GitHub Actions secrets within your GitHub repository environments. You must have write access to a repository to use this resource. -Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is -interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. -For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, -but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. -It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` -using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible -in your code. See below for an example of this abstraction. +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. ## Example Usage -```hcl +```terraform resource "github_actions_environment_secret" "example_plaintext" { - repository = "example-repo" - environment = "example-environment" - secret_name = "example_secret_name" - value = "example-value + repository = "example-repo" + environment = "example-environment" + secret_name = "example_secret_name" + plaintext_value = "example-value" } resource "github_actions_environment_secret" "example_encrypted" { @@ -34,25 +27,25 @@ resource "github_actions_environment_secret" "example_encrypted" { environment = "example-environment" secret_name = "example_secret_name" key_id = var.key_id - value_encrypted = var.encrypted_secret_string + encrypted_value = var.encrypted_secret_string } ``` -```hcl +```terraform data "github_repository" "example" { full_name = "my-org/repo" } resource "github_repository_environment" "example_plaintext" { - repository = data.github_repository.example.name - environment = "example-environment" + repository = data.github_repository.example.name + environment = "example-environment" } resource "github_actions_environment_secret" "example_encrypted" { - repository = data.github_repository.example.name - environment = github_repository_environment.example.environment - secret_name = "test_secret_name" - value = "example-value" + repository = data.github_repository.example.name + environment = github_repository_environment.example.environment + secret_name = "test_secret_name" + plaintext_value = "example-value" } ``` @@ -60,12 +53,12 @@ resource "github_actions_environment_secret" "example_encrypted" { This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. -```hcl +```terraform resource "github_actions_environment_secret" "example_allow_drift" { - repository = "example-repo" - environment = "example-environment" - secret_name = "example_secret_name" - value = "placeholder" + repository = "example-repo" + environment = "example-environment" + secret_name = "example_secret_name" + plaintext_value = "placeholder" lifecycle { ignore_changes = [remote_updated_at] @@ -105,7 +98,7 @@ This resource can be imported using an ID made of the repository name, environme The following import imports a GitHub actions environment secret named `mysecret` for the repo `myrepo` and environment `myenv` to a `github_actions_environment_secret` resource named `example`. -```hcl +```terraform import { to = github_actions_environment_secret.example id = "myrepo:myenv:mysecret" diff --git a/website/docs/r/actions_environment_variable.html.markdown b/docs/resources/actions_environment_variable.md similarity index 85% rename from website/docs/r/actions_environment_variable.html.markdown rename to docs/resources/actions_environment_variable.md index d64141361d..3398c4bd1d 100644 --- a/website/docs/r/actions_environment_variable.html.markdown +++ b/docs/resources/actions_environment_variable.md @@ -1,18 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_actions_environment_variable" +page_title: "github_actions_environment_variable (Resource) - GitHub" description: |- Creates and manages an Action variable within a GitHub repository environment --- -# github_actions_environment_variable +# github_actions_environment_variable (Resource) -This resource allows you to create and manage GitHub Actions variables within your GitHub repository environments. -You must have write access to a repository to use this resource. +This resource allows you to create and manage GitHub Actions variables within your GitHub repository environments. You must have write access to a repository to use this resource. ## Example Usage -```hcl +```terraform resource "github_actions_environment_variable" "example" { repository = "example-repo" environment = "example-environment" @@ -21,14 +19,14 @@ resource "github_actions_environment_variable" "example" { } ``` -```hcl +```terraform data "github_repository" "example" { full_name = "my-org/repo" } resource "github_repository_environment" "example" { - repository = data.github_repository.example.name - environment = "example_environment" + repository = data.github_repository.example.name + environment = "example_environment" } resource "github_actions_environment_variable" "example" { @@ -62,7 +60,7 @@ This resource can be imported using an ID made of the repository name, environme The following import imports a GitHub actions environment variable named `myvariable` for the repo `myrepo` and environment `myenv` to a `github_actions_environment_variable` resource named `example`. -```hcl +```terraform import { to = github_actions_environment_variable.example id = "myrepo:myenv:myvariable" diff --git a/website/docs/r/actions_hosted_runner.html.markdown b/docs/resources/actions_hosted_runner.md similarity index 62% rename from website/docs/r/actions_hosted_runner.html.markdown rename to docs/resources/actions_hosted_runner.md index a78b0188f7..05103b4bd1 100644 --- a/website/docs/r/actions_hosted_runner.html.markdown +++ b/docs/resources/actions_hosted_runner.md @@ -1,14 +1,12 @@ --- -layout: "github" -page_title: "GitHub: github_actions_hosted_runner" +page_title: "github_actions_hosted_runner (Resource) - GitHub" description: |- Creates and manages GitHub-hosted runners within a GitHub organization --- -# github_actions_hosted_runner +# github_actions_hosted_runner (Resource) -This resource allows you to create and manage GitHub-hosted runners within your GitHub organization. -You must have admin access to an organization to use this resource. +This resource allows you to create and manage GitHub-hosted runners within your GitHub organization. You must have admin access to an organization to use this resource. GitHub-hosted runners are fully managed virtual machines that run your GitHub Actions workflows. Unlike self-hosted runners, GitHub handles the infrastructure, maintenance, and scaling. @@ -16,7 +14,7 @@ GitHub-hosted runners are fully managed virtual machines that run your GitHub Ac ### Basic Usage -```hcl +```terraform resource "github_actions_runner_group" "example" { name = "example-runner-group" visibility = "all" @@ -24,7 +22,7 @@ resource "github_actions_runner_group" "example" { resource "github_actions_hosted_runner" "example" { name = "example-hosted-runner" - + image { id = "2306" source = "github" @@ -37,7 +35,7 @@ resource "github_actions_hosted_runner" "example" { ### Advanced Usage with Optional Parameters -```hcl +```terraform resource "github_actions_runner_group" "advanced" { name = "advanced-runner-group" visibility = "selected" @@ -45,7 +43,7 @@ resource "github_actions_runner_group" "advanced" { resource "github_actions_hosted_runner" "advanced" { name = "advanced-hosted-runner" - + image { id = "2306" source = "github" @@ -62,28 +60,28 @@ resource "github_actions_hosted_runner" "advanced" { The following arguments are supported: -* `name` - (Required) Name of the hosted runner. Must be between 1 and 64 characters and may only contain alphanumeric characters, '.', '-', and '_'. -* `image` - (Required) Image configuration for the hosted runner. Cannot be changed after creation. Block supports: - * `id` - (Required) The image ID. For GitHub-owned images, use numeric IDs like "2306" for Ubuntu Latest 24.04. To get available images, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/images/github-owned`. - * `source` - (Optional) The image source. Valid values are "github", "partner", or "custom". Defaults to "github". -* `size` - (Required) Machine size for the hosted runner (e.g., "4-core", "8-core"). Can be updated to scale the runner. To list available sizes, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/machine-sizes`. -* `runner_group_id` - (Required) The ID of the runner group to assign this runner to. -* `maximum_runners` - (Optional) Maximum number of runners to scale up to. Runners will not auto-scale above this number. Use this setting to limit costs. -* `public_ip_enabled` - (Optional) Whether to enable static public IP for the runner. Note there are account limits. To list limits, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/limits`. Defaults to false. -* `image_version` - (Optional) The version of the runner image to deploy. This is only relevant for runners using custom images. +- `name` - (Required) Name of the hosted runner. Must be between 1 and 64 characters and may only contain alphanumeric characters, '.', '-', and '_'. +- `image` - (Required) Image configuration for the hosted runner. Cannot be changed after creation. Block supports: + - `id` - (Required) The image ID. For GitHub-owned images, use numeric IDs like "2306" for Ubuntu Latest 24.04. To get available images, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/images/github-owned`. + - `source` - (Optional) The image source. Valid values are "github", "partner", or "custom". Defaults to "github". +- `size` - (Required) Machine size for the hosted runner (e.g., "4-core", "8-core"). Can be updated to scale the runner. To list available sizes, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/machine-sizes`. +- `runner_group_id` - (Required) The ID of the runner group to assign this runner to. +- `maximum_runners` - (Optional) Maximum number of runners to scale up to. Runners will not auto-scale above this number. Use this setting to limit costs. +- `public_ip_enabled` - (Optional) Whether to enable static public IP for the runner. Note there are account limits. To list limits, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/limits`. Defaults to false. +- `image_version` - (Optional) The version of the runner image to deploy. This is only relevant for runners using custom images. ## Timeouts The `timeouts` block allows you to specify timeouts for certain actions: -* `delete` - (Defaults to 10 minutes) Used for waiting for the hosted runner deletion to complete. +- `delete` - (Defaults to 10 minutes) Used for waiting for the hosted runner deletion to complete. Example: -```hcl +```terraform resource "github_actions_hosted_runner" "example" { name = "example-hosted-runner" - + image { id = "2306" source = "github" @@ -102,43 +100,44 @@ resource "github_actions_hosted_runner" "example" { In addition to the arguments above, the following attributes are exported: -* `id` - The ID of the hosted runner. -* `status` - Current status of the runner (e.g., "Ready", "Provisioning"). -* `platform` - Platform of the runner (e.g., "linux-x64", "win-x64"). -* `image` - In addition to the arguments above, the image block exports: - * `size_gb` - The size of the image in gigabytes. -* `machine_size_details` - Detailed specifications of the machine size: - * `id` - Machine size identifier. - * `cpu_cores` - Number of CPU cores. - * `memory_gb` - Amount of memory in gigabytes. - * `storage_gb` - Amount of storage in gigabytes. -* `public_ips` - List of public IP ranges assigned to this runner (only if `public_ip_enabled` is true): - * `enabled` - Whether this IP range is enabled. - * `prefix` - IP address prefix. - * `length` - Subnet length. -* `last_active_on` - Timestamp (RFC3339) when the runner was last active. +- `id` - The ID of the hosted runner. +- `status` - Current status of the runner (e.g., "Ready", "Provisioning"). +- `platform` - Platform of the runner (e.g., "linux-x64", "win-x64"). +- `image` - In addition to the arguments above, the image block exports: + - `size_gb` - The size of the image in gigabytes. +- `machine_size_details` - Detailed specifications of the machine size: + - `id` - Machine size identifier. + - `cpu_cores` - Number of CPU cores. + - `memory_gb` - Amount of memory in gigabytes. + - `storage_gb` - Amount of storage in gigabytes. +- `public_ips` - List of public IP ranges assigned to this runner (only if `public_ip_enabled` is true): + - `enabled` - Whether this IP range is enabled. + - `prefix` - IP address prefix. + - `length` - Subnet length. +- `last_active_on` - Timestamp (RFC3339) when the runner was last active. ## Import Hosted runners can be imported using the runner ID: -``` -$ terraform import github_actions_hosted_runner.example 123456 +```shell +terraform import github_actions_hosted_runner.example 123456 ``` ## Notes -* This resource is **organization-only** and cannot be used with individual accounts. -* The `image` field cannot be changed after the runner is created. Changing it will force recreation of the runner. -* The `size` field can be updated to scale the runner up or down as needed. -* Image IDs for GitHub-owned images are numeric strings (e.g., "2306" for Ubuntu Latest 24.04), not names like "ubuntu-latest". -* Deletion of hosted runners is asynchronous. The provider will poll for up to 10 minutes (configurable via timeouts) to confirm deletion. -* Runner creation and updates may take several minutes as GitHub provisions the infrastructure. -* Static public IPs are subject to account limits. Check your organization's limits before enabling. +- This resource is **organization-only*- and cannot be used with individual accounts. +- The `image` field cannot be changed after the runner is created. Changing it will force recreation of the runner. +- The `size` field can be updated to scale the runner up or down as needed. +- Image IDs for GitHub-owned images are numeric strings (e.g., "2306" for Ubuntu Latest 24.04), not names like "ubuntu-latest". +- Deletion of hosted runners is asynchronous. The provider will poll for up to 10 minutes (configurable via timeouts) to confirm deletion. +- Runner creation and updates may take several minutes as GitHub provisions the infrastructure. +- Static public IPs are subject to account limits. Check your organization's limits before enabling. ## Getting Available Images and Sizes To get a list of available images: + ```bash curl -H "Authorization: Bearer YOUR_TOKEN" \ -H "Accept: application/vnd.github+json" \ @@ -146,6 +145,7 @@ curl -H "Authorization: Bearer YOUR_TOKEN" \ ``` To get available machine sizes: + ```bash curl -H "Authorization: Bearer YOUR_TOKEN" \ -H "Accept: application/vnd.github+json" \ diff --git a/docs/resources/actions_organization_oidc_subject_claim_customization_template.md b/docs/resources/actions_organization_oidc_subject_claim_customization_template.md new file mode 100644 index 0000000000..2e5a58b6c3 --- /dev/null +++ b/docs/resources/actions_organization_oidc_subject_claim_customization_template.md @@ -0,0 +1,33 @@ +--- +page_title: "github_actions_organization_oidc_subject_claim_customization_template (Resource) - GitHub" +description: |- + Creates and manages an OpenID Connect subject claim customization template for an organization. +--- + +# github_actions_organization_oidc_subject_claim_customization_template (Resource) + +This resource allows you to create and manage an OpenID Connect subject claim customization template within a GitHub organization. + +More information on integrating GitHub with cloud providers using OpenID Connect and a list of available claims is available in the [Actions documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). + +## Example Usage + +```terraform +resource "github_actions_organization_oidc_subject_claim_customization_template" "example_template" { + include_claim_keys = ["actor", "context", "repository_owner"] +} +``` + +## Argument Reference + +The following arguments are supported: + +- `include_claim_keys` - (Required) A list of OpenID Connect claims. + +## Import + +This resource can be imported using the organization's name. + +```shell +terraform import github_actions_organization_oidc_subject_claim_customization_template.test example_organization +``` diff --git a/docs/resources/actions_organization_permissions.md b/docs/resources/actions_organization_permissions.md new file mode 100644 index 0000000000..14ab6c6857 --- /dev/null +++ b/docs/resources/actions_organization_permissions.md @@ -0,0 +1,62 @@ +--- +page_title: "github_actions_organization_permissions (Resource) - GitHub" +description: |- + Creates and manages Actions permissions within a GitHub organization +--- + +# github_actions_organization_permissions (Resource) + +This resource allows you to create and manage GitHub Actions permissions within your GitHub enterprise organizations. You must have admin access to an organization to use this resource. + +## Example Usage + +```terraform +resource "github_repository" "example" { + name = "my-repository" +} + +resource "github_actions_organization_permissions" "test" { + allowed_actions = "selected" + enabled_repositories = "selected" + allowed_actions_config { + github_owned_allowed = true + patterns_allowed = ["actions/cache@*", "actions/checkout@*"] + verified_allowed = true + } + enabled_repositories_config { + repository_ids = [github_repository.example.repo_id] + } +} +``` + +## Argument Reference + +The following arguments are supported: + +- `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. +- `enabled_repositories` - (Required) The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. +- `allowed_actions_config` - (Optional) Sets the actions that are allowed in an organization. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details. +- `enabled_repositories_config` - (Optional) Sets the list of selected repositories that are enabled for GitHub Actions in an organization. Only available when `enabled_repositories` = `selected`. See [Enabled Repositories Config](#enabled-repositories-config) below for details. +- `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the organization. + +### Allowed Actions Config + +The `allowed_actions_config` block supports the following: + +- `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the organization. +- `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*." +- `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators. + +### Enabled Repositories Config + +The `enabled_repositories_config` block supports the following: + +- `repository_ids` - (Required) List of repository IDs to enable for GitHub Actions. + +## Import + +This resource can be imported using the name of the GitHub organization: + +```shell +terraform import github_actions_organization_permissions.test github_organization_name +``` diff --git a/website/docs/r/actions_organization_secret.html.markdown b/docs/resources/actions_organization_secret.md similarity index 76% rename from website/docs/r/actions_organization_secret.html.markdown rename to docs/resources/actions_organization_secret.md index 9a6c894283..c21beaecc6 100644 --- a/website/docs/r/actions_organization_secret.html.markdown +++ b/docs/resources/actions_organization_secret.md @@ -1,41 +1,34 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_secret" +page_title: "github_actions_organization_secret (Resource) - GitHub" description: |- Creates and manages an Action Secret within a GitHub organization --- -# github_actions_organization_secret +# github_actions_organization_secret (Resource) -This resource allows you to create and manage GitHub Actions secrets within your GitHub organization. -You must have write access to a repository to use this resource. +This resource allows you to create and manage GitHub Actions secrets within your GitHub organization. You must have write access to a repository to use this resource. -Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is -interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. -For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, -but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. -It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` -using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible -in your code. See below for an example of this abstraction. +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. ## Example Usage -```hcl +```terraform resource "github_actions_organization_secret" "example_plaintext" { - secret_name = "example_secret_name" - visibility = "all" - value = var.some_secret_string + secret_name = "example_secret_name" + visibility = "all" + plaintext_value = var.some_secret_string } resource "github_actions_organization_secret" "example_encrypted" { secret_name = "example_secret_name" visibility = "all" - value_encrypted = var.some_encrypted_secret_string + encrypted_value = var.some_encrypted_secret_string } ``` -```hcl +```terraform data "github_repository" "repo" { full_name = "my-org/repo" } @@ -43,14 +36,14 @@ data "github_repository" "repo" { resource "github_actions_organization_secret" "example_encrypted" { secret_name = "example_secret_name" visibility = "selected" - value = var.some_secret_string + plaintext_value = var.some_secret_string selected_repository_ids = [data.github_repository.repo.repo_id] } resource "github_actions_organization_secret" "example_secret" { secret_name = "example_secret_name" visibility = "selected" - value_encrypted = var.some_encrypted_secret_string + encrypted_value = var.some_encrypted_secret_string selected_repository_ids = [data.github_repository.repo.repo_id] } ``` @@ -59,11 +52,11 @@ resource "github_actions_organization_secret" "example_secret" { This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. -```hcl +```terraform resource "github_actions_organization_secret" "example_allow_drift" { secret_name = "example_secret_name" visibility = "all" - value = "placeholder" + plaintext_value = "placeholder" lifecycle { ignore_changes = [remote_updated_at] @@ -103,7 +96,7 @@ This resource can be imported using the secret name as the ID. The following import imports a GitHub actions organization secret named `mysecret` to a `github_actions_organization_secret` resource named `example`. -```hcl +```terraform import { to = github_actions_organization_secret.example id = "mysecret" diff --git a/website/docs/r/actions_organization_secret_repositories.html.markdown b/docs/resources/actions_organization_secret_repositories.md similarity index 75% rename from website/docs/r/actions_organization_secret_repositories.html.markdown rename to docs/resources/actions_organization_secret_repositories.md index 7cbff71ae4..c3526b66dd 100644 --- a/website/docs/r/actions_organization_secret_repositories.html.markdown +++ b/docs/resources/actions_organization_secret_repositories.md @@ -1,34 +1,32 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_secret_repositories" +page_title: "github_actions_organization_secret_repositories (Resource) - GitHub" description: |- Manages repository allow list for an Actions Secret within a GitHub organization. --- -# github_actions_organization_secret_repositories +# github_actions_organization_secret_repositories (Resource) -This resource allows you to manage the repositories allowed to access an actions secret within your GitHub organization. -You must have write access to an organization secret to use this resource. +This resource allows you to manage the repositories allowed to access an actions secret within your GitHub organization. You must have write access to an organization secret to use this resource. This resource is only applicable when `visibility` of the existing organization secret has been set to `selected`. ## Example Usage -```hcl +```terraform resource "github_actions_organization_secret" "example" { - secret_name = "mysecret" - value = "foo" - visibility = "selected" + secret_name = "mysecret" + plaintext_value = "foo" + visibility = "selected" } resource "github_repository" "example" { - name = "myrepo" - visibility = "public" + name = "myrepo" + visibility = "public" } resource "github_actions_organization_secret_repositories" "example" { secret_name = github_actions_organization_secret.example.name - selected_repository_ids = [ github_repository.example.repo_id ] + selected_repository_ids = [github_repository.example.repo_id] } ``` @@ -47,7 +45,7 @@ This resource can be imported using the secret name as the ID. The following import block imports the repositories able to access the actions organization secret named `mysecret` to a `github_actions_organization_secret_repositories` resource named `example`. -```hcl +```terraform import { to = github_actions_organization_secret_repositories.example id = "mysecret" diff --git a/website/docs/r/actions_organization_secret_repository.html.markdown b/docs/resources/actions_organization_secret_repository.md similarity index 79% rename from website/docs/r/actions_organization_secret_repository.html.markdown rename to docs/resources/actions_organization_secret_repository.md index f5e9e67959..34745a8d80 100644 --- a/website/docs/r/actions_organization_secret_repository.html.markdown +++ b/docs/resources/actions_organization_secret_repository.md @@ -1,29 +1,27 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_secret_repository" +page_title: "github_actions_organization_secret_repository (Resource) - GitHub" description: |- Add access for a repository to an Actions Secret within a GitHub organization. --- -# github_actions_organization_secret_repository +# github_actions_organization_secret_repository (Resource) -This resource adds permission for a repository to use an actions secret within your GitHub organization. -You must have write access to an organization secret to use this resource. +This resource adds permission for a repository to use an actions secret within your GitHub organization. You must have write access to an organization secret to use this resource. This resource is only applicable when `visibility` of the existing organization secret has been set to `selected`. ## Example Usage -```hcl +```terraform resource "github_actions_organization_secret" "example" { - secret_name = "mysecret" - value = "foo" - visibility = "selected" + secret_name = "mysecret" + plaintext_value = "foo" + visibility = "selected" } resource "github_repository" "example" { - name = "myrepo" - visibility = "public" + name = "myrepo" + visibility = "public" } resource "github_actions_organization_secret_repository" "example" { @@ -47,7 +45,7 @@ This resource can be imported using an ID made of the secret name and repository The following import block imports the access of repository ID `123456` for the actions organization secret named `mysecret` to a `github_actions_organization_secret_repository` resource named `example`. -```hcl +```terraform import { to = github_actions_organization_secret_repository.example id = "mysecret:123456" diff --git a/website/docs/r/actions_organization_variable.html.markdown b/docs/resources/actions_organization_variable.md similarity index 82% rename from website/docs/r/actions_organization_variable.html.markdown rename to docs/resources/actions_organization_variable.md index b70b8d9649..bfcdd07ace 100644 --- a/website/docs/r/actions_organization_variable.html.markdown +++ b/docs/resources/actions_organization_variable.md @@ -1,26 +1,24 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_variable" +page_title: "github_actions_organization_variable (Resource) - GitHub" description: |- Creates and manages an Action variable within a GitHub organization --- -# github_actions_organization_variable +# github_actions_organization_variable (Resource) -This resource allows you to create and manage GitHub Actions variables within your GitHub organization. -You must have write access to a repository to use this resource. +This resource allows you to create and manage GitHub Actions variables within your GitHub organization. You must have write access to a repository to use this resource. ## Example Usage -```hcl +```terraform resource "github_actions_organization_variable" "example_variable" { - variable_name = "example_variable_name" - visibility = "private" - value = "example_variable_value" + variable_name = "example_variable_name" + visibility = "private" + value = "example_variable_value" } ``` -```hcl +```terraform data "github_repository" "repo" { full_name = "my-org/repo" } @@ -55,7 +53,7 @@ This resource can be imported using the variable name as the ID. The following import imports a GitHub actions organization variable named `myvariable`to a `github_actions_organization_variable` resource named `example`. -```hcl +```terraform import { to = github_actions_organization_variable.example id = "myvariable" diff --git a/website/docs/r/actions_organization_variable_repositories.html.markdown b/docs/resources/actions_organization_variable_repositories.md similarity index 71% rename from website/docs/r/actions_organization_variable_repositories.html.markdown rename to docs/resources/actions_organization_variable_repositories.md index d69d24bfe8..f126dd0593 100644 --- a/website/docs/r/actions_organization_variable_repositories.html.markdown +++ b/docs/resources/actions_organization_variable_repositories.md @@ -1,34 +1,32 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_variable_repositories" +page_title: "github_actions_organization_variable_repositories (Resource) - GitHub" description: |- Manages repository allow list for an Actions Variable within a GitHub organization. --- -# github_actions_organization_variable_repositories +# github_actions_organization_variable_repositories (Resource) -This resource allows you to manage the repositories allowed to access an actions variable within your GitHub organization. -You must have write access to an organization variable to use this resource. +This resource allows you to manage the repositories allowed to access an actions variable within your GitHub organization. You must have write access to an organization variable to use this resource. This resource is only applicable when `visibility` of the existing organization variable has been set to `selected`. ## Example Usage -```hcl +```terraform resource "github_actions_organization_variable" "example" { - variable_name = "myvariable" - value = "foo" - visibility = "selected" + variable_name = "myvariable" + plaintext_value = "foo" + visibility = "selected" } resource "github_repository" "example" { - name = "myrepo" - visibility = "public" + name = "myrepo" + visibility = "public" } resource "github_actions_organization_variable_repositories" "example" { - variable_name = github_actions_organization_variable.example.name - selected_repository_ids = [ github_repository.example.repo_id ] + variable_name = github_actions_organization_variable.example.name + selected_repository_ids = [github_repository.example.repo_id] } ``` @@ -47,7 +45,7 @@ This resource can be imported using the variable name as the ID. The following import block imports the repositories able to access the actions organization variable named `myvariable` to a `github_actions_organization_variable_repositories` resource named `example`. -```hcl +```terraform import { to = github_actions_organization_variable_repositories.example id = "myvariable" diff --git a/website/docs/r/actions_organization_variable_repository.html.markdown b/docs/resources/actions_organization_variable_repository.md similarity index 75% rename from website/docs/r/actions_organization_variable_repository.html.markdown rename to docs/resources/actions_organization_variable_repository.md index 721a58db7a..d1d89a6b99 100644 --- a/website/docs/r/actions_organization_variable_repository.html.markdown +++ b/docs/resources/actions_organization_variable_repository.md @@ -1,33 +1,31 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_variable_repository" +page_title: "github_actions_organization_variable_repository (Resource) - GitHub" description: |- Add access for a repository to an Actions Variable within a GitHub organization. --- -# github_actions_organization_variable_repository +# github_actions_organization_variable_repository (Resource) -This resource adds permission for a repository to use an actions variables within your GitHub organization. -You must have write access to an organization variable to use this resource. +This resource adds permission for a repository to use an actions variables within your GitHub organization. You must have write access to an organization variable to use this resource. This resource is only applicable when `visibility` of the existing organization variable has been set to `selected`. ## Example Usage -```hcl +```terraform resource "github_actions_organization_variable" "example" { - variable_name = "myvariable" - value = "foo" - visibility = "selected" + variable_name = "myvariable" + plaintext_value = "foo" + visibility = "selected" } resource "github_repository" "example" { - name = "myrepo" - visibility = "public" + name = "myrepo" + visibility = "public" } resource "github_actions_organization_variable_repository" "example" { - variable_name = github_actions_organization_variable.example.name + variable_name = github_actions_organization_variable.example.name repository_id = github_repository.example.repo_id } ``` @@ -47,7 +45,7 @@ This resource can be imported using an ID made of the variable name and reposito The following import block imports the access of repository ID `123456` for the actions organization variable named `myvariable` to a `github_actions_organization_variable_repository` resource named `example`. -```hcl +```terraform import { to = github_actions_organization_variable_repository.example id = "myvariable:123456" diff --git a/website/docs/r/actions_organization_workflow_permissions.html.markdown b/docs/resources/actions_organization_workflow_permissions.md similarity index 78% rename from website/docs/r/actions_organization_workflow_permissions.html.markdown rename to docs/resources/actions_organization_workflow_permissions.md index ece7f34808..78c9e6afcf 100644 --- a/website/docs/r/actions_organization_workflow_permissions.html.markdown +++ b/docs/resources/actions_organization_workflow_permissions.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_actions_organization_workflow_permissions" +page_title: "github_actions_organization_workflow_permissions (Resource) - GitHub" description: |- Manages GitHub Actions workflow permissions for a GitHub Organization. --- -# github_actions_organization_workflow_permissions +# github_actions_organization_workflow_permissions (Resource) This resource allows you to manage GitHub Actions workflow permissions for a GitHub Organization account. This controls the default permissions granted to the GITHUB_TOKEN when running workflows and whether GitHub Actions can approve pull request reviews. @@ -13,7 +12,7 @@ You must have organization admin access to use this resource. ## Example Usage -```hcl +```terraform # Basic workflow permissions configuration resource "github_actions_organization_workflow_permissions" "example" { organization_slug = "my-organization" @@ -35,17 +34,17 @@ resource "github_actions_organization_workflow_permissions" "permissive" { The following arguments are supported: -* `organization_slug` - (Required) The slug of the organization. +- `organization_slug` - (Required) The slug of the organization. -* `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be `read` or `write`. Defaults to `read`. +- `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be `read` or `write`. Defaults to `read`. -* `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull request reviews. Defaults to `false`. +- `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull request reviews. Defaults to `false`. ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `id` - The organization slug. +- `id` - The organization slug. ## Import @@ -61,5 +60,5 @@ terraform import github_actions_organization_workflow_permissions.example my-org When this resource is destroyed, the workflow permissions will be reset to safe defaults: -* `default_workflow_permissions` = `read` -* `can_approve_pull_request_reviews` = `false` +- `default_workflow_permissions` = `read` +- `can_approve_pull_request_reviews` = `false` diff --git a/website/docs/r/actions_repository_access_level.html.markdown b/docs/resources/actions_repository_access_level.md similarity index 67% rename from website/docs/r/actions_repository_access_level.html.markdown rename to docs/resources/actions_repository_access_level.md index c59ee8674b..0d18d689c7 100644 --- a/website/docs/r/actions_repository_access_level.html.markdown +++ b/docs/resources/actions_repository_access_level.md @@ -1,18 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_actions_repository_access_level" +page_title: "github_actions_repository_access_level (Resource) - GitHub" description: |- Manages Actions and Reusable Workflow access for a GitHub repository --- -# github_actions_repository_access_level +# github_actions_repository_access_level (Resource) -This resource allows you to set the access level of a non-public repositories actions and reusable workflows for use in other repositories. -You must have admin access to a repository to use this resource. +This resource allows you to set the access level of a non-public repositories actions and reusable workflows for use in other repositories. You must have admin access to a repository to use this resource. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "my-repository" visibility = "private" @@ -28,13 +26,13 @@ resource "github_actions_repository_access_level" "test" { The following arguments are supported: -* `repository` - (Required) The GitHub repository -* `access_level` - (Required) Where the actions or reusable workflows of the repository may be used. Possible values are `none`, `user`, `organization`, or `enterprise`. +- `repository` - (Required) The GitHub repository +- `access_level` - (Required) Where the actions or reusable workflows of the repository may be used. Possible values are `none`, `user`, `organization`, or `enterprise`. ## Import This resource can be imported using the name of the GitHub repository: -``` +```hcl $ terraform import github_actions_repository_access_level.test my-repository ``` diff --git a/website/docs/r/actions_repository_oidc_subject_claim_customization_template.html.markdown b/docs/resources/actions_repository_oidc_subject_claim_customization_template.md similarity index 62% rename from website/docs/r/actions_repository_oidc_subject_claim_customization_template.html.markdown rename to docs/resources/actions_repository_oidc_subject_claim_customization_template.md index bf9b28b1d2..619a75609d 100644 --- a/website/docs/r/actions_repository_oidc_subject_claim_customization_template.html.markdown +++ b/docs/resources/actions_repository_oidc_subject_claim_customization_template.md @@ -1,17 +1,14 @@ --- -layout: "github" -page_title: "GitHub: github_actions_repository_oidc_subject_claim_customization_template" +page_title: "github_actions_repository_oidc_subject_claim_customization_template (Resource) - GitHub" description: |- -Creates and manages an OpenID Connect subject claim customization template for a repository + Creates and manages an OpenID Connect subject claim customization template for a repository --- -# github_actions_repository_oidc_subject_claim_customization_template +# github_actions_repository_oidc_subject_claim_customization_template (Resource) -This resource allows you to create and manage an OpenID Connect subject claim customization template for a GitHub -repository. +This resource allows you to create and manage an OpenID Connect subject claim customization template for a GitHub repository. -More information on integrating GitHub with cloud providers using OpenID Connect and a list of available claims is -available in the [Actions documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). +More information on integrating GitHub with cloud providers using OpenID Connect and a list of available claims is available in the [Actions documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). The following table lists the behaviour of `use_default`: @@ -23,14 +20,14 @@ The following table lists the behaviour of `use_default`: ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "example-repository" } resource "github_actions_repository_oidc_subject_claim_customization_template" "example_template" { - repository = github_repository.example.name - use_default = false + repository = github_repository.example.name + use_default = false include_claim_keys = ["actor", "context", "repository_owner"] } ``` @@ -39,14 +36,13 @@ resource "github_actions_repository_oidc_subject_claim_customization_template" " The following arguments are supported: -* `use_default` - (Required) Whether to use the default template or not. If `true`, `include_claim_keys` must not -be set. -* `include_claim_keys` - (Optional) A list of OpenID Connect claims. +- `use_default` - (Required) Whether to use the default template or not. If `true`, `include_claim_keys` must not be set. +- `include_claim_keys` - (Optional) A list of OpenID Connect claims. ## Import This resource can be imported using the repository's name. -``` +```hcl $ terraform import github_actions_repository_oidc_subject_claim_customization_template.test example_repository -``` \ No newline at end of file +``` diff --git a/website/docs/r/actions_repository_permissions.html.markdown b/docs/resources/actions_repository_permissions.md similarity index 58% rename from website/docs/r/actions_repository_permissions.html.markdown rename to docs/resources/actions_repository_permissions.md index f71f0737b4..6cedf2ce39 100644 --- a/website/docs/r/actions_repository_permissions.html.markdown +++ b/docs/resources/actions_repository_permissions.md @@ -1,18 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_actions_repository_permissions" +page_title: "github_actions_repository_permissions (Resource) - GitHub" description: |- Enables and manages Actions permissions for a GitHub repository --- -# github_actions_repository_permissions +# github_actions_repository_permissions (Resource) -This resource allows you to enable and manage GitHub Actions permissions for a given repository. -You must have admin access to an repository to use this resource. +This resource allows you to enable and manage GitHub Actions permissions for a given repository. You must have admin access to an repository to use this resource. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "my-repository" } @@ -32,24 +30,24 @@ resource "github_actions_repository_permissions" "test" { The following arguments are supported: -* `repository` - (Required) The GitHub repository -* `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. -* `enabled` - (Optional) Should GitHub actions be enabled on this repository? -* `allowed_actions_config` - (Optional) Sets the actions that are allowed in an repository. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details. -* `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the repository. +- `repository` - (Required) The GitHub repository +- `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. +- `enabled` - (Optional) Should GitHub actions be enabled on this repository? +- `allowed_actions_config` - (Optional) Sets the actions that are allowed in an repository. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details. +- `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the repository. ### Allowed Actions Config The `allowed_actions_config` block supports the following: -* `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the repository. -* `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*." -* `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators. +- `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the repository. +- `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*." +- `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators. ## Import This resource can be imported using the name of the GitHub repository: -``` +```hcl $ terraform import github_actions_repository_permissions.test my-repository ``` diff --git a/docs/resources/actions_runner_group.md b/docs/resources/actions_runner_group.md new file mode 100644 index 0000000000..90f013dc27 --- /dev/null +++ b/docs/resources/actions_runner_group.md @@ -0,0 +1,55 @@ +--- +page_title: "github_actions_runner_group (Resource) - GitHub" +description: |- + Creates and manages an Actions Runner Group within a GitHub organization +--- + +# github_actions_runner_group (Resource) + +This resource allows you to create and manage GitHub Actions runner groups within your GitHub enterprise organizations. You must have admin access to an organization to use this resource. + +## Example Usage + +```terraform +resource "github_repository" "example" { + name = "my-repository" +} + +resource "github_actions_runner_group" "example" { + name = github_repository.example.name + visibility = "selected" + selected_repository_ids = [github_repository.example.repo_id] +} +``` + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) Name of the runner group +- `restricted_to_workflows` - (Optional) If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. +- `selected_repository_ids` - (Optional) IDs of the repositories which should be added to the runner group +- `selected_workflows` - (Optional) List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. +- `visibility` - (Optional) Visibility of a runner group. Whether the runner group can include `all`, `selected`, or `private` repositories. A value of `private` is not currently supported due to limitations in the GitHub API. +- `allows_public_repositories` - (Optional) Whether public repositories can be added to the runner group. Defaults to false. + +## Attributes Reference + +- `allows_public_repositories` - Whether public repositories can be added to the runner group +- `default` - Whether this is the default runner group +- `etag` - An etag representing the runner group object +- `inherited` - Whether the runner group is inherited from the enterprise level +- `runners_url` - The GitHub API URL for the runner group's runners +- `selected_repository_ids` - List of repository IDs that can access the runner group +- `selected_repositories_url` - GitHub API URL for the runner group's repositories +- `visibility` - The visibility of the runner group +- `restricted_to_workflows` - If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. +- `selected_workflows` - List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + +## Import + +This resource can be imported using the ID of the runner group: + +```hcl +$ terraform import github_actions_runner_group.test 7 +``` diff --git a/website/docs/r/actions_secret.html.markdown b/docs/resources/actions_secret.md similarity index 71% rename from website/docs/r/actions_secret.html.markdown rename to docs/resources/actions_secret.md index 9b5890c0b0..0e2a5a2459 100644 --- a/website/docs/r/actions_secret.html.markdown +++ b/docs/resources/actions_secret.md @@ -1,37 +1,30 @@ --- -layout: "github" -page_title: "GitHub: github_actions_secret" +page_title: "github_actions_secret (Resource) - GitHub" description: |- Creates and manages an Action Secret within a GitHub repository --- -# github_actions_secret +# github_actions_secret (Resource) -This resource allows you to create and manage GitHub Actions secrets within your GitHub repositories. -You must have write access to a repository to use this resource. +This resource allows you to create and manage GitHub Actions secrets within your GitHub repositories. You must have write access to a repository to use this resource. -Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is -interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. -For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, -but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. -It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` -using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible -in your code. See below for an example of this abstraction. +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. ## Example Usage -```hcl +```terraform resource "github_actions_secret" "example_plaintext" { - repository = "example_repository" - secret_name = "example_secret_name" - value = var.some_secret_string + repository = "example_repository" + secret_name = "example_secret_name" + plaintext_value = var.some_secret_string } resource "github_actions_secret" "example_encrypted" { - repository = "example_repository" - secret_name = "example_secret_name" - value_encrypted = var.some_encrypted_secret_string + repository = "example_repository" + secret_name = "example_secret_name" + encrypted_value = var.some_encrypted_secret_string } ``` @@ -39,11 +32,11 @@ resource "github_actions_secret" "example_encrypted" { This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. -```hcl +```terraform resource "github_actions_secret" "example_allow_drift" { - repository = "example_repository" - secret_name = "example_secret_name" - value = "placeholder" + repository = "example_repository" + secret_name = "example_secret_name" + plaintext_value = "placeholder" lifecycle { ignore_changes = [remote_updated_at] @@ -83,7 +76,7 @@ This resource can be imported using an ID made of the repository name, and secre The following import imports a GitHub actions secret named `mysecret` for the repo `myrepo` to a `github_actions_secret` resource named `example`. -```hcl +```terraform import { to = github_actions_secret.example id = "myrepo:mysecret" diff --git a/website/docs/r/actions_variable.html.markdown b/docs/resources/actions_variable.md similarity index 78% rename from website/docs/r/actions_variable.html.markdown rename to docs/resources/actions_variable.md index 862e6572db..7ea56fc59b 100644 --- a/website/docs/r/actions_variable.html.markdown +++ b/docs/resources/actions_variable.md @@ -1,22 +1,20 @@ --- -layout: "github" -page_title: "GitHub: github_actions_variable" +page_title: "github_actions_variable (Resource) - GitHub" description: |- Creates and manages an Action variable within a GitHub repository --- -# github_actions_variable +# github_actions_variable (Resource) -This resource allows you to create and manage GitHub Actions variables within your GitHub repositories. -You must have write access to a repository to use this resource. +This resource allows you to create and manage GitHub Actions variables within your GitHub repositories. You must have write access to a repository to use this resource. ## Example Usage -```hcl +```terraform resource "github_actions_variable" "example_variable" { - repository = "example_repository" - variable_name = "example_variable_name" - value = "example_variable_value" + repository = "example_repository" + variable_name = "example_variable_name" + value = "example_variable_value" } ``` @@ -42,7 +40,7 @@ This resource can be imported using an ID made of the repository name, and varia The following import imports a GitHub actions variable named `myvariable` for the repo `myrepo` to a `github_actions_variable` resource named `example`. -```hcl +```terraform import { to = github_actions_variable.example id = "myrepo:myvariable" diff --git a/website/docs/r/app_installation_repositories.html.markdown b/docs/resources/app_installation_repositories.md similarity index 55% rename from website/docs/r/app_installation_repositories.html.markdown rename to docs/resources/app_installation_repositories.md index 18132bb544..77fb1c4e5b 100644 --- a/website/docs/r/app_installation_repositories.html.markdown +++ b/docs/resources/app_installation_repositories.md @@ -1,27 +1,22 @@ --- -layout: "github" -page_title: "GitHub: github_app_installation_repository" +page_title: "github_app_installation_repositories (Resource) - GitHub" description: |- Manages the associations between app installations and repositories. --- -# github_app_installation_repositories +# github_app_installation_repositories (Resource) ~> **Note**: This resource is not compatible with the GitHub App Installation authentication method. -This resource manages relationships between app installations and repositories -in your GitHub organization or your user account. +This resource manages relationships between app installations and repositories in your GitHub organization or your user account. Creating this resource installs a particular app on multiple repositories. -The app installation and the repositories must all belong to the same -organization or user account on GitHub. Note: you can review your organization's installations -by the following the instructions at this -[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps). +The app installation and the repositories must all belong to the same organization or user account on GitHub. Note: you can review your organization's installations by the following the instructions at this [link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps). ## Example Usage -```hcl +```terraform # Create some repositories. resource "github_repository" "some_repo" { name = "some-repo" @@ -33,8 +28,8 @@ resource "github_repository" "another_repo" { resource "github_app_installation_repositories" "some_app_repos" { # The installation id of the app (in the organization). - installation_id = "1234567" - selected_repositories = [github_repository.some_repo.name, github_repository.another_repo.name]" + installation_id = "1234567" + selected_repositories = [github_repository.some_repo.name, github_repository.another_repo.name] } ``` @@ -42,16 +37,15 @@ resource "github_app_installation_repositories" "some_app_repos" { The following arguments are supported: -* `installation_id` - (Required) The GitHub app installation id. -* `selected_repositories` - (Required) A list of repository names to install the app on. +- `installation_id` - (Required) The GitHub app installation id. +- `selected_repositories` - (Required) A list of repository names to install the app on. ~> **Note**: Due to how GitHub implements app installations, apps cannot be installed with no repositories selected. Therefore deleting this resource will leave one repository with the app installed. Manually uninstall the app or set the installation to all repositories via the GUI as after deleting this resource. ## Import -GitHub App Installation Repositories can be imported -using an ID made up of `installation_id`, e.g. +GitHub App Installation Repositories can be imported using an ID made up of `installation_id`, e.g. -``` +```hcl $ terraform import github_app_installation_repositories.some_app_repos 1234567 ``` diff --git a/docs/resources/app_installation_repository.md b/docs/resources/app_installation_repository.md new file mode 100644 index 0000000000..5410165b49 --- /dev/null +++ b/docs/resources/app_installation_repository.md @@ -0,0 +1,45 @@ +--- +page_title: "github_app_installation_repository (Resource) - GitHub" +description: |- + Manages the associations between app installations and repositories. +--- + +# github_app_installation_repository (Resource) + +~> **Note**: This resource is not compatible with the GitHub App Installation authentication method. + +This resource manages relationships between app installations and repositories in your GitHub organization or your user account. + +Creating this resource installs a particular app on a particular repository. + +The app installation and the repository must both belong to the same organization or user account on GitHub. Note: you can review your organization's installations by the following the instructions at this [link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps). + +## Example Usage + +```terraform +# Create a repository. +resource "github_repository" "some_repo" { + name = "some-repo" +} + +resource "github_app_installation_repository" "some_app_repo" { + # The installation id of the app (in the organization). + installation_id = "1234567" + repository = github_repository.some_repo.name +} +``` + +## Argument Reference + +The following arguments are supported: + +- `installation_id` - (Required) The GitHub app installation id. +- `repository` - (Required) The repository to install the app on. + +## Import + +GitHub App Installation Repository can be imported using an ID made up of `installation_id:repository`, e.g. + +```hcl +$ terraform import github_app_installation_repository.terraform_repo 1234567:terraform +``` diff --git a/website/docs/r/branch.html.markdown b/docs/resources/branch.md similarity index 62% rename from website/docs/r/branch.html.markdown rename to docs/resources/branch.md index cb7e570632..eca21e2799 100644 --- a/website/docs/r/branch.html.markdown +++ b/docs/resources/branch.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_branch" +page_title: "github_branch (Resource) - GitHub" description: |- Creates and manages branches within GitHub repositories. --- @@ -9,12 +8,11 @@ description: |- This resource allows you to create and manage branches within your repository. -Additional constraints can be applied to ensure your branch is created from -another branch or commit. +Additional constraints can be applied to ensure your branch is created from another branch or commit. ## Example Usage -```hcl +```terraform resource "github_branch" "development" { repository = "example" branch = "development" @@ -25,43 +23,42 @@ resource "github_branch" "development" { The following arguments are supported: -* `repository` - (Required) The GitHub repository name. +- `repository` - (Required) The GitHub repository name. -* `branch` - (Required) The repository branch to create. +- `branch` - (Required) The repository branch to create. -* `source_branch` - (Optional) The branch name to start from. Defaults to `main`. +- `source_branch` - (Optional) The branch name to start from. Defaults to `main`. -* `source_sha` - (Optional) The commit hash to start from. Defaults to the tip of `source_branch`. If provided, `source_branch` is ignored. +- `source_sha` - (Optional) The commit hash to start from. Defaults to the tip of `source_branch`. If provided, `source_branch` is ignored. ## Attribute Reference The following additional attributes are exported: -* `source_sha` - A string storing the commit this branch was started from. Not populated when imported. +- `source_sha` - A string storing the commit this branch was started from. Not populated when imported. -* `etag` - An etag representing the Branch object. +- `etag` - An etag representing the Branch object. -* `ref` - A string representing a branch reference, in the form of `refs/heads/`. +- `ref` - A string representing a branch reference, in the form of `refs/heads/`. -* `sha` - A string storing the reference's `HEAD` commit's SHA1. +- `sha` - A string storing the reference's `HEAD` commit's SHA1. ## Import GitHub Branch can be imported using an ID made up of `repository:branch`, e.g. -``` +```hcl $ terraform import github_branch.terraform terraform:main ``` Importing github branch into an instance object (when using a for each block to manage multiple branches) -``` +```hcl $ terraform import github_branch.terraform["terraform"] terraform:main ``` -Optionally, a source branch may be specified using an ID of `repository:branch:source_branch`. -This is useful for importing branches that do not branch directly off main. +Optionally, a source branch may be specified using an ID of `repository:branch:source_branch`. This is useful for importing branches that do not branch directly off main. -``` +```hcl $ terraform import github_branch.terraform terraform:feature-branch:dev ``` diff --git a/website/docs/r/branch_default.html.markdown b/docs/resources/branch_default.md similarity index 67% rename from website/docs/r/branch_default.html.markdown rename to docs/resources/branch_default.md index e7d4361046..a8a7b4af89 100644 --- a/website/docs/r/branch_default.html.markdown +++ b/docs/resources/branch_default.md @@ -1,23 +1,22 @@ --- -layout: "github" -page_title: "GitHub: github_branch_default" +page_title: "github_branch_default (Resource) - GitHub" description: |- Provides a GitHub branch default for a given repository. --- -# github_branch_default +# github_branch_default (Resource) Provides a GitHub branch default resource. -This resource allows you to set the default branch for a given repository. +This resource allows you to set the default branch for a given repository. -Note that use of this resource is incompatible with the `default_branch` option of the `github_repository` resource. Using both will result in plans always showing a diff. +Note that use of this resource is incompatible with the `default_branch` option of the `github_repository` resource. Using both will result in plans always showing a diff. ## Example Usage Basic usage: -```hcl +```terraform resource "github_repository" "example" { name = "example" description = "My awesome codebase" @@ -29,7 +28,7 @@ resource "github_branch" "development" { branch = "development" } -resource "github_branch_default" "default"{ +resource "github_branch_default" "default" { repository = github_repository.example.name branch = github_branch.development.branch } @@ -37,14 +36,14 @@ resource "github_branch_default" "default"{ Renaming to a branch that doesn't exist: -```hcl +```terraform resource "github_repository" "example" { name = "example" description = "My awesome codebase" auto_init = true } -resource "github_branch_default" "default"{ +resource "github_branch_default" "default" { repository = github_repository.example.name branch = "development" rename = true @@ -55,14 +54,14 @@ resource "github_branch_default" "default"{ The following arguments are supported: -* `repository` - (Required) The GitHub repository -* `branch` - (Required) The branch (e.g. `main`) -* `rename` - (Optional) Indicate if it should rename the branch rather than use an existing branch. Defaults to `false`. +- `repository` - (Required) The GitHub repository +- `branch` - (Required) The branch (e.g. `main`) +- `rename` - (Optional) Indicate if it should rename the branch rather than use an existing branch. Defaults to `false`. ## Import GitHub Branch Defaults can be imported using an ID made up of `repository`, e.g. -``` +```hcl $ terraform import github_branch_default.branch_default my-repo ``` diff --git a/website/docs/r/branch_protection.html.markdown b/docs/resources/branch_protection.md similarity index 66% rename from website/docs/r/branch_protection.html.markdown rename to docs/resources/branch_protection.md index 842f33b390..99ee0dab4c 100644 --- a/website/docs/r/branch_protection.html.markdown +++ b/docs/resources/branch_protection.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_branch_protection" +page_title: "github_branch_protection (Resource) - GitHub" description: |- Protects a GitHub branch. --- @@ -15,7 +14,7 @@ Note: for the `push_allowances` a given user or team must have specific write ac ## Example Usage -```hcl +```terraform # Protect the main branch of the foo repository. Additionally, require that # the "ci/travis" context to be passing and only allow the engineers team merge # to the branch. @@ -35,8 +34,8 @@ resource "github_branch_protection" "example" { } required_pull_request_reviews { - dismiss_stale_reviews = true - restrict_dismissals = true + dismiss_stale_reviews = true + restrict_dismissals = true dismissal_restrictions = [ data.github_user.example.node_id, github_team.example.node_id, @@ -91,56 +90,52 @@ resource "github_team_repository" "example" { The following arguments are supported: -* `repository_id` - (Required) The name or node ID of the repository associated with this branch protection rule. -* `pattern` - (Required) Identifies the protection rule pattern. -* `enforce_admins` - (Optional) Boolean, setting this to `true` enforces status checks for repository administrators. -* `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG. -* `required_linear_history` - (Optional) Boolean, setting this to `true` enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch -* `require_conversation_resolution` - (Optional) Boolean, setting this to `true` requires all conversations on code must be resolved before a pull request can be merged. -* `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. -* `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. -* `restrict_pushes` - (Optional) Restrict pushes to matching branches. See [Restrict Pushes](#restrict-pushes) below for details. -* `force_push_bypassers` - (Optional) The list of actor Names/IDs that are allowed to bypass force push restrictions. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. If the list is not empty, `allows_force_pushes` should be set to `false`. -* `allows_deletions` - (Optional) Boolean, setting this to `true` to allow the branch to be deleted. -* `allows_force_pushes` - (Optional) Boolean, setting this to `true` to allow force pushes on the branch to everyone. Set it to `false` if you specify `force_push_bypassers`. -* `lock_branch` - (Optional) Boolean, Setting this to `true` will make the branch read-only and preventing any pushes to it. Defaults to `false` +- `repository_id` - (Required) The name or node ID of the repository associated with this branch protection rule. +- `pattern` - (Required) Identifies the protection rule pattern. +- `enforce_admins` - (Optional) Boolean, setting this to `true` enforces status checks for repository administrators. +- `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG. +- `required_linear_history` - (Optional) Boolean, setting this to `true` enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch +- `require_conversation_resolution` - (Optional) Boolean, setting this to `true` requires all conversations on code must be resolved before a pull request can be merged. +- `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. +- `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. +- `restrict_pushes` - (Optional) Restrict pushes to matching branches. See [Restrict Pushes](#restrict-pushes) below for details. +- `force_push_bypassers` - (Optional) The list of actor Names/IDs that are allowed to bypass force push restrictions. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. If the list is not empty, `allows_force_pushes` should be set to `false`. +- `allows_deletions` - (Optional) Boolean, setting this to `true` to allow the branch to be deleted. +- `allows_force_pushes` - (Optional) Boolean, setting this to `true` to allow force pushes on the branch to everyone. Set it to `false` if you specify `force_push_bypassers`. +- `lock_branch` - (Optional) Boolean, Setting this to `true` will make the branch read-only and preventing any pushes to it. Defaults to `false` ### Required Status Checks `required_status_checks` supports the following arguments: -* `strict`: (Optional) Require branches to be up to date before merging. Defaults to `false`. -* `contexts`: (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. +- `strict`: (Optional) Require branches to be up to date before merging. Defaults to `false`. +- `contexts`: (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. -~> Note: This attribute can contain multiple string patterns. -If specified, usual value is the [job name](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname). Otherwise, the [job id](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname) is defaulted to. -For workflows that use matrixes, append the matrix name to the value using the following pattern `([, ])`. Matrixes should be specified based on the order of matrix properties in the workflow file. See [GitHub Documentation]("https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#using-a-matrix-strategy") for more information. -For workflows that use reusable workflows, the pattern is ` / `. This can extend multiple levels. +~> Note: This attribute can contain multiple string patterns. If specified, usual value is the [job name](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname). Otherwise, the [job id](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname) is defaulted to. For workflows that use matrixes, append the matrix name to the value using the following pattern `([, ])`. Matrixes should be specified based on the order of matrix properties in the workflow file. See [GitHub Documentation](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#using-a-matrix-strategy) for more information. For workflows that use reusable workflows, the pattern is ` / `. This can extend multiple levels. ### Required Pull Request Reviews `required_pull_request_reviews` supports the following arguments: -* `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. -* `restrict_dismissals`: (Optional) Restrict pull request review dismissals. -* `dismissal_restrictions`: (Optional) The list of actor Names/IDs with dismissal access. If not empty, `restrict_dismissals` is ignored. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. -* `pull_request_bypassers`: (Optional) The list of actor Names/IDs that are allowed to bypass pull request requirements. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. -* `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. -* `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6. This requirement matches GitHub's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information. - (https://developer.github.com/v3/repos/branches/#parameters-1) for more information. -* `require_last_push_approval`: (Optional) Require that The most recent push must be approved by someone other than the last pusher. Defaults to `false` +- `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. +- `restrict_dismissals`: (Optional) Restrict pull request review dismissals. +- `dismissal_restrictions`: (Optional) The list of actor Names/IDs with dismissal access. If not empty, `restrict_dismissals` is ignored. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. +- `pull_request_bypassers`: (Optional) The list of actor Names/IDs that are allowed to bypass pull request requirements. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. +- `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. +- `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6. This requirement matches GitHub's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information. () for more information. +- `require_last_push_approval`: (Optional) Require that The most recent push must be approved by someone other than the last pusher. Defaults to `false` ### Restrict Pushes `restrict_pushes` supports the following arguments: -* `blocks_creations` - (Optional) Boolean, setting this to `false` allows people, teams, or apps to create new branches matching this rule. Defaults to `true`. -* `push_allowances` - (Optional) A list of actor Names/IDs that may push to the branch. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. Organization administrators, repository administrators, and users with the Maintain role on the repository can always push when all other requirements have passed. +- `blocks_creations` - (Optional) Boolean, setting this to `false` allows people, teams, or apps to create new branches matching this rule. Defaults to `true`. +- `push_allowances` - (Optional) A list of actor Names/IDs that may push to the branch. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. Organization administrators, repository administrators, and users with the Maintain role on the repository can always push when all other requirements have passed. ## Import GitHub Branch Protection can be imported using an ID made up of `repository:pattern`, e.g. -``` +```hcl $ terraform import github_branch_protection.terraform terraform:main -``` \ No newline at end of file +``` diff --git a/website/docs/r/branch_protection_v3.html.markdown b/docs/resources/branch_protection_v3.md similarity index 61% rename from website/docs/r/branch_protection_v3.html.markdown rename to docs/resources/branch_protection_v3.md index b3cdbd2c07..a27ee8f037 100644 --- a/website/docs/r/branch_protection_v3.html.markdown +++ b/docs/resources/branch_protection_v3.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_branch_protection_v3" +page_title: "github_branch_protection_v3 (Resource) - GitHub" description: |- Protects a GitHub branch using the v3 / REST implementation. The `github_branch_protection` resource has moved to the GraphQL API, while this resource will continue to leverage the REST API --- -# github_branch_protection_v3 +# github_branch_protection_v3 (Resource) Protects a GitHub branch. @@ -15,11 +14,11 @@ This resource allows you to configure branch protection for repositories in your ## Example Usage -```hcl +```terraform # Protect the main branch of the foo repository. Only allow a specific user to merge to the branch. resource "github_branch_protection_v3" "example" { - repository = github_repository.example.name - branch = "main" + repository = github_repository.example.name + branch = "main" restrictions { users = ["foo-user"] @@ -27,7 +26,7 @@ resource "github_branch_protection_v3" "example" { } ``` -```hcl +```terraform # Protect the main branch of the foo repository. Additionally, require that # the "ci/check" check ran by the Github Actions app is passing and only allow # the engineers team merge to the branch. @@ -38,7 +37,7 @@ resource "github_branch_protection_v3" "example" { enforce_admins = true required_status_checks { - strict = false + strict = false checks = [ "ci/check:824642007264" ] @@ -83,51 +82,46 @@ resource "github_team_repository" "example" { The following arguments are supported: -* `repository` - (Required) The GitHub repository name. -* `branch` - (Required) The Git branch to protect. -* `enforce_admins` - (Optional) Boolean, setting this to `true` enforces status checks for repository administrators. -* `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG. -* `require_conversation_resolution` - (Optional) Boolean, setting this to `true` requires all conversations on code must be resolved before a pull request can be merged. -* `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. -* `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. -* `restrictions` - (Optional) Enforce restrictions for the users and teams that may push to the branch. See [Restrictions](#restrictions) below for details. +- `repository` - (Required) The GitHub repository name. +- `branch` - (Required) The Git branch to protect. +- `enforce_admins` - (Optional) Boolean, setting this to `true` enforces status checks for repository administrators. +- `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG. +- `require_conversation_resolution` - (Optional) Boolean, setting this to `true` requires all conversations on code must be resolved before a pull request can be merged. +- `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. +- `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. +- `restrictions` - (Optional) Enforce restrictions for the users and teams that may push to the branch. See [Restrictions](#restrictions) below for details. ### Required Status Checks `required_status_checks` supports the following arguments: -* `strict`: (Optional) Require branches to be up to date before merging. Defaults to `false`. -* `contexts`: [**DEPRECATED**] (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. +- `strict`: (Optional) Require branches to be up to date before merging. Defaults to `false`. +- `contexts`: (**DEPRECATED**) (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. -~> Note: This attribute can contain multiple string patterns. -If specified, usual value is the [job name](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname). Otherwise, the [job id](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname) is defaulted to. -For workflows that use matrixes, append the matrix name to the value using the following pattern `([, ])`. Matrixes should be specified based on the order of matrix properties in the workflow file. See [GitHub Documentation]("https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#using-a-matrix-strategy") for more information. -For workflows that use reusable workflows, the pattern is ` / `. This can extend multiple levels. +~> Note: This attribute can contain multiple string patterns. If specified, usual value is the [job name](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname). Otherwise, the [job id](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname) is defaulted to. For workflows that use matrixes, append the matrix name to the value using the following pattern `([, ])`. Matrixes should be specified based on the order of matrix properties in the workflow file. See [GitHub Documentation](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#using-a-matrix-strategy) for more information. For workflows that use reusable workflows, the pattern is ` / `. This can extend multiple levels. -* `checks`: (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. Checks should be strings containing the context and app_id like so "context:app_id". +- `checks`: (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. Checks should be strings containing the context and app_id like so "context:app_id". ### Required Pull Request Reviews `required_pull_request_reviews` supports the following arguments: -* `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. -* `dismissal_users`: (Optional) The list of user logins with dismissal access -* `dismissal_teams`: (Optional) The list of team slugs with dismissal access. - Always use `slug` of the team, **not** its name. Each team already **has** to have access to the repository. -* `dismissal_apps`: (Optional) The list of app slugs with dismissal access. -* `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. -* `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6. This requirement matches GitHub's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information. -* `bypass_pull_request_allowances`: (Optional) Allow specific users, teams, or apps to bypass pull request requirements. See [Bypass Pull Request Allowances](#bypass-pull-request-allowances) below for details. -* `require_last_push_approval`: (Optional) Require that the most recent push must be approved by someone other than the last pusher. Defaults to `false` +- `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. +- `dismissal_users`: (Optional) The list of user logins with dismissal access +- `dismissal_teams`: (Optional) The list of team slugs with dismissal access. Always use `slug` of the team, **not*- its name. Each team already **has*- to have access to the repository. +- `dismissal_apps`: (Optional) The list of app slugs with dismissal access. +- `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. +- `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6. This requirement matches GitHub's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information. +- `bypass_pull_request_allowances`: (Optional) Allow specific users, teams, or apps to bypass pull request requirements. See [Bypass Pull Request Allowances](#bypass-pull-request-allowances) below for details. +- `require_last_push_approval`: (Optional) Require that the most recent push must be approved by someone other than the last pusher. Defaults to `false` ### Restrictions `restrictions` supports the following arguments: -* `users`: (Optional) The list of user logins with push access. -* `teams`: (Optional) The list of team slugs with push access. - Always use `slug` of the team, **not** its name. Each team already **has** to have access to the repository. -* `apps`: (Optional) The list of app slugs with push access. +- `users`: (Optional) The list of user logins with push access. +- `teams`: (Optional) The list of team slugs with push access. Always use `slug` of the team, **not*- its name. Each team already **has*- to have access to the repository. +- `apps`: (Optional) The list of app slugs with push access. `restrictions` is only available for organization-owned repositories. @@ -143,6 +137,6 @@ For workflows that use reusable workflows, the pattern is ` **Note:** This resource requires a GitHub Enterprise account and enterprise admin permissions. When this resource is destroyed, the workflow permissions will be reset to safe defaults: + - `default_workflow_permissions` = `read` -- `can_approve_pull_request_reviews` = `false` \ No newline at end of file +- `can_approve_pull_request_reviews` = `false` diff --git a/website/docs/r/enterprise_ip_allow_list_entry.html.markdown b/docs/resources/enterprise_ip_allow_list_entry.md similarity index 55% rename from website/docs/r/enterprise_ip_allow_list_entry.html.markdown rename to docs/resources/enterprise_ip_allow_list_entry.md index 45817dffba..64fcf4712a 100644 --- a/website/docs/r/enterprise_ip_allow_list_entry.html.markdown +++ b/docs/resources/enterprise_ip_allow_list_entry.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_enterprise_ip_allow_list_entry" +page_title: "github_enterprise_ip_allow_list_entry (Resource) - GitHub" description: |- Creates and manages IP allow list entries within a GitHub Enterprise --- -# github_enterprise_ip_allow_list_entry +# github_enterprise_ip_allow_list_entry (Resource) This resource allows you to create and manage IP allow list entries for a GitHub Enterprise account. IP allow list entries define IP addresses or ranges that are permitted to access private resources in the enterprise. ## Example Usage -```hcl +```terraform resource "github_enterprise_ip_allow_list_entry" "test" { enterprise_slug = "my-enterprise" ip = "192.168.1.0/20" @@ -24,15 +23,15 @@ resource "github_enterprise_ip_allow_list_entry" "test" { The following arguments are supported: -* `enterprise_slug` - (Required) The slug of the enterprise. -* `ip` - (Required) An IP address or range of IP addresses in CIDR notation. -* `name` - (Optional) A descriptive name for the IP allow list entry. -* `is_active` - (Optional) Whether the entry is currently active. Default: true. +- `enterprise_slug` - (Required) The slug of the enterprise. +- `ip` - (Required) An IP address or range of IP addresses in CIDR notation. +- `name` - (Optional) A descriptive name for the IP allow list entry. +- `is_active` - (Optional) Whether the entry is currently active. Default: true. ## Import This resource can be imported using the ID of the IP allow list entry: -```bash -$ terraform import github_enterprise_ip_allow_list_entry.test IALE_kwHOC1234567890a -``` \ No newline at end of file +```shell +terraform import github_enterprise_ip_allow_list_entry.test IALE_kwHOC1234567890a +``` diff --git a/docs/resources/enterprise_organization.md b/docs/resources/enterprise_organization.md new file mode 100644 index 0000000000..a9bb2b955c --- /dev/null +++ b/docs/resources/enterprise_organization.md @@ -0,0 +1,48 @@ +--- +page_title: "github_enterprise_organization (Resource) - GitHub" +description: |- + Create and manages a GitHub enterprise organization. +--- + +# github_enterprise_organization (Resource) + +This resource allows you to create and manage a GitHub enterprise organization. + +## Example Usage + +```hcl +resource "github_enterprise_organization" "org" { + enterprise_id = data.github_enterprise.enterprise.id + name = "some-awesome-org" + display_name = "Some Awesome Org" + description = "Organization created with terraform" + billing_email = "jon@winteriscoming.com" + admin_logins = [ + "jon-snow" + ] +} +``` + +## Argument Reference + +- `enterprise_id` - (Required) The ID of the enterprise. +- `name` - (Required) The name of the organization. +- `description` - (Optional) The description of the organization. +- `display_name` - (Optional) The display name of the organization. +- `billing_email` - (Required) The billing email address. +- `admin_logins` - (Required) List of organization owner usernames. + +## Attributes Reference + +The following additional attributes are exported: + +- `id` - The node ID of the organization for use with the v4 API. +- `database_id` - The ID of the organization. + +## Import + +GitHub Enterprise Organization can be imported using the `slug` of the enterprise, combined with the `orgname` of the organization, separated by a `/` character. + +```hcl +$ terraform import github_enterprise_organization.org enterp/some-awesome-org +``` diff --git a/website/docs/r/enterprise_security_analysis_settings.html.markdown b/docs/resources/enterprise_security_analysis_settings.md similarity index 71% rename from website/docs/r/enterprise_security_analysis_settings.html.markdown rename to docs/resources/enterprise_security_analysis_settings.md index cfc949cdd6..f01e5cb6a8 100644 --- a/website/docs/r/enterprise_security_analysis_settings.html.markdown +++ b/docs/resources/enterprise_security_analysis_settings.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_enterprise_security_analysis_settings" +page_title: "github_enterprise_security_analysis_settings (Resource) - GitHub" description: |- Manages GitHub Enterprise security analysis settings. --- -# github_enterprise_security_analysis_settings +# github_enterprise_security_analysis_settings (Resource) This resource allows you to manage code security and analysis settings for a GitHub Enterprise account. This controls Advanced Security, Secret Scanning, and related security features that are automatically enabled for new repositories in the enterprise. @@ -13,23 +12,23 @@ You must have enterprise admin access to use this resource. ## Example Usage -```hcl +```terraform # Basic security settings - enable secret scanning only resource "github_enterprise_security_analysis_settings" "basic" { enterprise_slug = "my-enterprise" - + secret_scanning_enabled_for_new_repositories = true } # Full security configuration with all features enabled resource "github_enterprise_security_analysis_settings" "comprehensive" { enterprise_slug = "my-enterprise" - - advanced_security_enabled_for_new_repositories = true - secret_scanning_enabled_for_new_repositories = true + + advanced_security_enabled_for_new_repositories = true + secret_scanning_enabled_for_new_repositories = true secret_scanning_push_protection_enabled_for_new_repositories = true - secret_scanning_validity_checks_enabled = true - secret_scanning_push_protection_custom_link = "https://octokit.com/security-guidelines" + secret_scanning_validity_checks_enabled = true + secret_scanning_push_protection_custom_link = "https://octokit.com/security-guidelines" } ``` @@ -37,29 +36,29 @@ resource "github_enterprise_security_analysis_settings" "comprehensive" { The following arguments are supported: -* `enterprise_slug` - (Required) The slug of the enterprise. +- `enterprise_slug` - (Required) The slug of the enterprise. -* `advanced_security_enabled_for_new_repositories` - (Optional) Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to `false`. Requires Advanced Security license. +- `advanced_security_enabled_for_new_repositories` - (Optional) Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to `false`. Requires Advanced Security license. -* `secret_scanning_enabled_for_new_repositories` - (Optional) Whether secret scanning is automatically enabled for new repositories. Defaults to `false`. +- `secret_scanning_enabled_for_new_repositories` - (Optional) Whether secret scanning is automatically enabled for new repositories. Defaults to `false`. -* `secret_scanning_push_protection_enabled_for_new_repositories` - (Optional) Whether secret scanning push protection is automatically enabled for new repositories. Defaults to `false`. +- `secret_scanning_push_protection_enabled_for_new_repositories` - (Optional) Whether secret scanning push protection is automatically enabled for new repositories. Defaults to `false`. -* `secret_scanning_push_protection_custom_link` - (Optional) Custom URL for secret scanning push protection bypass instructions. +- `secret_scanning_push_protection_custom_link` - (Optional) Custom URL for secret scanning push protection bypass instructions. -* `secret_scanning_validity_checks_enabled` - (Optional) Whether secret scanning validity checks are enabled. Defaults to `false`. +- `secret_scanning_validity_checks_enabled` - (Optional) Whether secret scanning validity checks are enabled. Defaults to `false`. ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `id` - The enterprise slug. +- `id` - The enterprise slug. ## Import Enterprise security analysis settings can be imported using the enterprise slug: -``` +```hcl terraform import github_enterprise_security_analysis_settings.example my-enterprise ``` @@ -80,4 +79,4 @@ This resource manages the following security features: - **Push Protection**: Prevents secrets from being committed to repositories - **Validity Checks**: Verifies that detected secrets are actually valid -These settings only apply to **new repositories** created after the settings are enabled. Existing repositories are not affected and must be configured individually. \ No newline at end of file +These settings only apply to **new repositories*- created after the settings are enabled. Existing repositories are not affected and must be configured individually. diff --git a/website/docs/r/issue.html.markdown b/docs/resources/issue.md similarity index 56% rename from website/docs/r/issue.html.markdown rename to docs/resources/issue.md index 0cd4f72c35..3a0dea5e06 100644 --- a/website/docs/r/issue.html.markdown +++ b/docs/resources/issue.md @@ -1,51 +1,49 @@ --- -layout: "github" -page_title: "GitHub: github_issue" +page_title: "github_issue (Resource) - GitHub" description: |- Provides a GitHub issue resource. --- -# github_issue +# github_issue (Resource) Provides a GitHub issue resource. -This resource allows you to create and manage issue within your -GitHub repository. +This resource allows you to create and manage issue within your GitHub repository. ## Example Usage -```hcl +```terraform # Create a simple issue resource "github_repository" "test" { - name = "tf-acc-test-%s" + name = "tf-acc-test-%s" auto_init = true has_issues = true } resource "github_issue" "test" { - repository = github_repository.test.name - title = "My issue title" - body = "The body of my issue" + repository = github_repository.test.name + title = "My issue title" + body = "The body of my issue" } ``` ## Example Usage with milestone and project assignment -```hcl +```terraform # Create an issue with milestone and project assignment resource "github_repository" "test" { - name = "tf-acc-test-%s" + name = "tf-acc-test-%s" auto_init = true has_issues = true } resource "github_repository_milestone" "test" { - owner = split("/", "${github_repository.test.full_name}")[0] - repository = github_repository.test.name - title = "v1.0.0" + owner = split("/", "${github_repository.test.full_name}")[0] + repository = github_repository.test.name + title = "v1.0.0" description = "General Availability" - due_date = "2022-11-22" - state = "open" + due_date = "2022-11-22" + state = "open" } resource "github_issue" "test" { @@ -62,28 +60,28 @@ resource "github_issue" "test" { The following arguments are supported: -* `repository` - (Required) The GitHub repository name +- `repository` - (Required) The GitHub repository name -* `title` - (Required) Title of the issue +- `title` - (Required) Title of the issue -* `body` - (Optional) Body of the issue +- `body` - (Optional) Body of the issue -* `labels` - (Optional) List of labels to attach to the issue +- `labels` - (Optional) List of labels to attach to the issue -* `assignees` - (Optional) List of Logins to assign the to the issue +- `assignees` - (Optional) List of Logins to assign the to the issue -* `milestone_number` - (Optional) Milestone number to assign to the issue +- `milestone_number` - (Optional) Milestone number to assign to the issue ## Attributes Reference -* `number` - (Computed) - The issue number +- `number` - (Computed) - The issue number -* `issue_id` - (Computed) - The issue id +- `issue_id` - (Computed) - The issue id ## Import GitHub Issues can be imported using an ID made up of `repository:number`, e.g. -``` +```hcl $ terraform import github_issue.issue_15 myrepo:15 ``` diff --git a/website/docs/r/issue_label.html.markdown b/docs/resources/issue_label.md similarity index 60% rename from website/docs/r/issue_label.html.markdown rename to docs/resources/issue_label.md index 4dd02cb9db..8eb8181a9b 100644 --- a/website/docs/r/issue_label.html.markdown +++ b/docs/resources/issue_label.md @@ -1,30 +1,24 @@ --- -layout: "github" -page_title: "GitHub: github_issue_label" +page_title: "github_issue_label (Resource) - GitHub" description: |- Provides a GitHub issue label resource. --- -# github_issue_label +# github_issue_label (Resource) Provides a GitHub issue label resource. -This resource allows you to create and manage issue labels within your -GitHub organization. +This resource allows you to create and manage issue labels within your GitHub organization. -Issue labels are keyed off of their "name", so pre-existing issue labels result -in a 422 HTTP error if they exist outside of Terraform. Normally this would not -be an issue, except new repositories are created with a "default" set of labels, -and those labels easily conflict with custom ones. +Issue labels are keyed off of their "name", so pre-existing issue labels result in a 422 HTTP error if they exist outside of Terraform. Normally this would not be an issue, except new repositories are created with a "default" set of labels, and those labels easily conflict with custom ones. -This resource will first check if the label exists, and then issue an update, -otherwise it will create. +This resource will first check if the label exists, and then issue an update, otherwise it will create. ~> **Note:** When a repository is archived, Terraform will skip deletion of issue labels to avoid API errors, as archived repositories are read-only. The labels will be removed from Terraform state without attempting to delete them from GitHub. ## Example Usage -```hcl +```terraform # Create a new, red colored label resource "github_issue_label" "test_repo" { repository = "test-repo" @@ -37,20 +31,20 @@ resource "github_issue_label" "test_repo" { The following arguments are supported: -* `repository` - (Required) The GitHub repository +- `repository` - (Required) The GitHub repository -* `name` - (Required) The name of the label. +- `name` - (Required) The name of the label. -* `color` - (Required) A 6 character hex code, **without the leading #**, identifying the color of the label. +- `color` - (Required) A 6 character hex code, **without the leading #**, identifying the color of the label. -* `description` - (Optional) A short description of the label. +- `description` - (Optional) A short description of the label. -* `url` - (Computed) The URL to the issue label +- `url` - (Computed) The URL to the issue label ## Import GitHub Issue Labels can be imported using an ID made up of `repository:name`, e.g. -``` +```hcl $ terraform import github_issue_label.panic_label terraform:panic ``` diff --git a/website/docs/r/issue_labels.html.markdown b/docs/resources/issue_labels.md similarity index 79% rename from website/docs/r/issue_labels.html.markdown rename to docs/resources/issue_labels.md index 74e32fa29e..5f6ba178a9 100644 --- a/website/docs/r/issue_labels.html.markdown +++ b/docs/resources/issue_labels.md @@ -1,16 +1,14 @@ --- -layout: "github" -page_title: "GitHub: github_issue_labels" +page_title: "github_issue_labels (Resource) - GitHub" description: |- Provides GitHub issue labels resource. --- -# github_issue_labels +# github_issue_labels (Resource) Provides GitHub issue labels resource. -This resource allows you to create and manage issue labels within your -GitHub organization. +This resource allows you to create and manage issue labels within your GitHub organization. ~> Note: github_issue_labels cannot be used in conjunction with github_issue_label or they will fight over what your policy should be. @@ -22,7 +20,7 @@ If you change the case of a label's name, its' color, or description, this resou ## Example Usage -```hcl +```terraform # Create a new, red colored label resource "github_issue_labels" "test_repo" { repository = "test-repo" @@ -43,20 +41,20 @@ resource "github_issue_labels" "test_repo" { The following arguments are supported: -* `repository` - (Required) The GitHub repository +- `repository` - (Required) The GitHub repository -* `name` - (Required) The name of the label. +- `name` - (Required) The name of the label. -* `color` - (Required) A 6 character hex code, **without the leading #**, identifying the color of the label. +- `color` - (Required) A 6 character hex code, **without the leading #**, identifying the color of the label. -* `description` - (Optional) A short description of the label. +- `description` - (Optional) A short description of the label. -* `url` - (Computed) The URL to the issue label +- `url` - (Computed) The URL to the issue label ## Import GitHub Issue Labels can be imported using the repository `name`, e.g. -``` +```hcl $ terraform import github_issue_labels.test_repo test_repo ``` diff --git a/docs/resources/membership.md b/docs/resources/membership.md new file mode 100644 index 0000000000..d5beef0960 --- /dev/null +++ b/docs/resources/membership.md @@ -0,0 +1,37 @@ +--- +page_title: "github_membership (Resource) - GitHub" +description: |- + Provides a GitHub membership resource. +--- + +# github_membership (Resource) + +Provides a GitHub membership resource. + +This resource allows you to add/remove users from your organization. When applied, an invitation will be sent to the user to become part of the organization. When destroyed, either the invitation will be cancelled or the user will be removed. + +## Example Usage + +```terraform +# Add a user to the organization +resource "github_membership" "membership_for_some_user" { + username = "SomeUser" + role = "member" +} +``` + +## Argument Reference + +The following arguments are supported: + +- `username` - (Required) The user to add to the organization. +- `role` - (Optional) The role of the user within the organization. Must be one of `member` or `admin`. Defaults to `member`. `admin` role represents the `owner` role available via GitHub UI. +- `downgrade_on_destroy` - (Optional) Defaults to `false`. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'. + +## Import + +GitHub Membership can be imported using an ID made up of `organization:username`, e.g. + +```hcl +$ terraform import github_membership.member hashicorp:someuser +``` diff --git a/website/docs/r/organization_block.html.markdown b/docs/resources/organization_block.md similarity index 73% rename from website/docs/r/organization_block.html.markdown rename to docs/resources/organization_block.md index 333b1ca48b..c3eb88780b 100644 --- a/website/docs/r/organization_block.html.markdown +++ b/docs/resources/organization_block.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_organization_block" +page_title: "github_organization_block (Resource) - GitHub" description: |- Creates and manages blocks for GitHub organizations --- -# github_organization_block +# github_organization_block (Resource) This resource allows you to create and manage blocks for GitHub organizations. ## Example Usage -```hcl +```terraform resource "github_organization_block" "example" { username = "paultyng" } @@ -21,12 +20,12 @@ resource "github_organization_block" "example" { The following arguments are supported: -* `username` - (Required) The name of the user to block. +- `username` - (Required) The name of the user to block. ## Import GitHub organization block can be imported using a username, e.g. -``` +```hcl $ terraform import github_github_organization_block.example someuser ``` diff --git a/website/docs/r/organization_custom_properties.html.markdown b/docs/resources/organization_custom_properties.md similarity index 72% rename from website/docs/r/organization_custom_properties.html.markdown rename to docs/resources/organization_custom_properties.md index 41ec8d85a9..f27d8af532 100644 --- a/website/docs/r/organization_custom_properties.html.markdown +++ b/docs/resources/organization_custom_properties.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_organization_custom_properties" +page_title: "github_organization_custom_properties (Resource) - GitHub" description: |- Creates and manages custom properties for a GitHub organization --- -# github_organization_custom_properties +# github_organization_custom_properties (Resource) This resource allows you to create and manage custom properties for a GitHub organization. @@ -13,7 +12,7 @@ Custom properties enable you to add metadata to repositories within your organiz ## Example Usage -```hcl +```terraform resource "github_organization_custom_properties" "environment" { property_name = "environment" value_type = "single_select" @@ -22,7 +21,7 @@ resource "github_organization_custom_properties" "environment" { default_value = "development" allowed_values = [ "development", - "staging", + "staging", "production" ] } @@ -32,19 +31,19 @@ resource "github_organization_custom_properties" "environment" { This example shows how to allow repository administrators to edit the property values: -```hcl +```terraform resource "github_organization_custom_properties" "team_contact" { - property_name = "team_contact" - value_type = "string" - required = false - description = "Contact information for the team managing this repository" - values_editable_by = "org_and_repo_actors" + property_name = "team_contact" + value_type = "string" + required = false + description = "Contact information for the team managing this repository" + values_editable_by = "org_and_repo_actors" } ``` ## Example Usage - Text Property -```hcl +```terraform resource "github_organization_custom_properties" "owner" { property_name = "owner" value_type = "string" @@ -55,7 +54,7 @@ resource "github_organization_custom_properties" "owner" { ## Example Usage - Boolean Property -```hcl +```terraform resource "github_organization_custom_properties" "archived" { property_name = "archived" value_type = "true_false" @@ -69,30 +68,30 @@ resource "github_organization_custom_properties" "archived" { The following arguments are supported: -* `property_name` - (Required) The name of the custom property. +- `property_name` - (Required) The name of the custom property. -* `value_type` - (Optional) The type of the custom property. Can be one of `string`, `single_select`, `multi_select`, or `true_false`. Defaults to `string`. +- `value_type` - (Optional) The type of the custom property. Can be one of `string`, `single_select`, `multi_select`, or `true_false`. Defaults to `string`. -* `required` - (Optional) Whether the custom property is required. Defaults to `false`. +- `required` - (Optional) Whether the custom property is required. Defaults to `false`. -* `description` - (Optional) The description of the custom property. +- `description` - (Optional) The description of the custom property. -* `default_value` - (Optional) The default value of the custom property. +- `default_value` - (Optional) The default value of the custom property. -* `allowed_values` - (Optional) List of allowed values for the custom property. Only applicable when `value_type` is `single_select` or `multi_select`. +- `allowed_values` - (Optional) List of allowed values for the custom property. Only applicable when `value_type` is `single_select` or `multi_select`. -* `values_editable_by` - (Optional) Who can edit the values of the custom property. Can be one of `org_actors` or `org_and_repo_actors`. When set to `org_actors` (the default), only organization owners can edit the property values on repositories. When set to `org_and_repo_actors`, both organization owners and repository administrators with the custom properties permission can edit the values. +- `values_editable_by` - (Optional) Who can edit the values of the custom property. Can be one of `org_actors` or `org_and_repo_actors`. When set to `org_actors` (the default), only organization owners can edit the property values on repositories. When set to `org_and_repo_actors`, both organization owners and repository administrators with the custom properties permission can edit the values. ## Attributes Reference In addition to all arguments above, the following attributes are exported: -* `property_name` - The name of the custom property. +- `property_name` - The name of the custom property. ## Import Organization custom properties can be imported using the property name: -``` +```hcl terraform import github_organization_custom_properties.environment environment -``` \ No newline at end of file +``` diff --git a/website/docs/r/organization_custom_role.html.markdown b/docs/resources/organization_custom_role.md similarity index 72% rename from website/docs/r/organization_custom_role.html.markdown rename to docs/resources/organization_custom_role.md index 9ee1c29f3a..ae154b7766 100644 --- a/website/docs/r/organization_custom_role.html.markdown +++ b/docs/resources/organization_custom_role.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_custom_role" +page_title: "github_organization_custom_role (Resource) - GitHub" description: |- Creates and manages a custom role in a GitHub Organization for use in repositories. --- @@ -15,11 +14,11 @@ This resource allows you to create and manage custom roles in a GitHub Organizat ## Example Usage -```hcl +```terraform resource "github_organization_custom_role" "example" { - name = "example" + name = "example" description = "Example custom role that uses the read role as its base" - base_role = "read" + base_role = "read" permissions = [ "add_assignee", "add_label", @@ -48,22 +47,21 @@ resource "github_organization_custom_role" "example" { The following arguments are supported: -* `name` - (Required) The name of the custom role. -* `description` - (Optional) The description for the custom role. -* `base_role` - (Required) The system role from which the role inherits permissions. Can be one of: `read`, `triage`, `write`, or `maintain`. -* `permissions` - (Required) A list of additional permissions included in this role. Must have a minimum of 1 additional permission. The list of available permissions can be found using the [list repository fine-grained permissions for an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-repository-fine-grained-permissions-for-an-organization) API. +- `name` - (Required) The name of the custom role. +- `description` - (Optional) The description for the custom role. +- `base_role` - (Required) The system role from which the role inherits permissions. Can be one of: `read`, `triage`, `write`, or `maintain`. +- `permissions` - (Required) A list of additional permissions included in this role. Must have a minimum of 1 additional permission. The list of available permissions can be found using the [list repository fine-grained permissions for an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-repository-fine-grained-permissions-for-an-organization) API. ## Attributes Reference The following additional attributes are exported: -* `id` - The ID of the custom role. +- `id` - The ID of the custom role. ## Import -Custom roles can be imported using the `id` of the role. -The `id` of the custom role can be found using the [list custom roles in an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization) API. +Custom roles can be imported using the `id` of the role. The `id` of the custom role can be found using the [list custom roles in an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization) API. -``` +```hcl $ terraform import github_organization_custom_role.example 1234 ``` diff --git a/website/docs/r/organization_project.html.markdown b/docs/resources/organization_project.md similarity index 76% rename from website/docs/r/organization_project.html.markdown rename to docs/resources/organization_project.md index 447588d034..2885f58d5a 100644 --- a/website/docs/r/organization_project.html.markdown +++ b/docs/resources/organization_project.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_organization_project" +page_title: "github_organization_project (Resource) - GitHub" description: |- Creates and manages projects for GitHub organizations --- -# github_organization_project +# github_organization_project (Resource) !> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. @@ -13,7 +12,7 @@ This resource allows you to create and manage projects for GitHub organization. ## Example Usage -```hcl +```terraform resource "github_organization_project" "project" { name = "A Organization Project" body = "This is a organization project." @@ -24,12 +23,12 @@ resource "github_organization_project" "project" { The following arguments are supported: -* `name` - (Required) The name of the project. +- `name` - (Required) The name of the project. -* `body` - (Optional) The body of the project. +- `body` - (Optional) The body of the project. ## Attributes Reference The following additional attributes are exported: -* `url` - URL of the project +- `url` - URL of the project diff --git a/website/docs/r/organization_repository_role.html.markdown b/docs/resources/organization_repository_role.md similarity index 92% rename from website/docs/r/organization_repository_role.html.markdown rename to docs/resources/organization_repository_role.md index 4faa56d1a8..1436510379 100644 --- a/website/docs/r/organization_repository_role.html.markdown +++ b/docs/resources/organization_repository_role.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_repository_role Resource" +page_title: "github_organization_repository_role (Resource) - GitHub" description: |- Manage a custom organization repository role. --- diff --git a/website/docs/r/organization_role.html.markdown b/docs/resources/organization_role.md similarity index 94% rename from website/docs/r/organization_role.html.markdown rename to docs/resources/organization_role.md index f57d9f776f..4770d66913 100644 --- a/website/docs/r/organization_role.html.markdown +++ b/docs/resources/organization_role.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_role Resource" +page_title: "github_organization_role (Resource) - GitHub" description: |- Manage a custom organization role. --- diff --git a/website/docs/r/organization_role_team.html.markdown b/docs/resources/organization_role_team.md similarity index 59% rename from website/docs/r/organization_role_team.html.markdown rename to docs/resources/organization_role_team.md index e5db0064b6..9e29d0763d 100644 --- a/website/docs/r/organization_role_team.html.markdown +++ b/docs/resources/organization_role_team.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_role_team Resource" +page_title: "github_organization_role_team (Resource) - GitHub" description: |- Manage an association between an organization role and a team. --- @@ -18,21 +17,6 @@ resource "github_organization_role_team" "example" { } ``` -## Example Usage Security Manager Role - -```terraform -locals { - security_manager_id = one([for x in data.github_organization_roles.all_roles.roles : x.role_id if x.name == "security_manager"]) -} - -data "github_organization_roles" "all_roles" {} - -resource "github_organization_role_team" "security_managers" { - role_id = local.security_manager_id - team_slug = "example-team" -} -``` - ## Schema ### Required diff --git a/website/docs/r/organization_role_team_assignment.html.markdown b/docs/resources/organization_role_team_assignment.md similarity index 68% rename from website/docs/r/organization_role_team_assignment.html.markdown rename to docs/resources/organization_role_team_assignment.md index f2916ebfb1..2e90b1ae32 100644 --- a/website/docs/r/organization_role_team_assignment.html.markdown +++ b/docs/resources/organization_role_team_assignment.md @@ -1,27 +1,24 @@ --- -layout: "github" -page_title: "GitHub: github_organization_role_team_assignment" +page_title: "github_organization_role_team_assignment (Resource) - GitHub" description: |- Manages the associations between teams and organization roles. --- -# github_organization_role_team_assignment +# github_organization_role_team_assignment (Resource) ~> **Note:** This resource is deprecated, please use the `github_organization_role_team` resource instead. -This resource manages relationships between teams and organization roles -in your GitHub organization. This works on predefined roles, and custom roles, where the latter is an Enterprise feature. +This resource manages relationships between teams and organization roles in your GitHub organization. This works on predefined roles, and custom roles, where the latter is an Enterprise feature. Creating this resource assigns the role to a team. -The organization role and team must both belong to the same organization -on GitHub. +The organization role and team must both belong to the same organization on GitHub. ## Example Usage -```hcl +```terraform resource "github_team" "test-team" { - name = "test-team" + name = "test-team" } resource "github_organization_role_team_assignment" "test-team-role-assignment" { @@ -34,13 +31,13 @@ resource "github_organization_role_team_assignment" "test-team-role-assignment" The following arguments are supported: -* `team_slug` - (Required) The GitHub team slug -* `role_id` - (Required) The GitHub organization role id +- `team_slug` - (Required) The GitHub team slug +- `role_id` - (Required) The GitHub organization role id ## Import GitHub Team Organization Role Assignment can be imported using an ID made up of `team_slug:role_id` -```text +```hcl $ terraform import github_organization_role_team_assignment.role_assignment test-team:8132 ``` diff --git a/website/docs/r/organization_role_user.html.markdown b/docs/resources/organization_role_user.md similarity index 89% rename from website/docs/r/organization_role_user.html.markdown rename to docs/resources/organization_role_user.md index c2a92c8a87..4115a547a9 100644 --- a/website/docs/r/organization_role_user.html.markdown +++ b/docs/resources/organization_role_user.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "GitHub: github_organization_role_user Resource" +page_title: "github_organization_role_user (Resource) - GitHub" description: |- Manage an association between an organization role and a user. --- diff --git a/website/docs/r/organization_ruleset.html.markdown b/docs/resources/organization_ruleset.md similarity index 90% rename from website/docs/r/organization_ruleset.html.markdown rename to docs/resources/organization_ruleset.md index f0a052a159..9077e14cb3 100644 --- a/website/docs/r/organization_ruleset.html.markdown +++ b/docs/resources/organization_ruleset.md @@ -1,6 +1,5 @@ --- -layout: "github" -page_title: "github_organization_ruleset Resource - terraform-provider-github" +page_title: "github_organization_ruleset (Resource) - GitHub" description: |- Creates a GitHub organization ruleset. --- @@ -13,7 +12,7 @@ This resource allows you to create and manage rulesets on the organization level ## Example Usage -```hcl +```terraform resource "github_organization_ruleset" "example" { name = "example" target = "branch" @@ -87,7 +86,7 @@ resource "github_organization_ruleset" "example_push" { } max_file_size { - max_file_size = 100 # 100 MB + max_file_size = 100 # 100 MB } max_file_path_length { @@ -99,47 +98,6 @@ resource "github_organization_ruleset" "example_push" { } } } - -# Example with repository_property targeting -resource "github_organization_ruleset" "example_property" { - name = "example_property" - target = "branch" - enforcement = "active" - - conditions { - ref_name { - include = ["~ALL"] - exclude = [] - } - - repository_property { - include = [ - { - name = "environment" - property_values = ["production", "staging"] - source = "custom" - }, - { - name = "team" - property_values = ["backend"] - source = "custom" - } - ] - exclude = [ - { - name = "archived" - property_values = ["true"] - source = "system" - } - ] - } - } - - rules { - required_signatures = true - pull_request {} - } -} ``` ## Argument Reference @@ -156,7 +114,7 @@ resource "github_organization_ruleset" "example_property" { - `conditions` - (Optional) (Block List, Max: 1) Parameters for an organization ruleset condition. For `branch` and `tag` targets, `ref_name` is required alongside one of `repository_name` or `repository_id`. For `push` targets, `ref_name` must NOT be set - only `repository_name` or `repository_id` should be used. (see [below for nested schema](#conditions)) -#### Rules #### +### Rules The `rules` block supports the following: @@ -202,7 +160,7 @@ The `rules` block supports the following: - `update` - (Optional) (Boolean) Only allow users with bypass permission to update matching refs. -#### rules.branch_name_pattern #### +#### rules.branch_name_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -212,7 +170,7 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.commit_author_email_pattern #### +#### rules.commit_author_email_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -222,7 +180,7 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.commit_message_pattern #### +#### rules.commit_message_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -232,7 +190,7 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.committer_email_pattern #### +#### rules.committer_email_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -242,9 +200,10 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.pull_request #### +#### rules.pull_request - `allowed_merge_methods` - (Optional) (List of String, Min: 1) Array of merge methods to be allowed. Allowed values include `merge`, `squash`, and `rebase`. At least one must be enabled. + - `dismiss_stale_reviews_on_push` - (Optional) (Boolean) New, reviewable commits pushed will dismiss previous pull request review approvals. Defaults to `false`. - `require_code_owner_review` - (Optional) (Boolean) Require an approving review in pull requests that modify files that have a designated code owner. Defaults to `false`. @@ -255,7 +214,7 @@ The `rules` block supports the following: - `required_review_thread_resolution` - (Optional) (Boolean) All conversations on code must be resolved before a pull request can be merged. Defaults to `false`. -#### rules.copilot_code_review #### +#### rules.copilot_code_review - `review_on_push` - (Optional) (Boolean) Copilot automatically reviews each new push to the pull request. Defaults to `false`. @@ -265,7 +224,7 @@ The `rules` block supports the following: - `required_reviewers` - (Optional) (Block List) Require specific reviewers to approve pull requests. Note: This feature is in beta. (see [below for nested schema](#rulespull_requestrequired_reviewers)) -#### rules.pull_request.required_reviewers #### +#### rules.pull_request.required_reviewers - `reviewer` - (Required) (Block List, Max: 1) The reviewer that must review matching files. (see [below for nested schema](#rulespull_requestrequired_reviewersreviewer)) @@ -273,13 +232,13 @@ The `rules` block supports the following: - `minimum_approvals` - (Required) (Number) Minimum number of approvals required from this reviewer. Set to 0 to make approval optional. -#### rules.pull_request.required_reviewers.reviewer #### +#### rules.pull_request.required_reviewers.reviewer - `id` - (Required) (Number) The ID of the reviewer (Team ID). - `type` - (Required) (String) The type of reviewer. Currently only `Team` is supported. -#### rules.required_status_checks #### +#### rules.required_status_checks - `required_check` - (Required) (Block Set, Min: 1) Status checks that are required. Several can be defined. (see [below for nested schema](#rulesrequired_status_checksrequired_check)) @@ -287,7 +246,7 @@ The `rules` block supports the following: - `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. -#### required_status_checks.required_check #### +#### rules.required_status_checks.required_check - `context` - (Required) (String) The status check context name that must be present on the commit. @@ -295,13 +254,13 @@ The `rules` block supports the following: - `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. -#### rules.required_workflows #### +#### rules.required_workflows - `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. - `required_workflow` - (Required) (Block Set, Min: 1) Actions workflows that are required. Multiple can be defined. (see [below for nested schema](#rulesrequired_workflowsrequired_workflow)) -#### rules.required_workflows.required_workflow #### +#### rules.required_workflows.required_workflow - `repository_id` - (Required) (Number) The ID of the repository. Names, full names and repository URLs are not supported. @@ -309,11 +268,11 @@ The `rules` block supports the following: - `ref` - (Optional) (String) The optional ref from which to fetch the workflow. Defaults to `master`. -#### rules.required_code_scanning #### +#### rules.required_code_scanning - `required_code_scanning_tool` - (Required) (Block Set, Min: 1) Actions code scanning tools that are required. Multiple can be defined. (see [below for nested schema](#rulesrequired_code_scanningrequired_code_scanning_tool)) -#### rules.required_code_scanning.required_code_scanning_tool #### +#### rules.required_code_scanning.required_code_scanning_tool - `alerts_threshold` - (Required) (String) The severity level at which code scanning results that raise alerts block a reference update. Can be one of: `none`, `errors`, `errors_and_warnings`, `all`. @@ -321,7 +280,7 @@ The `rules` block supports the following: - `tool` - (Required) (String) The name of a code scanning tool. -#### rules.tag_name_pattern #### +#### rules.tag_name_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -331,23 +290,23 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.file_path_restriction #### +#### rules.file_path_restriction - `restricted_file_paths` - (Required) (Block Set, Min: 1) The file paths that are restricted from being pushed to the commit graph. -#### rules.max_file_size #### +#### rules.max_file_size - `max_file_size` - (Required) (Integer) The maximum allowed size, in megabytes (MB), of a file. Valid range is 1-100 MB. -#### rules.max_file_path_length #### +#### rules.max_file_path_length - `max_file_path_length` - (Required) (Integer) The maximum number of characters allowed in file paths. -#### rules.file_extension_restriction #### +#### rules.file_extension_restriction - `restricted_file_extensions` - (Required) (Block Set, Min: 1) The file extensions that are restricted from being pushed to the commit graph. -#### bypass_actors #### +#### bypass_actors - `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. Some actor types such as `DeployKey` do not have an ID. @@ -359,11 +318,11 @@ The `rules` block supports the following: - `OrganizationAdmin` -> `1` - `RepositoryRole` (This is the actor type, the following are the base repository roles and their associated IDs.) - - `maintain` -> `2` - - `write` -> `4` - - `admin` -> `5` + - `maintain` -> `2` + - `write` -> `4` + - `admin` -> `5` -#### conditions #### +#### conditions - `ref_name` - (Optional) (Block List, Max: 1) Required for `branch` and `tag` targets. Must NOT be set for `push` targets. (see [below for nested schema](#conditionsref_name)) - `repository_id` (Optional) (List of Number) The repository IDs that the ruleset applies to. One of these IDs must match for the condition to pass. @@ -374,25 +333,25 @@ Exactly one of `repository_id`, `repository_name`, or `repository_property` must ~> **Note:** For `push` targets, do not include `ref_name` in conditions. Push rulesets operate on file content, not on refs. -#### conditions.ref_name #### +#### conditions.ref_name - `exclude` - (Required) (List of String) Array of ref names or patterns to exclude. The condition will not pass if any of these patterns match. - `include` - (Required) (List of String) Array of ref names or patterns to include. One of these patterns must match for the condition to pass. Also accepts `~DEFAULT_BRANCH` to include the default branch or `~ALL` to include all branches. -#### conditions.repository_name #### +#### conditions.repository_name - `exclude` - (Required) (List of String) Array of repository names or patterns to exclude. The condition will not pass if any of these patterns match. - `include` - (Required) (List of String) Array of repository names or patterns to include. One of these patterns must match for the condition to pass. Also accepts `~ALL` to include all repositories. - `protected` - (Optional) (Boolean) Whether renaming of target repositories is prevented. Defaults to `false`. -#### conditions.repository_property #### +#### conditions.repository_property - `include` - (Optional) (List of Repository Properties) The repository properties and values to include. All of these properties must match for the condition to pass. (see [below for nested schema](#conditionsrepository_propertyproperties)) - `exclude` - (Optional) (List of Repository Properties) The repository properties and values to exclude. The condition will not pass if any of these properties match. (see [below for nested schema](#conditionsrepository_propertyproperties)) -#### conditions.repository_property.properties #### +#### conditions.repository_property.properties - `name` (Required) (String) The name of the repository property to target. diff --git a/website/docs/r/organization_security_manager.html.markdown b/docs/resources/organization_security_manager.md similarity index 77% rename from website/docs/r/organization_security_manager.html.markdown rename to docs/resources/organization_security_manager.md index 1696309017..165bf7bd95 100644 --- a/website/docs/r/organization_security_manager.html.markdown +++ b/docs/resources/organization_security_manager.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_organization_security_manager" +page_title: "github_organization_security_manager (Resource) - GitHub" description: |- Manages the Security manager teams for a GitHub Organization. --- -# github_organization_security_manager +# github_organization_security_manager (Resource) ~> **Note:** This resource is deprecated, please use the `github_organization_role_team` resource instead. ## Example Usage -```hcl +```terraform resource "github_team" "some_team" { name = "SomeTeam" description = "Some cool team" @@ -26,12 +25,12 @@ resource "github_organization_security_manager" "some_team" { The following arguments are supported: -* `team_slug` - (Required) The slug of the team to manage. +- `team_slug` - (Required) The slug of the team to manage. ## Import GitHub Security Manager Teams can be imported using the GitHub team ID e.g. -```text +```hcl $ terraform import github_organization_security_manager.core 1234567 ``` diff --git a/docs/resources/organization_settings.md b/docs/resources/organization_settings.md new file mode 100644 index 0000000000..5e17408f48 --- /dev/null +++ b/docs/resources/organization_settings.md @@ -0,0 +1,87 @@ +--- +page_title: "github_organization_settings (Resource) - GitHub" +description: |- + Creates and manages settings for a GitHub Organization. +--- + +# github_organization_settings (Resource) + +This resource allows you to create and manage settings for a GitHub Organization. + +## Example Usage + +```terraform +resource "github_organization_settings" "test" { + billing_email = "test@example.com" + company = "Test Company" + blog = "https://example.com" + email = "test@example.com" + twitter_username = "Test" + location = "Test Location" + name = "Test Name" + description = "Test Description" + has_organization_projects = true + has_repository_projects = true + default_repository_permission = "read" + members_can_create_repositories = true + members_can_create_public_repositories = true + members_can_create_private_repositories = true + members_can_create_internal_repositories = true + members_can_create_pages = true + members_can_create_public_pages = true + members_can_create_private_pages = true + members_can_fork_private_repositories = true + web_commit_signoff_required = true + advanced_security_enabled_for_new_repositories = false + dependabot_alerts_enabled_for_new_repositories = false + dependabot_security_updates_enabled_for_new_repositories = false + dependency_graph_enabled_for_new_repositories = false + secret_scanning_enabled_for_new_repositories = false + secret_scanning_push_protection_enabled_for_new_repositories = false +} +``` + +## Argument Reference + +The following arguments are supported: + +- `billing_email` - (Required) The billing email address for the organization. +- `company` - (Optional) The company name for the organization. +- `blog` - (Optional) The blog URL for the organization. +- `email` - (Optional) The email address for the organization. +- `twitter_username` - (Optional) The Twitter username for the organization. +- `location` - (Optional) The location for the organization. +- `name` - (Optional) The name for the organization. +- `description` - (Optional) The description for the organization. +- `has_organization_projects` - (Optional) Whether or not organization projects are enabled for the organization. +- `has_repository_projects` - (Optional) Whether or not repository projects are enabled for the organization. +- `default_repository_permission` - (Optional) The default permission for organization members to create new repositories. Can be one of `read`, `write`, `admin`, or `none`. Defaults to `read`. +- `members_can_create_repositories` - (Optional) Whether or not organization members can create new repositories. Defaults to `true`. +- `members_can_create_public_repositories` - (Optional) Whether or not organization members can create new public repositories. Defaults to `true`. +- `members_can_create_private_repositories` - (Optional) Whether or not organization members can create new private repositories. Defaults to `true`. +- `members_can_create_internal_repositories` - (Optional) Whether or not organization members can create new internal repositories. For Enterprise Organizations only. +- `members_can_create_pages` - (Optional) Whether or not organization members can create new pages. Defaults to `true`. +- `members_can_create_public_pages` - (Optional) Whether or not organization members can create new public pages. Defaults to `true`. +- `members_can_create_private_pages` - (Optional) Whether or not organization members can create new private pages. Defaults to `true`. +- `members_can_fork_private_repositories` - (Optional) Whether or not organization members can fork private repositories. Defaults to `false`. +- `web_commit_signoff_required` - (Optional) Whether or not commit signatures are required for commits to the organization. Defaults to `false`. +- `advanced_security_enabled_for_new_repositories` - (Optional) Whether or not advanced security is enabled for new repositories. Defaults to `false`. +- `dependabot_alerts_enabled_for_new_repositories` - (Optional) Whether or not dependabot alerts are enabled for new repositories. Defaults to `false`. +- `dependabot_security_updates_enabled_for_new_repositories` - (Optional) Whether or not dependabot security updates are enabled for new repositories. Defaults to `false`. +- `dependency_graph_enabled_for_new_repositories` - (Optional) Whether or not dependency graph is enabled for new repositories. Defaults to `false`. +- `secret_scanning_enabled_for_new_repositories` - (Optional) Whether or not secret scanning is enabled for new repositories. Defaults to `false`. +- `secret_scanning_push_protection_enabled_for_new_repositories` - (Optional) Whether or not secret scanning push protection is enabled for new repositories. Defaults to `false`. + +## Attributes Reference + +The following additional attributes are exported: + +- `id` - The ID of the organization settings. + +## Import + +Organization settings can be imported using the `id` of the organization. The `id` of the organization can be found using the [get an organization](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) API. + +```hcl +$ terraform import github_organization_settings.test 123456789 +``` diff --git a/website/docs/r/organization_webhook.html.markdown b/docs/resources/organization_webhook.md similarity index 65% rename from website/docs/r/organization_webhook.html.markdown rename to docs/resources/organization_webhook.md index 8bacb1ac3e..d4a8f2a9f8 100644 --- a/website/docs/r/organization_webhook.html.markdown +++ b/docs/resources/organization_webhook.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_organization_webhook" +page_title: "github_organization_webhook (Resource) - GitHub" description: |- Creates and manages webhooks for GitHub organizations --- -# github_organization_webhook +# github_organization_webhook (Resource) This resource allows you to create and manage webhooks for GitHub organization. ## Example Usage -```hcl +```terraform resource "github_organization_webhook" "foo" { name = "web" @@ -31,26 +30,25 @@ resource "github_organization_webhook" "foo" { The following arguments are supported: -* `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/) +- `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/) -* `configuration` - (Required) key/value pair of configuration for this webhook. Available keys are `url`, `content_type`, `secret` and `insecure_ssl`. +- `configuration` - (Required) key/value pair of configuration for this webhook. Available keys are `url`, `content_type`, `secret` and `insecure_ssl`. -* `active` - (Optional) Indicate of the webhook should receive events. Defaults to `true`. +- `active` - (Optional) Indicate of the webhook should receive events. Defaults to `true`. -* `name` - (Optional) The type of the webhook. `web` is the default and the only option. +- `name` - (Optional) The type of the webhook. `web` is the default and the only option. ## Attributes Reference The following additional attributes are exported: -* `url` - URL of the webhook +- `url` - URL of the webhook ## Import -Organization webhooks can be imported using the `id` of the webhook. -The `id` of the webhook can be found in the URL of the webhook. For example, `"https://github.com/organizations/foo-org/settings/hooks/123456789"`. +Organization webhooks can be imported using the `id` of the webhook. The `id` of the webhook can be found in the URL of the webhook. For example, `"https://github.com/organizations/foo-org/settings/hooks/123456789"`. -``` +```hcl $ terraform import github_organization_webhook.terraform 123456789 ``` diff --git a/website/docs/r/project_card.html.markdown b/docs/resources/project_card.md similarity index 67% rename from website/docs/r/project_card.html.markdown rename to docs/resources/project_card.md index 619d49ad09..dd147d079d 100644 --- a/website/docs/r/project_card.html.markdown +++ b/docs/resources/project_card.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_project_card" +page_title: "github_project_card (Resource) - GitHub" description: |- Creates and manages project cards for GitHub projects --- -# github_project_card +# github_project_card (Resource) !> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. @@ -13,7 +12,7 @@ This resource allows you to create and manage cards for GitHub projects. ## Example Usage -```hcl +```terraform resource "github_organization_project" "project" { name = "An Organization Project" body = "This is an organization project." @@ -26,28 +25,29 @@ resource "github_project_column" "column" { resource "github_project_card" "card" { column_id = github_project_column.column.column_id - note = "## Unaccepted 👇" + note = "## Unaccepted 👇" } ``` + ## Example Usage adding an Issue to a Project -```hcl +```terraform resource "github_repository" "test" { - name = "myrepo" + name = "myrepo" has_projects = true has_issues = true } resource "github_issue" "test" { - repository = github_repository.test.id - title = "Test issue title" - body = "Test issue body" + repository = github_repository.test.id + title = "Test issue title" + body = "Test issue body" } resource "github_repository_project" "test" { - name = "test" - repository = github_repository.test.name - body = "this is a test project" + name = "test" + repository = github_repository.test.name + body = "this is a test project" } resource "github_project_column" "test" { @@ -66,21 +66,20 @@ resource "github_project_card" "test" { The following arguments are supported: -* `column_id` - (Required) The ID of the card. +- `column_id` - (Required) The ID of the card. -* `note` - (Optional) The note contents of the card. Markdown supported. +- `note` - (Optional) The note contents of the card. Markdown supported. -* `content_id` - (Optional) [`github_issue.issue_id`](issue.html#argument-reference). +- `content_id` - (Optional) `github_issue.issue_id`. -* `content_type` - (Optional) Must be either `Issue` or `PullRequest` +- `content_type` - (Optional) Must be either `Issue` or `PullRequest` -**Remarks:** You must either set the `note` attribute or both `content_id` and `content_type`. -See [note example](#example-usage) or [issue example](#example-usage-adding-an-issue-to-a-project) for more information. +**Remarks:** You must either set the `note` attribute or both `content_id` and `content_type`. See [note example](#example-usage) or [issue example](#example-usage-adding-an-issue-to-a-project) for more information. ## Import A GitHub Project Card can be imported using its [Card ID](https://developer.github.com/v3/projects/cards/#get-a-project-card): -``` +```hcl $ terraform import github_project_card.card 01234567 ``` diff --git a/website/docs/r/project_column.html.markdown b/docs/resources/project_column.md similarity index 80% rename from website/docs/r/project_column.html.markdown rename to docs/resources/project_column.md index cdb972b0d6..77583d7c15 100644 --- a/website/docs/r/project_column.html.markdown +++ b/docs/resources/project_column.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_project_column" +page_title: "github_project_column (Resource) - GitHub" description: |- Creates and manages project columns for GitHub projects --- -# github_project_column +# github_project_column (Resource) !> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. @@ -13,7 +12,7 @@ This resource allows you to create and manage columns for GitHub projects. ## Example Usage -```hcl +```terraform resource "github_organization_project" "project" { name = "A Organization Project" body = "This is an organization project." @@ -29,6 +28,6 @@ resource "github_project_column" "column" { The following arguments are supported: -* `project_id` - (Required) The ID of an existing project that the column will be created in. +- `project_id` - (Required) The ID of an existing project that the column will be created in. -* `name` - (Required) The name of the column. +- `name` - (Required) The name of the column. diff --git a/website/docs/r/release.html.markdown b/docs/resources/release.md similarity index 60% rename from website/docs/r/release.html.markdown rename to docs/resources/release.md index b03067a596..b994eff4e6 100644 --- a/website/docs/r/release.html.markdown +++ b/docs/resources/release.md @@ -1,21 +1,19 @@ --- -layout: "github" -page_title: "GitHub: github_release" +page_title: "github_release (Resource) - GitHub" description: |- Creates and manages releases within a single GitHub repository --- -# github_release +# github_release (Resource) -This resource allows you to create and manage a release in a specific -GitHub repository. +This resource allows you to create and manage a release in a specific GitHub repository. ## Example Usage -```hcl +```terraform resource "github_repository" "repo" { - name = "repo" - description = "GitHub repo managed by Terraform" + name = "repo" + description = "GitHub repo managed by Terraform" private = false } @@ -28,7 +26,7 @@ resource "github_release" "example" { ## Example Usage on Non-Default Branch -```hcl +```terraform resource "github_repository" "example" { name = "repo" auto_init = true @@ -44,7 +42,7 @@ resource "github_release" "example" { repository = github_repository.example.name tag_name = "v1.0.0" target_commitish = github_branch.example.branch - draft = false + draft = false prerelease = false } ``` @@ -53,52 +51,52 @@ resource "github_release" "example" { The following arguments are supported: -* `repository` - (Required) The name of the repository. +- `repository` - (Required) The name of the repository. -* `tag_name` - (Required) The name of the tag. +- `tag_name` - (Required) The name of the tag. -* `target_commitish` - (Optional) The branch name or commit SHA the tag is created from. Defaults to the default branch of the repository. +- `target_commitish` - (Optional) The branch name or commit SHA the tag is created from. Defaults to the default branch of the repository. -* `name` - (Optional) The name of the release. +- `name` - (Optional) The name of the release. -* `body` - (Optional) Text describing the contents of the tag. +- `body` - (Optional) Text describing the contents of the tag. -* `draft` - (Optional) Set to `false` to create a published release. +- `draft` - (Optional) Set to `false` to create a published release. -* `prerelease` - (Optional) Set to `false` to identify the release as a full release. +- `prerelease` - (Optional) Set to `false` to identify the release as a full release. -* `generate_release_notes` - (Optional) Set to `true` to automatically generate the name and body for this release. If `name` is specified, the specified `name` will be used; otherwise, a name will be automatically generated. If `body` is specified, the `body` will be pre-pended to the automatically generated notes. +- `generate_release_notes` - (Optional) Set to `true` to automatically generate the name and body for this release. If `name` is specified, the specified `name` will be used; otherwise, a name will be automatically generated. If `body` is specified, the `body` will be pre-pended to the automatically generated notes. -* `discussion_category_name` - (Optional) If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see [Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository). +- `discussion_category_name` - (Optional) If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see [Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository). ## Attributes Reference The following additional attributes are exported: -* `release_id` - The ID of the release. +- `release_id` - The ID of the release. -* `created_at` - This is the date of the commit used for the release, and not the date when the release was drafted or published. +- `created_at` - This is the date of the commit used for the release, and not the date when the release was drafted or published. -* `published_at` - This is the date when the release was published. This will be empty if the release is a draft. +- `published_at` - This is the date when the release was published. This will be empty if the release is a draft. -* `html_url` - URL of the release in GitHub. +- `html_url` - URL of the release in GitHub. -* `url` - URL that can be provided to API calls that reference this release. +- `url` - URL that can be provided to API calls that reference this release. -* `assets_url` - URL that can be provided to API calls displaying the attached assets to this release. +- `assets_url` - URL that can be provided to API calls displaying the attached assets to this release. -* `upload_url` - URL that can be provided to API calls to upload assets. +- `upload_url` - URL that can be provided to API calls to upload assets. -* `zipball_url` - URL that can be provided to API calls to fetch the release ZIP archive. +- `zipball_url` - URL that can be provided to API calls to fetch the release ZIP archive. -* `tarball_url` - URL that can be provided to API calls to fetch the release TAR archive. +- `tarball_url` - URL that can be provided to API calls to fetch the release TAR archive. -* `node_id` - GraphQL global node id for use with v4 API +- `node_id` - GraphQL global node id for use with v4 API ## Import This resource can be imported using the `name` of the repository, combined with the `id` of the release, and a `:` character for separating components, e.g. ```sh -$ terraform import github_release.example repo:12345678 +terraform import github_release.example repo:12345678 ``` diff --git a/website/docs/r/repository.html.markdown b/docs/resources/repository.md similarity index 92% rename from website/docs/r/repository.html.markdown rename to docs/resources/repository.md index d8323a7d13..1be38a6d71 100644 --- a/website/docs/r/repository.html.markdown +++ b/docs/resources/repository.md @@ -1,20 +1,18 @@ --- -layout: "github" -page_title: "GitHub: github_repository" +page_title: "github_repository (Resource) - GitHub" description: |- Creates and manages repositories within GitHub organizations or personal accounts --- -# github_repository +# github_repository (Resource) -This resource allows you to create and manage repositories within your -GitHub organization or personal account. +This resource allows you to create and manage repositories within your GitHub organization or personal account. ~> **Note** When used with GitHub App authentication, even GET requests must have the `contents:write` permission. Without it, the following arguments will be ignored, leading to unexpected behavior and confusing diffs: `allow_merge_commit`, `allow_squash_merge`, `allow_rebase_merge`, `merge_commit_title`, `merge_commit_message`, `squash_merge_commit_title` and `squash_merge_commit_message`. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "example" description = "My awesome codebase" @@ -31,13 +29,19 @@ resource "github_repository" "example" { ## Example Usage with Repository Forking -```hcl -resource "github_repository" "forked_repo" { - name = "forked-repository" - description = "This is a fork of another repository" - fork = true - source_owner = "some-org" - source_repo = "original-repository" +```terraform +resource "github_repository" "example" { + name = "example" + description = "My awesome web page" + + private = false + + pages { + source { + branch = "master" + path = "/docs" + } + } } ``` @@ -57,20 +61,17 @@ The following arguments are supported: - `source_repo` - (Optional) The name of the repository to fork. Required when `fork` is `true`. -- `private` - (Optional) Set to `true` to create a private repository. - Repositories are created as public (e.g. open source) by default. +- `private` - (Optional) Set to `true` to create a private repository. Repositories are created as public (e.g. open source) by default. - `visibility` - (Optional) Can be `public` or `private`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be `internal`. The `visibility` parameter overrides the `private` parameter. -- `has_issues` - (Optional) Set to `true` to enable the GitHub Issues features - on the repository. +- `has_issues` - (Optional) Set to `true` to enable the GitHub Issues features on the repository. - `has_discussions` - (Optional) Set to `true` to enable GitHub Discussions on the repository. Defaults to `false`. - `has_projects` - (Optional) Set to `true` to enable the GitHub Projects features on the repository. Per the GitHub [documentation](https://developer.github.com/v3/repos/#create) when in an organization that has disabled repository projects it will default to `false` and will otherwise default to `true`. If you specify `true` when it has been disabled it will return an error. -- `has_wiki` - (Optional) Set to `true` to enable the GitHub Wiki features on - the repository. +- `has_wiki` - (Optional) Set to `true` to enable the GitHub Wiki features on the repository. - `is_template` - (Optional) Set to `true` to tell GitHub that this is a template repository. @@ -104,9 +105,7 @@ The following arguments are supported: - `license_template` - (Optional) Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, "mit" or "mpl-2.0". -- `default_branch` - (Optional) (Deprecated: Use `github_branch_default` resource instead) The name of the default branch of the repository. **NOTE:** This can only be set after a repository has already been created, -and after a correct reference has been created for the target branch inside the repository. This means a user will have to omit this parameter from the -initial repository creation and create the target branch inside of the repository prior to setting this attribute. +- `default_branch` - (Optional) (Deprecated: Use `github_branch_default` resource instead) The name of the default branch of the repository. **NOTE:** This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository. This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute. - `archived` - (Optional) Specifies if the repository should be archived. Defaults to `false`. **NOTE** Currently, the API does not support unarchiving. @@ -220,13 +219,10 @@ The following additional attributes are exported: - `primary_language` - The primary language used in the repository. -- `pages` - The block consisting of the repository's GitHub Pages configuration with the following additional attributes: - -- `custom_404` - Whether the rendered GitHub Pages site has a custom 404 page. - -- `html_url` - The absolute URL (including scheme) of the rendered GitHub Pages site e.g. `https://username.github.io`. - -- `status` - The GitHub Pages site's build status e.g. `building` or `built`. +- `pages` - The block consisting of the repository's GitHub Pages configuration. + - `custom_404` - Whether the rendered GitHub Pages site has a custom 404 page. + - `html_url` - The absolute URL (including scheme) of the rendered GitHub Pages site e.g. `https://username.github.io`. + - `status` - The GitHub Pages site's build status e.g. `building` or `built`. ## Import diff --git a/website/docs/r/repository_autolink_reference.html.markdown b/docs/resources/repository_autolink_reference.md similarity index 74% rename from website/docs/r/repository_autolink_reference.html.markdown rename to docs/resources/repository_autolink_reference.md index 1fbebc5b22..3d1a435001 100644 --- a/website/docs/r/repository_autolink_reference.html.markdown +++ b/docs/resources/repository_autolink_reference.md @@ -1,20 +1,19 @@ --- -layout: "github" -page_title: "GitHub: github_repository_autolink_reference" +page_title: "github_repository_autolink_reference (Resource) - GitHub" description: |- Creates and manages autolink references for a single repository --- -# github_repository_autolink_reference +# github_repository_autolink_reference (Resource) This resource allows you to create and manage an autolink reference for a single repository. ## Example Usage -```hcl +```terraform resource "github_repository" "repo" { - name = "my-repo" - description = "GitHub repo managed by Terraform" + name = "my-repo" + description = "GitHub repo managed by Terraform" private = false } @@ -32,19 +31,19 @@ resource "github_repository_autolink_reference" "autolink" { The following arguments are supported: -* `repository` - (Required) The repository of the autolink reference. +- `repository` - (Required) The repository of the autolink reference. -* `key_prefix` - (Required) This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit. +- `key_prefix` - (Required) This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit. -* `target_url_template` - (Required) The template of the target URL used for the links; must be a valid URL and contain `` for the reference number +- `target_url_template` - (Required) The template of the target URL used for the links; must be a valid URL and contain `` for the reference number -* `is_alphanumeric` - (Optional) Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true. +- `is_alphanumeric` - (Optional) Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true. ## Attributes Reference The following additional attributes are exported: -* `etag` - An etag representing the autolink reference object. +- `etag` - An etag representing the autolink reference object. ## Import diff --git a/website/docs/r/repository_collaborator.html.markdown b/docs/resources/repository_collaborator.md similarity index 52% rename from website/docs/r/repository_collaborator.html.markdown rename to docs/resources/repository_collaborator.md index d89a509e4d..a6d476c221 100644 --- a/website/docs/r/repository_collaborator.html.markdown +++ b/docs/resources/repository_collaborator.md @@ -1,32 +1,22 @@ --- -layout: "github" -page_title: "GitHub: github_repository_collaborator" +page_title: "github_repository_collaborator (Resource) - GitHub" description: |- Provides a GitHub repository collaborator resource. --- -# github_repository_collaborator +# github_repository_collaborator (Resource) Provides a GitHub repository collaborator resource. -~> Note: github_repository_collaborator cannot be used in conjunction with github_repository_collaborators or -they will fight over what your policy should be. +~> Note: github_repository_collaborator cannot be used in conjunction with github_repository_collaborators or they will fight over what your policy should be. -This resource allows you to add/remove collaborators from repositories in your -organization or personal account. For organization repositories, collaborators can -have explicit (and differing levels of) read, write, or administrator access to -specific repositories, without giving the user full organization membership. -For personal repositories, collaborators can only be granted write -(implicitly includes read) permission. +This resource allows you to add/remove collaborators from repositories in your organization or personal account. For organization repositories, collaborators can have explicit (and differing levels of) read, write, or administrator access to specific repositories, without giving the user full organization membership. For personal repositories, collaborators can only be granted write (implicitly includes read) permission. -When applied, an invitation will be sent to the user to become a collaborator -on a repository. When destroyed, either the invitation will be cancelled or the -collaborator will be removed from the repository. +When applied, an invitation will be sent to the user to become a collaborator on a repository. When destroyed, either the invitation will be cancelled or the collaborator will be removed from the repository. ~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing collaborator modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. -This resource is non-authoritative, for managing ALL collaborators of a repo, use github_repository_collaborators -instead. +This resource is non-authoritative, for managing ALL collaborators of a repo, use github_repository_collaborators instead. Further documentation on GitHub collaborators: @@ -36,7 +26,7 @@ Further documentation on GitHub collaborators: ## Example Usage -```hcl +```terraform # Add a collaborator to a repository resource "github_repository_collaborator" "a_repo_collaborator" { repository = "our-cool-repo" @@ -49,26 +39,24 @@ resource "github_repository_collaborator" "a_repo_collaborator" { The following arguments are supported: -* `repository` - (Required) The GitHub repository +- `repository` - (Required) The GitHub repository -~> Note: The owner of the repository can be passed as part of the repository name e.g. `owner-org-name/repo-name`. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variable `GITHUB_OWNER`. +~> Note: The owner of the repository can be passed as part of the repository name e.g. `owner-org-name/repo-name`. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variable `GITHUB_OWNER`. -* `username` - (Required) The user to add to the repository as a collaborator. -* `permission` - (Optional) The permission of the outside collaborator for the repository. - Must be one of `pull`, `push`, `maintain`, `triage` or `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organization for organization-owned repositories. - Must be `push` for personal repositories. Defaults to `push`. -* `permission_diff_suppression` - (Optional) Suppress plan diffs for `triage` and `maintain`. Defaults to `false`. +- `username` - (Required) The user to add to the repository as a collaborator. +- `permission` - (Optional) The permission of the outside collaborator for the repository. Must be one of `pull`, `push`, `maintain`, `triage` or `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organization for organization-owned repositories. Must be `push` for personal repositories. Defaults to `push`. +- `permission_diff_suppression` - (Optional) Suppress plan diffs for `triage` and `maintain`. Defaults to `false`. ## Attribute Reference In addition to the above arguments, the following attributes are exported: -* `invitation_id` - ID of the invitation to be used in [`github_user_invitation_accepter`](./user_invitation_accepter.html) +- `invitation_id` - ID of the invitation to be used in `github_user_invitation_accepter`. ## Import GitHub Repository Collaborators can be imported using an ID made up of `repository:username`, e.g. -``` +```hcl $ terraform import github_repository_collaborator.collaborator terraform:someuser -``` \ No newline at end of file +``` diff --git a/website/docs/r/repository_collaborators.html.markdown b/docs/resources/repository_collaborators.md similarity index 59% rename from website/docs/r/repository_collaborators.html.markdown rename to docs/resources/repository_collaborators.md index 4f1e527aa0..550fd56ca8 100644 --- a/website/docs/r/repository_collaborators.html.markdown +++ b/docs/resources/repository_collaborators.md @@ -1,32 +1,22 @@ --- -layout: "github" -page_title: "GitHub: github_repository_collaborators" +page_title: "github_repository_collaborators (Resource) - GitHub" description: |- Provides a GitHub repository collaborators resource. --- -# github_repository_collaborators +# github_repository_collaborators (Resource) Provides a GitHub repository collaborators resource. -~> Note: github_repository_collaborators cannot be used in conjunction with github_repository_collaborator and -github_team_repository or they will fight over what your policy should be. +~> Note: github_repository_collaborators cannot be used in conjunction with github_repository_collaborator and github_team_repository or they will fight over what your policy should be. -This resource allows you to manage all collaborators for repositories in your -organization or personal account. For organization repositories, collaborators can -have explicit (and differing levels of) read, write, or administrator access to -specific repositories, without giving the user full organization membership. -For personal repositories, collaborators can only be granted write -(implicitly includes read) permission. +This resource allows you to manage all collaborators for repositories in your organization or personal account. For organization repositories, collaborators can have explicit (and differing levels of) read, write, or administrator access to specific repositories, without giving the user full organization membership. For personal repositories, collaborators can only be granted write (implicitly includes read) permission. -When applied, an invitation will be sent to the user to become a collaborators -on a repository. When destroyed, either the invitation will be cancelled or the -collaborators will be removed from the repository. +When applied, an invitation will be sent to the user to become a collaborators on a repository. When destroyed, either the invitation will be cancelled or the collaborators will be removed from the repository. ~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing collaborator modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. -This resource is authoritative. For adding a collaborator to a repo in a non-authoritative manner, use -github_repository_collaborator instead. +This resource is authoritative. For adding a collaborator to a repo in a non-authoritative manner, use github_repository_collaborator instead. Further documentation on GitHub collaborators: @@ -36,7 +26,7 @@ Further documentation on GitHub collaborators: ## Example Usage -```hcl +```terraform # Add collaborators to a repository resource "github_team" "some_team" { name = "SomeTeam" @@ -74,16 +64,12 @@ The following arguments are supported: The `user` block supports: - `username` - (Required) The user to add to the repository as a collaborator. -- `permission` - (Optional) The permission of the outside collaborators for the repository. - Must be one of `pull`, `push`, `maintain`, `triage` or `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organization for organization-owned repositories. - Must be `push` for personal repositories. Defaults to `push`. +- `permission` - (Optional) The permission of the outside collaborators for the repository. Must be one of `pull`, `push`, `maintain`, `triage` or `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organization for organization-owned repositories. Must be `push` for personal repositories. Defaults to `push`. The `team` block supports: - `team_id` - (Required) The GitHub team id or the GitHub team slug. -- `permission` - (Optional) The permission of the outside collaborators for the repository. - Must be one of `pull`, `triage`, `push`, `maintain`, `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organisation. Defaults to `pull`. - Must be `push` for personal repositories. Defaults to `push`. +- `permission` - (Optional) The permission of the outside collaborators for the repository. Must be one of `pull`, `triage`, `push`, `maintain`, `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organisation. Defaults to `pull`. Must be `push` for personal repositories. Defaults to `push`. The `ignore_team` block supports: @@ -93,13 +79,12 @@ The `ignore_team` block supports: In addition to the above arguments, the following attributes are exported: -- `invitation_ids` - Map of usernames to invitation ID for any users added as part of creation of this resource to - be used in [`github_user_invitation_accepter`](./user_invitation_accepter.html). +- `invitation_ids` - Map of usernames to invitation ID for any users added as part of creation of this resource to be used in `github_user_invitation_accepter`. ## Import -GitHub Repository Collaborators can be imported using the repository name `name`, e.g. +GitHub Repository Collaborators can be imported using the name `name`, e.g. ```hcl -terraform import github_repository_collaborators.collaborators myrepo +$ terraform import github_repository_collaborators.collaborators terraform ``` diff --git a/website/docs/r/repository_custom_property.html.markdown b/docs/resources/repository_custom_property.md similarity index 77% rename from website/docs/r/repository_custom_property.html.markdown rename to docs/resources/repository_custom_property.md index 026030a0d2..4e2f33c3a0 100644 --- a/website/docs/r/repository_custom_property.html.markdown +++ b/docs/resources/repository_custom_property.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_repository_custom_property" +page_title: "github_repository_custom_property (Resource) - GitHub" description: |- Creates and a specific custom property for a GitHub repository --- -# github_repository_custom_property +# github_repository_custom_property (Resource) This resource allows you to create and manage a specific custom property for a GitHub repository. @@ -13,7 +12,7 @@ This resource allows you to create and manage a specific custom property for a G > Note that this assumes there already is a custom property defined on the org level called `my-cool-property` of type `string` -```hcl +```terraform resource "github_repository" "example" { name = "example" description = "My awesome codebase" @@ -30,18 +29,18 @@ resource "github_repository_custom_property" "string" { The following arguments are supported: -* `repository` - (Required) The repository of the environment. +- `repository` - (Required) The repository of the environment. -* `property_type` - (Required) Type of the custom property. Can be one of `single_select`, `multi_select`, `string`, or `true_false` +- `property_type` - (Required) Type of the custom property. Can be one of `single_select`, `multi_select`, `string`, or `true_false` -* `property_name` - (Required) Name of the custom property. Note that a pre-requisiste for this resource is that a custom property of this name has already been defined on the organization level +- `property_name` - (Required) Name of the custom property. Note that a pre-requisiste for this resource is that a custom property of this name has already been defined on the organization level -* `property_value` - (Required) Value of the custom property in the form of an array. Properties of type `single_select`, `string`, and `true_false` are represented as a string array of length 1 +- `property_value` - (Required) Value of the custom property in the form of an array. Properties of type `single_select`, `string`, and `true_false` are represented as a string array of length 1 ## Import GitHub Repository Custom Property can be imported using an ID made up of a combination of the names of the organization, repository, custom property separated by a `:` character, e.g. -``` +```hcl $ terraform import github_repository_custom_property.example organization-name:repo-name:custom-property-name ``` diff --git a/docs/resources/repository_dependabot_security_updates.md b/docs/resources/repository_dependabot_security_updates.md new file mode 100644 index 0000000000..c459aa28bb --- /dev/null +++ b/docs/resources/repository_dependabot_security_updates.md @@ -0,0 +1,46 @@ +--- +page_title: "github_repository_dependabot_security_updates (Resource) - GitHub" +description: |- + Manages automated security fixes for a single repository +--- + +# github_repository_dependabot_security_updates (Resource) + +This resource allows you to manage dependabot automated security fixes for a single repository. See the [documentation](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates) for details of usage and how this will impact your repository + +## Example Usage + +```terraform +resource "github_repository" "repo" { + name = "my-repo" + description = "GitHub repo managed by Terraform" + + private = false + + vulnerability_alerts = true +} + + +resource "github_repository_dependabot_security_updates" "example" { + repository = github_repository.test.name + enabled = true +} +``` + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The name of the GitHub repository. + +- `enabled` - (Required) The state of the automated security fixes. + +## Import + +Automated security references can be imported using the `name` of the repository + +### Import by name + +```sh +terraform import github_repository_dependabot_security_updates.example my-repo +``` diff --git a/website/docs/r/repository_deploy_key.html.markdown b/docs/resources/repository_deploy_key.md similarity index 74% rename from website/docs/r/repository_deploy_key.html.markdown rename to docs/resources/repository_deploy_key.md index c497c4e9bf..997ee1daed 100644 --- a/website/docs/r/repository_deploy_key.html.markdown +++ b/docs/resources/repository_deploy_key.md @@ -1,28 +1,26 @@ --- -layout: "github" -page_title: "GitHub: github_repository_deploy_key" +page_title: "github_repository_deploy_key (Resource) - GitHub" description: |- Provides a GitHub repository deploy key resource. --- -# github_repository_deploy_key +# github_repository_deploy_key (Resource) Provides a GitHub repository deploy key resource. -A deploy key is an SSH key that is stored on your server and grants -access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user -account. +A deploy key is an SSH key that is stored on your server and grants access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user account. This resource allows you to add/remove repository deploy keys. ~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing deploy key modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. Further documentation on GitHub repository deploy keys: + - [About deploy keys](https://developer.github.com/guides/managing-deploy-keys/#deploy-keys) ## Example Usage -```hcl +```terraform # Generate an ssh key using provider "hashicorp/tls" resource "tls_private_key" "example_repository_deploy_key" { algorithm = "ED25519" @@ -41,18 +39,17 @@ resource "github_repository_deploy_key" "example_repository_deploy_key" { The following arguments are supported: -* `key` - (Required) A SSH key. -* `read_only` - (Required) A boolean qualifying the key to be either read only or read/write. -* `repository` - (Required) Name of the GitHub repository. -* `title` - (Required) A title. +- `key` - (Required) A SSH key. +- `read_only` - (Required) A boolean qualifying the key to be either read only or read/write. +- `repository` - (Required) Name of the GitHub repository. +- `title` - (Required) A title. Changing any of the fields forces re-creating the resource. ## Import -Repository deploy keys can be imported using a colon-separated pair of repository name -and GitHub's key id. The latter can be obtained by GitHub's SDKs and API. +Repository deploy keys can be imported using a colon-separated pair of repository name and GitHub's key id. The latter can be obtained by GitHub's SDKs and API. -``` +```hcl $ terraform import github_repository_deploy_key.foo test-repo:23824728 ``` diff --git a/website/docs/r/repository_deployment_branch_policy.html.markdown b/docs/resources/repository_deployment_branch_policy.md similarity index 74% rename from website/docs/r/repository_deployment_branch_policy.html.markdown rename to docs/resources/repository_deployment_branch_policy.md index bda3cbd02b..c279c722b5 100644 --- a/website/docs/r/repository_deployment_branch_policy.html.markdown +++ b/docs/resources/repository_deployment_branch_policy.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_repository_deployment_branch_policy" +page_title: "github_repository_deployment_branch_policy (Resource) - GitHub" description: |- Creates and manages deployment branch policies --- -# github_repository_deployment_branch_policy +# github_repository_deployment_branch_policy (Resource) ~> **Note:** This resource is deprecated, please use the `github_repository_environment_deployment_policy` resource instead. @@ -13,7 +12,7 @@ This resource allows you to create and manage deployment branch policies. ## Example Usage -```hcl +```terraform resource "github_repository_environment" "env" { repository = "my_repo" environment = "my_env" @@ -36,20 +35,20 @@ resource "github_repository_deployment_branch_policy" "foo" { The following arguments are supported: -* `repository` - (Required) The repository to create the policy in. +- `repository` - (Required) The repository to create the policy in. -* `environment_name` - (Required) The name of the environment. This environment must have `deployment_branch_policy.custom_branch_policies` set to true or a 404 error will be thrown. +- `environment_name` - (Required) The name of the environment. This environment must have `deployment_branch_policy.custom_branch_policies` set to true or a 404 error will be thrown. -* `name` - (Required) The name pattern that branches must match in order to deploy to the environment. +- `name` - (Required) The name pattern that branches must match in order to deploy to the environment. ## Attributes Reference The following additional attributes are exported: -* `id` - The ID of the deployment branch policy. +- `id` - The ID of the deployment branch policy. ## Import -```text +```hcl $ terraform import github_repository_deployment_branch_policy.foo repo:env:id ``` diff --git a/website/docs/r/repository_environment.html.markdown b/docs/resources/repository_environment.md similarity index 95% rename from website/docs/r/repository_environment.html.markdown rename to docs/resources/repository_environment.md index 6ff870340a..4126f8be7f 100644 --- a/website/docs/r/repository_environment.html.markdown +++ b/docs/resources/repository_environment.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_repository_environment" +page_title: "github_repository_environment (Resource) - GitHub" description: |- Creates and manages environments for GitHub repositories --- -# github_repository_environment +# github_repository_environment (Resource) This resource allows you to create and manage environments for a GitHub repository. ## Example Usage -```hcl +```terraform data "github_user" "current" { username = "" } @@ -77,7 +76,7 @@ This resource can be imported using an ID made of the repository name and enviro The following import block imports an environment called `myenv` for the repo `myrepo` to a `github_repository_environment` resource named `example`. -```hcl +```terraform import { to = github_repository_environment.example id = "myrepo:myenv" diff --git a/website/docs/r/repository_environment_deployment_policy.html.markdown b/docs/resources/repository_environment_deployment_policy.md similarity index 89% rename from website/docs/r/repository_environment_deployment_policy.html.markdown rename to docs/resources/repository_environment_deployment_policy.md index 6811d1117f..0fe64dc72d 100644 --- a/website/docs/r/repository_environment_deployment_policy.html.markdown +++ b/docs/resources/repository_environment_deployment_policy.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_repository_environment_deployment_policy" +page_title: "github_repository_environment_deployment_policy (Resource) - GitHub" description: |- Creates and manages environment deployment branch policies for GitHub repositories --- -# github_repository_environment_deployment_policy +# github_repository_environment_deployment_policy (Resource) This resource allows you to create and manage environment deployment branch policies for a GitHub repository. @@ -13,19 +12,19 @@ This resource allows you to create and manage environment deployment branch poli Create a branch-based deployment policy: -```hcl +```terraform data "github_user" "current" { username = "" } resource "github_repository" "test" { - name = "tf-acc-test-%s" + name = "tf-acc-test-%s" } resource "github_repository_environment" "test" { - repository = github_repository.test.name - environment = "environment/test" - wait_timer = 10000 + repository = github_repository.test.name + environment = "environment/test" + wait_timer = 10000 reviewers { users = [data.github_user.current.id] } @@ -44,14 +43,13 @@ resource "github_repository_environment_deployment_policy" "test" { Create a tag-based deployment policy: -```hcl - +```terraform data "github_user" "current" { username = "" } resource "github_repository" "test" { - name = "tf-acc-test-%s" + name = "tf-acc-test-%s" } resource "github_repository_environment" "test" { @@ -99,7 +97,7 @@ This resource can be imported using an ID made of the repository name, environme The following import block imports a deployment policy with the ID `123456` for the repo `myrepo` and environment `myenv` to a `github_repository_environment_deployment_policy` resource named `example`. -```hcl +```terraform import { to = github_repository_environment_deployment_policy.example id = "myrepo:myenv:123456" diff --git a/website/docs/r/repository_file.html.markdown b/docs/resources/repository_file.md similarity index 92% rename from website/docs/r/repository_file.html.markdown rename to docs/resources/repository_file.md index 8bd65b16fb..700b3c00fc 100644 --- a/website/docs/r/repository_file.html.markdown +++ b/docs/resources/repository_file.md @@ -1,14 +1,12 @@ --- -layout: "github" -page_title: "GitHub: github_repository_file" +page_title: "github_repository_file (Resource) - GitHub" description: |- Creates and manages files within a GitHub repository --- -# github_repository_file +# github_repository_file (Resource) -This resource allows you to create and manage files within a -GitHub repository. +This resource allows you to create and manage files within a GitHub repository. ~> **Note:** When a repository is archived, Terraform will skip deletion of repository files to avoid API errors, as archived repositories are read-only. The files will be removed from Terraform state without attempting to delete them from GitHub. @@ -16,8 +14,7 @@ GitHub repository. ### Existing Branch -```hcl - +```terraform resource "github_repository" "foo" { name = "example" auto_init = true @@ -33,13 +30,11 @@ resource "github_repository_file" "foo" { commit_email = "terraform@example.com" overwrite_on_create = true } - ``` ### Auto Created Branch -```hcl - +```terraform resource "github_repository" "foo" { name = "example" auto_init = true @@ -56,7 +51,6 @@ resource "github_repository_file" "foo" { overwrite_on_create = true autocreate_branch = true } - ``` ## Argument Reference @@ -69,8 +63,7 @@ The following arguments are supported: - `content` - (Required) The file content. -- `branch` - (Optional) Git branch (defaults to the repository's default branch). - The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true. +- `branch` - (Optional) Git branch (defaults to the repository's default branch). The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true. - `commit_author` - (Optional) Committer author name to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This maybe useful when a branch protection rule requires signed commits. diff --git a/website/docs/r/repository_milestone.html.markdown b/docs/resources/repository_milestone.md similarity index 62% rename from website/docs/r/repository_milestone.html.markdown rename to docs/resources/repository_milestone.md index fb5e951d20..d42989437c 100644 --- a/website/docs/r/repository_milestone.html.markdown +++ b/docs/resources/repository_milestone.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_repository_milestone" +page_title: "github_repository_milestone (Resource) - GitHub" description: |- Provides a GitHub repository milestone resource. --- -# github_repository_milestone +# github_repository_milestone (Resource) Provides a GitHub repository milestone resource. @@ -13,7 +12,7 @@ This resource allows you to create and manage milestones for a GitHub Repository ## Example Usage -```hcl +```terraform # Create a milestone for a repository resource "github_repository_milestone" "example" { owner = "example-owner" @@ -26,29 +25,28 @@ resource "github_repository_milestone" "example" { The following arguments are supported: -* `owner` - (Required) The owner of the GitHub Repository. - -* `repository` - (Required) The name of the GitHub Repository. +- `owner` - (Required) The owner of the GitHub Repository. -* `title` - (Required) The title of the milestone. +- `repository` - (Required) The name of the GitHub Repository. -* `description` - (Optional) A description of the milestone. +- `title` - (Required) The title of the milestone. -* `due_date` - (Optional) The milestone due date. In `yyyy-mm-dd` format. +- `description` - (Optional) A description of the milestone. -* `state` - (Optional) The state of the milestone. Either `open` or `closed`. Default: `open` +- `due_date` - (Optional) The milestone due date. In `yyyy-mm-dd` format. +- `state` - (Optional) The state of the milestone. Either `open` or `closed`. Default: `open` ## Attributes Reference The following additional attributes are exported: -* `number` - The number of the milestone. +- `number` - The number of the milestone. ## Import A GitHub Repository Milestone can be imported using an ID made up of `owner/repository/number`, e.g. -``` +```hcl $ terraform import github_repository_milestone.example example-owner/example-repository/1 ``` diff --git a/website/docs/r/repository_pages.html.markdown b/docs/resources/repository_pages.md similarity index 89% rename from website/docs/r/repository_pages.html.markdown rename to docs/resources/repository_pages.md index 855a04c5f2..25e79e119d 100644 --- a/website/docs/r/repository_pages.html.markdown +++ b/docs/resources/repository_pages.md @@ -1,15 +1,12 @@ --- -layout: "github" -page_title: "GitHub: github_repository_pages" +page_title: "github_repository_pages (Resource) - GitHub" description: |- Manages GitHub Pages for a repository --- -# github_repository_pages +# github_repository_pages (Resource) -This resource allows you to manage GitHub Pages for a repository. See the -[documentation](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages) -for details on GitHub Pages. +This resource allows you to manage GitHub Pages for a repository. See the [documentation](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages) for details on GitHub Pages. The authenticated user must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. OAuth app tokens and personal access tokens (classic) need the repo scope to use this resource. @@ -17,7 +14,7 @@ The authenticated user must be a repository administrator, maintainer, or have t ### Legacy Build Type -```hcl +```terraform resource "github_repository" "example" { name = "my-repo" visibility = "public" @@ -43,7 +40,7 @@ resource "github_repository_pages" "example" { ### Workflow Build Type (GitHub Actions) -```hcl +```terraform resource "github_repository" "example" { name = "my-repo" visibility = "public" @@ -64,7 +61,7 @@ resource "github_repository_pages" "example" { ### With Custom Domain -```hcl +```terraform resource "github_repository" "example" { name = "my-repo" visibility = "public" @@ -78,8 +75,8 @@ resource "github_repository" "example" { } resource "github_repository_pages" "example" { - repository = github_repository.example.name - build_type = "legacy" + repository = github_repository.example.name + build_type = "legacy" cname = "example.com" https_enforced = true diff --git a/website/docs/r/repository_project.html.markdown b/docs/resources/repository_project.md similarity index 72% rename from website/docs/r/repository_project.html.markdown rename to docs/resources/repository_project.md index 0ce0c9f578..89e81b654c 100644 --- a/website/docs/r/repository_project.html.markdown +++ b/docs/resources/repository_project.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_repository_project" +page_title: "github_repository_project (Resource) - GitHub" description: |- Creates and manages projects for GitHub repositories --- -# github_repository_project +# github_repository_project (Resource) !> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. @@ -13,7 +12,7 @@ This resource allows you to create and manage projects for GitHub repository. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "example" description = "My awesome codebase" @@ -22,7 +21,7 @@ resource "github_repository" "example" { resource "github_repository_project" "project" { name = "A Repository Project" - repository = "${github_repository.example.name}" + repository = github_repository.example.name body = "This is a repository project." } ``` @@ -31,14 +30,14 @@ resource "github_repository_project" "project" { The following arguments are supported: -* `name` - (Required) The name of the project. +- `name` - (Required) The name of the project. -* `repository` - (Required) The repository of the project. +- `repository` - (Required) The repository of the project. -* `body` - (Optional) The body of the project. +- `body` - (Optional) The body of the project. ## Attributes Reference The following additional attributes are exported: -* `url` - URL of the project +- `url` - URL of the project diff --git a/docs/resources/repository_pull_request.md b/docs/resources/repository_pull_request.md new file mode 100644 index 0000000000..8d39f35950 --- /dev/null +++ b/docs/resources/repository_pull_request.md @@ -0,0 +1,57 @@ +--- +page_title: "github_repository_pull_request (Resource) - GitHub" +description: |- + Get information on a single GitHub Pull Request. +--- + +# github_repository_pull_request (Resource) + +This resource allows you to create and manage PullRequests for repositories within your GitHub organization or personal account. + +## Example Usage + +```terraform +resource "github_repository_pull_request" "example" { + base_repository = "example-repository" + base_ref = "main" + head_ref = "feature-branch" + title = "My newest feature" + body = "This will change everything" +} +``` + +## Argument Reference + +- `base_repository` - (Required) Name of the base repository to retrieve the Pull Requests from. + +- `base_ref` - (Required) Name of the branch serving as the base of the Pull Request. + +- `head_ref` - (Required) Name of the branch serving as the head of the Pull Request. + +- `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. + +- `title` - (Optional) The title of the Pull Request. + +- `body` - (Optional) Body of the Pull Request. + +- `maintainer_can_modify` - Controls whether the base repository maintainers can modify the Pull Request. Default: false. + +## Attributes Reference + +- `base_sha` - Head commit SHA of the Pull Request base. + +- `draft` - Indicates Whether this Pull Request is a draft. + +- `head_sha` - Head commit SHA of the Pull Request head. + +- `labels` - List of label names set on the Pull Request. + +- `number` - The number of the Pull Request within the repository. + +- `opened_at` - Unix timestamp indicating the Pull Request creation time. + +- `opened_by` - GitHub login of the user who opened the Pull Request. + +- `state` - the current Pull Request state - can be "open", "closed" or "merged". + +- `updated_at` - The timestamp of the last Pull Request update. diff --git a/website/docs/r/repository_ruleset.html.markdown b/docs/resources/repository_ruleset.md similarity index 94% rename from website/docs/r/repository_ruleset.html.markdown rename to docs/resources/repository_ruleset.md index ab2682a786..3d7bfe1363 100644 --- a/website/docs/r/repository_ruleset.html.markdown +++ b/docs/resources/repository_ruleset.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "github_repository_ruleset Resource - terraform-provider-github" +page_title: "github_repository_ruleset (Resource) - GitHub" description: |- Creates a GitHub repository ruleset. --- -# github_repository_ruleset +# github_repository_ruleset (Resource) Creates a GitHub repository ruleset. @@ -13,7 +12,7 @@ This resource allows you to create and manage rulesets on the repository level. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "example" description = "Example repository" @@ -72,7 +71,7 @@ resource "github_repository_ruleset" "example_push" { } max_file_size { - max_file_size = 100 # 100 MB + max_file_size = 100 # 100 MB } max_file_path_length { @@ -102,7 +101,7 @@ resource "github_repository_ruleset" "example_push" { - `repository` - (Required) (String) Name of the repository to apply ruleset to. -#### Rules #### +### Rules The `rules` block supports the following: @@ -149,11 +148,12 @@ The `rules` block supports the following: - `max_file_path_length` - (Optional) (Block List, Max: 1) Prevent commits that include file paths that exceed a specified character limit from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesmax_file_path_length)) - `file_extension_restriction` - (Optional) (Block List, Max: 1) Prevent commits that include files with specified file extensions from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesfile_extension_restriction)) + - `update` - (Optional) (Boolean) Only allow users with bypass permission to update matching refs. - `update_allows_fetch_and_merge` - (Optional) (Boolean) Branch can pull changes from its upstream repository. This is only applicable to forked repositories. Requires `update` to be set to `true`. Note: behaviour is affected by a known bug on the GitHub side which may cause issues when using this parameter. -#### rules.branch_name_pattern #### +#### rules.branch_name_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -163,7 +163,7 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.commit_author_email_pattern #### +#### rules.commit_author_email_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -173,7 +173,7 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.commit_message_pattern #### +#### rules.commit_message_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -183,7 +183,7 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.committer_email_pattern #### +#### rules.committer_email_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -193,7 +193,7 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.merge_queue #### +#### rules.merge_queue - `check_response_timeout_minutes` - (Optional) (Number) Maximum time for a required status check to report a conclusion. After this much time has elapsed, checks that have not reported a conclusion will be assumed to have failed. Defaults to `60`. @@ -209,7 +209,7 @@ The `rules` block supports the following: - `min_entries_to_merge_wait_minutes` - (Optional) (Number) The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met. After this time has elapsed, the minimum group size will be ignored and a smaller group will be merged. Defaults to `5`. -#### rules.pull_request #### +#### rules.pull_request - `allowed_merge_methods` - (Optional) (List of String, Min: 1) Array of merge methods to be allowed. Allowed values include `merge`, `squash`, and `rebase`. At least one must be enabled. - `dismiss_stale_reviews_on_push` - (Optional) (Boolean) New, reviewable commits pushed will dismiss previous pull request review approvals. Defaults to `false`. @@ -218,13 +218,13 @@ The `rules` block supports the following: - `required_approving_review_count` - (Optional) (Number) The number of approving reviews that are required before a pull request can be merged. Defaults to `0`. - `required_review_thread_resolution` - (Optional) (Boolean) All conversations on code must be resolved before a pull request can be merged. Defaults to `false`. -#### rules.copilot_code_review #### +#### rules.copilot_code_review - `review_on_push` - (Optional) (Boolean) Copilot automatically reviews each new push to the pull request. Defaults to `false`. - `review_draft_pull_requests` - (Optional) (Boolean) Copilot automatically reviews draft pull requests before they are marked as ready for review. Defaults to `false`. -#### rules.pull_request.required_reviewers #### +#### rules.pull_request.required_reviewers - `reviewer` - (Required) (Block List, Max: 1) The reviewer that must review matching files. (see [below for nested schema](#rulespull_requestrequired_reviewersreviewer)) @@ -232,17 +232,17 @@ The `rules` block supports the following: - `minimum_approvals` - (Required) (Number) Minimum number of approvals required from this reviewer. Set to 0 to make approval optional. -#### rules.pull_request.required_reviewers.reviewer #### +#### rules.pull_request.required_reviewers.reviewer - `id` - (Required) (Number) The ID of the reviewer (Team ID). - `type` - (Required) (String) The type of reviewer. Currently only `Team` is supported. -#### rules.required_deployments #### +#### rules.required_deployments - `required_deployment_environments` - (Required) (List of String) The environments that must be successfully deployed to before branches can be merged. -#### rules.required_status_checks #### +#### rules.required_status_checks - `required_check` - (Required) (Block Set, Min: 1) Status checks that are required. Several can be defined. (see [below for nested schema](#rulesrequired_status_checksrequired_check)) @@ -250,13 +250,13 @@ The `rules` block supports the following: - `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. -#### rules.required_status_checks.required_check #### +#### rules.required_status_checks.required_check - `context` - (Required) (String) The status check context name that must be present on the commit. - `integration_id` - (Optional) (Number) The optional integration ID that this status check must originate from. It's a GitHub App ID, which can be obtained by following instructions from the [Get an App API docs](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-app). -#### rules.tag_name_pattern #### +#### rules.tag_name_pattern - `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. @@ -266,11 +266,11 @@ The `rules` block supports the following: - `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. -#### rules.required_code_scanning #### +#### rules.required_code_scanning - `required_code_scanning_tool` - (Required) (Block Set, Min: 1) Actions code scanning tools that are required. Multiple can be defined. (see [below for nested schema](#rulesrequired_code_scanningrequired_code_scanning_tool)) -#### rules.required_code_scanning.required_code_scanning_tool #### +#### rules.required_code_scanning.required_code_scanning_tool - `alerts_threshold` - (Required) (String) The severity level at which code scanning results that raise alerts block a reference update. Can be one of: `none`, `errors`, `errors_and_warnings`, `all`. @@ -278,23 +278,23 @@ The `rules` block supports the following: - `tool` - (Required) (String) The name of a code scanning tool. -#### rules.file_path_restriction #### +#### rules.file_path_restriction - `restricted_file_paths` - (Required) (Block Set, Min: 1) The file paths that are restricted from being pushed to the commit graph. -#### rules.max_file_size #### +#### rules.max_file_size - `max_file_size` - (Required) (Integer) The maximum allowed size, in megabytes (MB), of a file. Valid range is 1-100 MB. -#### rules.max_file_path_length #### +#### rules.max_file_path_length - `max_file_path_length` - (Required) (Integer) The maximum number of characters allowed in file paths. -#### rules.file_extension_restriction #### +#### rules.file_extension_restriction - `restricted_file_extensions` - (Required) (Block Set, Min: 1) The file extensions that are restricted from being pushed to the commit graph. -#### bypass_actors #### +#### bypass_actors - `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. If `actor_type` is `Integration`, `actor_id` is a GitHub App ID. App ID can be obtained by following instructions from the [Get an App API docs](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-app). Some actor types such as `DeployKey` do not have an ID. @@ -306,17 +306,17 @@ The `rules` block supports the following: - `OrganizationAdmin` -> `1` - `RepositoryRole` (This is the actor type, the following are the base repository roles and their associated IDs.) - - `maintain` -> `2` - - `write` -> `4` - - `admin` -> `5` + - `maintain` -> `2` + - `write` -> `4` + - `admin` -> `5` -#### conditions #### +#### conditions - `ref_name` - (Optional) (Block List, Max: 1) Required for `branch` and `tag` targets. Must NOT be set for `push` targets. (see [below for nested schema](#conditionsref_name)) ~> **Note:** For `push` targets, do not include `ref_name` in conditions. Push rulesets operate on file content, not on refs. The `conditions` block is optional for push targets. -#### conditions.ref_name #### +#### conditions.ref_name - `exclude` - (Required) (List of String) Array of ref names or patterns to exclude. The condition will not pass if any of these patterns match. diff --git a/docs/resources/repository_topics.md b/docs/resources/repository_topics.md new file mode 100644 index 0000000000..ae0d21dc4e --- /dev/null +++ b/docs/resources/repository_topics.md @@ -0,0 +1,40 @@ +--- +page_title: "github_repository_topics (Resource) - GitHub" +description: |- + Creates and manages the topics on a repository +--- + +# github_repository_topics (Resource) + +This resource allows you to create and manage topics for repositories within your GitHub organization or personal account. + +~> Note: This resource is not compatible with the `topic` attribute of the `github_repository` Use either `github_repository_topics` or `topic` in `github_repository`. `github_repository_topics` is only meant to be used if the repository itself is not handled via terraform, for example if it's only read as a datasource (see [issue #1845](https://github.com/integrations/terraform-provider-github/issues/1845)). + +## Example Usage + +```terraform +data "github_repository" "test" { + name = "test" +} + +resource "github_repository_topics" "test" { + repository = github_repository.test.name + topics = ["topic-1", "topic-2"] +} +``` + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository name. + +- `topics` - (Required) A list of topics to add to the repository. + +## Import + +Repository topics can be imported using the `name` of the repository. + +```hcl +$ terraform import github_repository_topics.terraform terraform +``` diff --git a/website/docs/r/repository_vulnerability_alerts.html.markdown b/docs/resources/repository_vulnerability_alerts.md similarity index 75% rename from website/docs/r/repository_vulnerability_alerts.html.markdown rename to docs/resources/repository_vulnerability_alerts.md index cb047819d0..4fceda7d63 100644 --- a/website/docs/r/repository_vulnerability_alerts.html.markdown +++ b/docs/resources/repository_vulnerability_alerts.md @@ -1,19 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_repository_vulnerability_alerts" +page_title: "github_repository_vulnerability_alerts (Resource) - GitHub" description: |- Manages vulnerability alerts for a GitHub repository --- -# github_repository_vulnerability_alerts +# github_repository_vulnerability_alerts (Resource) -This resource allows you to manage vulnerability alerts for a GitHub repository. See the -[documentation](https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts) -for details of usage and how this will impact your repository. +This resource allows you to manage vulnerability alerts for a GitHub repository. See the [documentation](https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts) for details of usage and how this will impact your repository. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "my-repo" description = "GitHub repo managed by Terraform" diff --git a/website/docs/r/repository_webhook.html.markdown b/docs/resources/repository_webhook.md similarity index 66% rename from website/docs/r/repository_webhook.html.markdown rename to docs/resources/repository_webhook.md index 4efec7c1f1..36eba6b78f 100644 --- a/website/docs/r/repository_webhook.html.markdown +++ b/docs/resources/repository_webhook.md @@ -1,26 +1,24 @@ --- -layout: "github" -page_title: "GitHub: github_repository_webhook" +page_title: "github_repository_webhook (Resource) - GitHub" description: |- Creates and manages repository webhooks within GitHub organizations or personal accounts --- -# github_repository_webhook +# github_repository_webhook (Resource) -This resource allows you to create and manage webhooks for repositories within your -GitHub organization or personal account. +This resource allows you to create and manage webhooks for repositories within your GitHub organization or personal account. ~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing webhook modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. ## Example Usage -```hcl +```terraform resource "github_repository" "repo" { name = "foo" description = "Terraform acceptance tests" homepage_url = "http://example.com/" - visibility = "public" + visibility = "public" } resource "github_repository_webhook" "foo" { @@ -42,38 +40,37 @@ resource "github_repository_webhook" "foo" { The following arguments are supported: -* `repository` - (Required) The repository of the webhook. +- `repository` - (Required) The repository of the webhook. -* `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/). +- `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/). -* `configuration` - (Required) Configuration block for the webhook. [Detailed below.](#configuration) +- `configuration` - (Required) Configuration block for the webhook. [Detailed below.](#configuration) -* `active` - (Optional) Indicate if the webhook should receive events. Defaults to `true`. +- `active` - (Optional) Indicate if the webhook should receive events. Defaults to `true`. ### configuration -* `url` - (Required) The URL of the webhook. +- `url` - (Required) The URL of the webhook. -* `content_type` - (Required) The content type for the payload. Valid values are either `form` or `json`. +- `content_type` - (Required) The content type for the payload. Valid values are either `form` or `json`. -* `secret` - (Optional) The shared secret for the webhook. [See API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook). +- `secret` - (Optional) The shared secret for the webhook. [See API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook). -* `insecure_ssl` - (Optional) Insecure SSL boolean toggle. Defaults to `false`. +- `insecure_ssl` - (Optional) Insecure SSL boolean toggle. Defaults to `false`. ## Attributes Reference The following additional attributes are exported: -* `url` - URL of the webhook. This is a sensitive attribute because it may include basic auth credentials. +- `url` - URL of the webhook. This is a sensitive attribute because it may include basic auth credentials. ## Import -Repository webhooks can be imported using the `name` of the repository, combined with the `id` of the webhook, separated by a `/` character. -The `id` of the webhook can be found in the URL of the webhook. For example: `"https://github.com/foo-org/foo-repo/settings/hooks/14711452"`. +Repository webhooks can be imported using the `name` of the repository, combined with the `id` of the webhook, separated by a `/` character. The `id` of the webhook can be found in the URL of the webhook. For example: `"https://github.com/foo-org/foo-repo/settings/hooks/14711452"`. Importing uses the name of the repository, as well as the ID of the webhook, e.g. -``` +```hcl $ terraform import github_repository_webhook.terraform terraform/11235813 ``` diff --git a/docs/resources/team.md b/docs/resources/team.md new file mode 100644 index 0000000000..8caca0daf8 --- /dev/null +++ b/docs/resources/team.md @@ -0,0 +1,51 @@ +--- +page_title: "github_team (Resource) - GitHub" +description: |- + Provides a GitHub team resource. +--- + +# github_team (Resource) + +Provides a GitHub team resource. + +This resource allows you to add/remove teams from your organization. When applied, a new team will be created. When destroyed, that team will be removed. + +## Example Usage + +```terraform +# Add a team to the organization +resource "github_team" "some_team" { + name = "some-team" + description = "Some cool team" + privacy = "closed" +} +``` + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the team. +- `description` - (Optional) A description of the team. +- `privacy` - (Optional) The level of privacy for the team. Must be one of `secret` *(default)- or `closed`. +- `notification_setting` - (Optional) The notification setting for the team. Must be one of `notifications_enabled` *(default)- or `notifications_disabled`. +- `parent_team_id` - (Optional) The ID or slug of the parent team, if this is a nested team. +- `ldap_dn` - (Optional) The LDAP Distinguished Name of the group where membership will be synchronized. Only available in GitHub Enterprise Server. +- `create_default_maintainer` - (**DEPRECATED**) (Optional) Adds a default maintainer to the team. Defaults to `false` and adds the creating user to the team when `true`. + +## Attributes Reference + +The following attributes are exported: + +- `id` - The ID of the created team. +- `node_id` - The Node ID of the created team. +- `slug` - The slug of the created team, which may or may not differ from `name`, depending on whether `name` contains "URL-unsafe" characters. + +## Import + +GitHub Teams can be imported using the GitHub team ID or name e.g. + +```shell +terraform import github_team.core 1234567 +terraform import github_team.core Administrators +``` diff --git a/website/docs/r/team_members.html.markdown b/docs/resources/team_members.md similarity index 73% rename from website/docs/r/team_members.html.markdown rename to docs/resources/team_members.md index 2ab875ec18..fe9756a01d 100644 --- a/website/docs/r/team_members.html.markdown +++ b/docs/resources/team_members.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_team_members" +page_title: "github_team_members (Resource) - GitHub" description: |- Provides an authoritative GitHub team members resource. --- -# github_team_members +# github_team_members (Resource) Provides a GitHub team members resource. @@ -23,7 +22,7 @@ When destroyed, all users will be removed from the team. ## Example Usage -```hcl +```terraform # Add a user to the organization resource "github_membership" "membership_for_some_user" { username = "SomeUser" @@ -41,7 +40,7 @@ resource "github_team" "some_team" { } resource "github_team_members" "some_team_members" { - team_id = github_team.some_team.id + team_id = github_team.some_team.id members { username = "SomeUser" @@ -59,27 +58,26 @@ resource "github_team_members" "some_team_members" { The following arguments are supported: -* `team_id` - (Required) The team id or the team slug +- `team_id` - (Required) The team id or the team slug -~> **Note** Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated. +~> **Note** Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated. -* `members` - (Required) List of team members. See [Members](#members) below for details. +- `members` - (Required) List of team members. See [Members](#members) below for details. ### Members `members` supports the following arguments: -* `username` - (Required) The user to add to the team. -* `role` - (Optional) The role of the user within the team. - Must be one of `member` or `maintainer`. Defaults to `member`. +- `username` - (Required) The user to add to the team. +- `role` - (Optional) The role of the user within the team. Must be one of `member` or `maintainer`. Defaults to `member`. ## Import -~> **Note** Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will result in terraform doing conversions between the team slug and team id. This will cause team members associations to the team to be destroyed and recreated on import. +~> **Note** Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will result in terraform doing conversions between the team slug and team id. This will cause team members associations to the team to be destroyed and recreated on import. GitHub Team Membership can be imported using the team ID team id or team slug, e.g. -``` +```hcl $ terraform import github_team_members.some_team 1234567 $ terraform import github_team_members.some_team Administrators ``` diff --git a/website/docs/r/team_membership.html.markdown b/docs/resources/team_membership.md similarity index 69% rename from website/docs/r/team_membership.html.markdown rename to docs/resources/team_membership.md index ecfa9e5539..f9010f244e 100644 --- a/website/docs/r/team_membership.html.markdown +++ b/docs/resources/team_membership.md @@ -1,18 +1,14 @@ --- -layout: "github" -page_title: "GitHub: github_team_membership" +page_title: "github_team_membership (Resource) - GitHub" description: |- Provides a GitHub team membership resource. --- -# github_team_membership +# github_team_membership (Resource) Provides a GitHub team membership resource. -This resource allows you to add/remove users from teams in your organization. When applied, -the user will be added to the team. If the user hasn't accepted their invitation to the -organization, they won't be part of the team until they do. When -destroyed, the user will be removed from the team. +This resource allows you to add/remove users from teams in your organization. When applied, the user will be added to the team. If the user hasn't accepted their invitation to the organization, they won't be part of the team until they do. When destroyed, the user will be removed from the team. ~> **Note** This resource is not compatible with `github_team_members`. Use either `github_team_members` or `github_team_membership`. @@ -20,7 +16,7 @@ destroyed, the user will be removed from the team. ## Example Usage -```hcl +```terraform # Add a user to the organization resource "github_membership" "membership_for_some_user" { username = "SomeUser" @@ -43,16 +39,15 @@ resource "github_team_membership" "some_team_membership" { The following arguments are supported: -* `team_id` - (Required) The GitHub team id or the GitHub team slug -* `username` - (Required) The user to add to the team. -* `role` - (Optional) The role of the user within the team. - Must be one of `member` or `maintainer`. Defaults to `member`. +- `team_id` - (Required) The GitHub team id or the GitHub team slug +- `username` - (Required) The user to add to the team. +- `role` - (Optional) The role of the user within the team. Must be one of `member` or `maintainer`. Defaults to `member`. ## Import GitHub Team Membership can be imported using an ID made up of `teamid:username` or `teamname:username`, e.g. -``` +```hcl $ terraform import github_team_membership.member 1234567:someuser $ terraform import github_team_membership.member Administrators:someuser ``` diff --git a/website/docs/r/team_repository.html.markdown b/docs/resources/team_repository.md similarity index 61% rename from website/docs/r/team_repository.html.markdown rename to docs/resources/team_repository.md index 0b3eb02d99..cde375d7c3 100644 --- a/website/docs/r/team_repository.html.markdown +++ b/docs/resources/team_repository.md @@ -1,33 +1,26 @@ --- -layout: "github" -page_title: "GitHub: github_team_repository" +page_title: "github_team_repository (Resource) - GitHub" description: |- Manages the associations between teams and repositories. --- -# github_team_repository +# github_team_repository (Resource) -~> Note: github_team_repository cannot be used in conjunction with github_repository_collaborators or -they will fight over what your policy should be. +~> Note: github_team_repository cannot be used in conjunction with github_repository_collaborators or they will fight over what your policy should be. -This resource manages relationships between teams and repositories -in your GitHub organization. +This resource manages relationships between teams and repositories in your GitHub organization. -Creating this resource grants a particular team permissions on a -particular repository. +Creating this resource grants a particular team permissions on a particular repository. -The repository and the team must both belong to the same organization -on GitHub. This resource does not actually *create* any repositories; -to do that, see [`github_repository`](repository.html). +The repository and the team must both belong to the same organization on GitHub. This resource does not actually *create* any repositories. ~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing team permission modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. -This resource is non-authoritative, for managing ALL collaborators of a repo, use github_repository_collaborators -instead. +This resource is non-authoritative, for managing ALL collaborators of a repo, use github_repository_collaborators instead. ## Example Usage -```hcl +```terraform # Add a repository to the team resource "github_team" "some_team" { name = "SomeTeam" @@ -49,17 +42,15 @@ resource "github_team_repository" "some_team_repo" { The following arguments are supported: -* `team_id` - (Required) The GitHub team id or the GitHub team slug -* `repository` - (Required) The repository to add to the team. -* `permission` - (Optional) The permissions of team members regarding the repository. - Must be one of `pull`, `triage`, `push`, `maintain`, `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organisation. Defaults to `pull`. - +- `team_id` - (Required) The GitHub team id or the GitHub team slug +- `repository` - (Required) The repository to add to the team. +- `permission` - (Optional) The permissions of team members regarding the repository. Must be one of `pull`, `triage`, `push`, `maintain`, `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organisation. Defaults to `pull`. ## Import GitHub Team Repository can be imported using an ID made up of `team_id:repository` or `team_name:repository`, e.g. -``` +```hcl $ terraform import github_team_repository.terraform_repo 1234567:terraform $ terraform import github_team_repository.terraform_repo Administrators:terraform ``` diff --git a/website/docs/r/team_settings.html.markdown b/docs/resources/team_settings.md similarity index 92% rename from website/docs/r/team_settings.html.markdown rename to docs/resources/team_settings.md index c09d8ad051..39a7bc0dd8 100644 --- a/website/docs/r/team_settings.html.markdown +++ b/docs/resources/team_settings.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_team_settings" +page_title: "github_team_settings (Resource) - GitHub" description: |- Manages the team settings (in particular the request review delegation settings) --- -# github_team_settings +# github_team_settings (Resource) This resource manages the team settings (in particular the request review delegation settings) within the organization @@ -19,7 +18,8 @@ The team must both belong to the same organization configured in the provider on ### Notify without delegation -```hcl +```terraform +# Add a repository to the team resource "github_team" "some_team" { name = "SomeTeam" description = "Some cool team" @@ -27,13 +27,17 @@ resource "github_team" "some_team" { resource "github_team_settings" "code_review_settings" { team_id = github_team.some_team.id - notify = true + review_request_delegation { + algorithm = "ROUND_ROBIN" + member_count = 1 + notify = true + } } ``` ### Notify with delegation -```hcl +```terraform resource "github_team" "some_team" { name = "SomeTeam" description = "Some cool team" @@ -76,12 +80,12 @@ The following additional attributes are exported: GitHub Teams can be imported using the GitHub team ID, or the team slug e.g. -```text +```hcl terraform import github_team_settings.code_review_settings 1234567 ``` or, -```text +```hcl terraform import github_team_settings.code_review_settings SomeTeam ``` diff --git a/website/docs/r/team_sync_group_mapping.html.markdown b/docs/resources/team_sync_group_mapping.md similarity index 55% rename from website/docs/r/team_sync_group_mapping.html.markdown rename to docs/resources/team_sync_group_mapping.md index 09e472616f..782e7762de 100644 --- a/website/docs/r/team_sync_group_mapping.html.markdown +++ b/docs/resources/team_sync_group_mapping.md @@ -1,26 +1,22 @@ --- -layout: "github" -page_title: "GitHub: github_team_sync_group_mapping" +page_title: "github_team_sync_group_mapping (Resource) - GitHub" description: |- Creates and manages the connections between a team and its IdP group(s). --- -# github_team_sync_group_mapping +# github_team_sync_group_mapping (Resource) -This resource allows you to create and manage Identity Provider (IdP) group connections within your GitHub teams. -You must have team synchronization enabled for organizations owned by enterprise accounts. +This resource allows you to create and manage Identity Provider (IdP) group connections within your GitHub teams. You must have team synchronization enabled for organizations owned by enterprise accounts. -To learn more about team synchronization between IdPs and GitHub, please refer to: -https://help.github.com/en/github/setting-up-and-managing-organizations-and-teams/synchronizing-teams-between-your-identity-provider-and-github +To learn more about team synchronization between IdPs and GitHub, please refer to: ## Example Usage -```hcl - +```terraform data "github_organization_team_sync_groups" "example_groups" {} resource "github_team_sync_group_mapping" "example_group_mapping" { - team_slug = "example" + team_slug = "example" dynamic "group" { for_each = [for g in data.github_organization_team_sync_groups.example_groups.groups : g if g.group_name == "some_team_group"] @@ -37,22 +33,23 @@ resource "github_team_sync_group_mapping" "example_group_mapping" { The following arguments are supported: -* `team_slug` - (Required) Slug of the team -* `group` - (Required) An Array of GitHub Identity Provider Groups (or empty []). Each `group` block consists of the fields documented below. -___ +- `team_slug` - (Required) Slug of the team +- `group` - (Required) An Array of GitHub Identity Provider Groups (or empty []). Each `group` block consists of the fields documented below. + +--- The `group` block consists of: -* `group_id` - The ID of the IdP group. +- `group_id` - The ID of the IdP group. -* `group_name` - The name of the IdP group. +- `group_name` - The name of the IdP group. -* `group_description` - The description of the IdP group. +- `group_description` - The description of the IdP group. ## Import GitHub Team Sync Group Mappings can be imported using the GitHub team `slug` e.g. -``` +```hcl $ terraform import github_team_sync_group_mapping.example some_team ``` diff --git a/website/docs/r/user_gpg_key.html.markdown b/docs/resources/user_gpg_key.md similarity index 51% rename from website/docs/r/user_gpg_key.html.markdown rename to docs/resources/user_gpg_key.md index b1979b0e19..9ba050535d 100644 --- a/website/docs/r/user_gpg_key.html.markdown +++ b/docs/resources/user_gpg_key.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_user_gpg_key" +page_title: "github_user_gpg_key (Resource) - GitHub" description: |- Provides a GitHub user's GPG key resource. --- -# github_user_gpg_key +# github_user_gpg_key (Resource) Provides a GitHub user's GPG key resource. @@ -13,7 +12,7 @@ This resource allows you to add/remove GPG keys from your user account. ## Example Usage -```hcl +```terraform resource "github_user_gpg_key" "example" { armored_public_key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n...\n-----END PGP PUBLIC KEY BLOCK-----" } @@ -23,17 +22,15 @@ resource "github_user_gpg_key" "example" { The following arguments are supported: -* `armored_public_key` - (Required) Your public GPG key, generated in ASCII-armored format. - See [Generating a new GPG key](https://help.github.com/articles/generating-a-new-gpg-key/) for help on creating a GPG key. +- `armored_public_key` - (Required) Your public GPG key, generated in ASCII-armored format. See [Generating a new GPG key](https://help.github.com/articles/generating-a-new-gpg-key/) for help on creating a GPG key. ## Attributes Reference The following attributes are exported: -* `id` - The GitHub ID of the GPG key, e.g. `401586` -* `key_id` - The key ID of the GPG key, e.g. `3262EFF25BA0D270` +- `id` - The GitHub ID of the GPG key, e.g. `401586` +- `key_id` - The key ID of the GPG key, e.g. `3262EFF25BA0D270` ## Import -GPG keys are not importable due to the fact that [API](https://developer.github.com/v3/users/gpg_keys/#gpg-keys) -does not return previously uploaded GPG key. +GPG keys are not importable due to the fact that [API](https://developer.github.com/v3/users/gpg_keys/#gpg-keys) does not return previously uploaded GPG key. diff --git a/website/docs/r/user_invitation_accepter.html.markdown b/docs/resources/user_invitation_accepter.md similarity index 68% rename from website/docs/r/user_invitation_accepter.html.markdown rename to docs/resources/user_invitation_accepter.md index e4771a1b49..4dba21bd26 100644 --- a/website/docs/r/user_invitation_accepter.html.markdown +++ b/docs/resources/user_invitation_accepter.md @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "GitHub: github_user_invitation_accepter" +page_title: "github_user_invitation_accepter (Resource) - GitHub" description: |- Provides a resource to manage GitHub repository collaborator invitations. --- -# github_user_invitation_accepter +# github_user_invitation_accepter (Resource) Provides a resource to manage GitHub repository collaborator invitations. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "example-repo" } @@ -37,11 +36,9 @@ resource "github_user_invitation_accepter" "example" { Set `allow_empty_id` when using `for_each` over a list of `github_repository_collaborator.invitation_id`'s. -This allows applying a module again when a new `github_repository_collaborator` resource is added to the `for_each` loop. -This is needed as the `github_repository_collaborator.invitation_id` will be empty after a state refresh when the invitation has been accepted. +This allows applying a module again when a new `github_repository_collaborator` resource is added to the `for_each` loop. This is needed as the `github_repository_collaborator.invitation_id` will be empty after a state refresh when the invitation has been accepted. -Note that when an invitation is accepted manually or by another tool between a state refresh and a `terraform apply` using that refreshed state, -the plan will contain the invitation ID, but the apply will receive an HTTP 404 from the API since the invitation has already been accepted. +Note that when an invitation is accepted manually or by another tool between a state refresh and a `terraform apply` using that refreshed state, the plan will contain the invitation ID, but the apply will receive an HTTP 404 from the API since the invitation has already been accepted. This is tracked in [#1157](https://github.com/integrations/terraform-provider-github/issues/1157). @@ -49,5 +46,5 @@ This is tracked in [#1157](https://github.com/integrations/terraform-provider-gi The following arguments are supported: -* `invitation_id` - (Optional) ID of the invitation to accept. Must be set when `allow_empty_id` is `false`. -* `allow_empty_id` - (Optional) Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error. +- `invitation_id` - (Optional) ID of the invitation to accept. Must be set when `allow_empty_id` is `false`. +- `allow_empty_id` - (Optional) Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error. diff --git a/website/docs/r/user_ssh_key.html.markdown b/docs/resources/user_ssh_key.md similarity index 67% rename from website/docs/r/user_ssh_key.html.markdown rename to docs/resources/user_ssh_key.md index 3827182bd1..ec27405986 100644 --- a/website/docs/r/user_ssh_key.html.markdown +++ b/docs/resources/user_ssh_key.md @@ -1,11 +1,10 @@ --- -layout: "github" -page_title: "GitHub: github_user_ssh_key" +page_title: "github_user_ssh_key (Resource) - GitHub" description: |- Provides a GitHub user's SSH key resource. --- -# github_user_ssh_key +# github_user_ssh_key (Resource) Provides a GitHub user's SSH key resource. @@ -13,7 +12,7 @@ This resource allows you to add/remove SSH keys from your user account. ## Example Usage -```hcl +```terraform resource "github_user_ssh_key" "example" { title = "example title" key = file("~/.ssh/id_rsa.pub") @@ -24,20 +23,20 @@ resource "github_user_ssh_key" "example" { The following arguments are supported: -* `title` - (Required) A descriptive name for the new key. e.g. `Personal MacBook Air` -* `key` - (Required) The public SSH key to add to your GitHub account. +- `title` - (Required) A descriptive name for the new key. e.g. `Personal MacBook Air` +- `key` - (Required) The public SSH key to add to your GitHub account. ## Attributes Reference The following attributes are exported: -* `id` - The ID of the SSH key -* `url` - The URL of the SSH key +- `id` - The ID of the SSH key +- `url` - The URL of the SSH key ## Import SSH keys can be imported using their ID e.g. -``` +```hcl $ terraform import github_user_ssh_key.example 1234567 ``` diff --git a/website/docs/r/workflow_repository_permissions.html.markdown b/docs/resources/workflow_repository_permissions.md similarity index 51% rename from website/docs/r/workflow_repository_permissions.html.markdown rename to docs/resources/workflow_repository_permissions.md index 9ea5d95215..cf2d74e4ce 100644 --- a/website/docs/r/workflow_repository_permissions.html.markdown +++ b/docs/resources/workflow_repository_permissions.md @@ -1,26 +1,24 @@ --- -layout: "github" -page_title: "GitHub: github_workflow_repository_permissions" +page_title: "github_workflow_repository_permissions (Resource) - GitHub" description: |- Enables and manages Workflow permissions for a GitHub repository --- -# github_workflow_repository_permissions +# github_workflow_repository_permissions (Resource) -This resource allows you to manage GitHub Workflow permissions for a given repository. -You must have admin access to a repository to use this resource. +This resource allows you to manage GitHub Workflow permissions for a given repository. You must have admin access to a repository to use this resource. ## Example Usage -```hcl +```terraform resource "github_repository" "example" { name = "my-repository" } resource "github_workflow_repository_permissions" "test" { - default_workflow_permissions = "read" + default_workflow_permissions = "read" can_approve_pull_request_reviews = true - repository = github_repository.example.name + repository = github_repository.example.name } ``` @@ -28,14 +26,14 @@ resource "github_workflow_repository_permissions" "test" { The following arguments are supported: -* `repository` - (Required) The GitHub repository -* `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of: `read` or `write`. -* `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull requests. Enabling this can be a security risk. +- `repository` - (Required) The GitHub repository +- `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of: `read` or `write`. +- `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull requests. Enabling this can be a security risk. ## Import This resource can be imported using the name of the GitHub repository: -``` +```hcl $ terraform import github_workflow_repository_permissions.test my-repository ``` diff --git a/examples/README.md b/examples/README.md index 36e59a9c45..01adc0cf12 100644 --- a/examples/README.md +++ b/examples/README.md @@ -9,7 +9,7 @@ the example's own directory. For example: -``` +```text $ git clone https://github.com/integrations/terraform-provider-github $ cd terraform-provider-github/examples/repository_collaborator $ terraform init diff --git a/examples/data-sources/actions_environment_public_key/example_1.tf b/examples/data-sources/actions_environment_public_key/example_1.tf new file mode 100644 index 0000000000..7678f03eb7 --- /dev/null +++ b/examples/data-sources/actions_environment_public_key/example_1.tf @@ -0,0 +1,4 @@ +data "github_actions_environment_public_key" "example" { + repository = "example_repo" + environment = "example_environment" +} diff --git a/examples/data-sources/actions_environment_secrets/example_1.tf b/examples/data-sources/actions_environment_secrets/example_1.tf new file mode 100644 index 0000000000..cbde88c0c6 --- /dev/null +++ b/examples/data-sources/actions_environment_secrets/example_1.tf @@ -0,0 +1,4 @@ +data "github_actions_environment_secrets" "example" { + name = "exampleRepo" + environment = "exampleEnvironment" +} diff --git a/examples/data-sources/actions_environment_variables/example_1.tf b/examples/data-sources/actions_environment_variables/example_1.tf new file mode 100644 index 0000000000..cde6faf77f --- /dev/null +++ b/examples/data-sources/actions_environment_variables/example_1.tf @@ -0,0 +1,4 @@ +data "github_actions_environment_variables" "example" { + name = "exampleRepo" + environment = "exampleEnvironment" +} diff --git a/examples/data-sources/actions_organization_oidc_subject_claim_customization_template/example_1.tf b/examples/data-sources/actions_organization_oidc_subject_claim_customization_template/example_1.tf new file mode 100644 index 0000000000..be5ecb9002 --- /dev/null +++ b/examples/data-sources/actions_organization_oidc_subject_claim_customization_template/example_1.tf @@ -0,0 +1,2 @@ +data "github_actions_organization_oidc_subject_claim_customization_template" "example" { +} diff --git a/examples/data-sources/actions_organization_public_key/example_1.tf b/examples/data-sources/actions_organization_public_key/example_1.tf new file mode 100644 index 0000000000..cb13e7930a --- /dev/null +++ b/examples/data-sources/actions_organization_public_key/example_1.tf @@ -0,0 +1 @@ +data "github_actions_organization_public_key" "example" {} diff --git a/examples/data-sources/actions_organization_registration_token/example_1.tf b/examples/data-sources/actions_organization_registration_token/example_1.tf new file mode 100644 index 0000000000..bb6c6edd2e --- /dev/null +++ b/examples/data-sources/actions_organization_registration_token/example_1.tf @@ -0,0 +1,2 @@ +data "github_actions_organization_registration_token" "example" { +} diff --git a/examples/data-sources/actions_organization_secrets/example_1.tf b/examples/data-sources/actions_organization_secrets/example_1.tf new file mode 100644 index 0000000000..e9bf52a4f8 --- /dev/null +++ b/examples/data-sources/actions_organization_secrets/example_1.tf @@ -0,0 +1,2 @@ +data "github_actions_organization_secrets" "example" { +} diff --git a/examples/data-sources/actions_organization_variables/example_1.tf b/examples/data-sources/actions_organization_variables/example_1.tf new file mode 100644 index 0000000000..81c954e460 --- /dev/null +++ b/examples/data-sources/actions_organization_variables/example_1.tf @@ -0,0 +1,2 @@ +data "github_actions_organization_variables" "example" { +} diff --git a/examples/data-sources/actions_public_key/example_1.tf b/examples/data-sources/actions_public_key/example_1.tf new file mode 100644 index 0000000000..6ebd23a389 --- /dev/null +++ b/examples/data-sources/actions_public_key/example_1.tf @@ -0,0 +1,3 @@ +data "github_actions_public_key" "example" { + repository = "example_repo" +} diff --git a/examples/data-sources/actions_registration_token/example_1.tf b/examples/data-sources/actions_registration_token/example_1.tf new file mode 100644 index 0000000000..0ad6656fe1 --- /dev/null +++ b/examples/data-sources/actions_registration_token/example_1.tf @@ -0,0 +1,3 @@ +data "github_actions_registration_token" "example" { + repository = "example_repo" +} diff --git a/examples/data-sources/actions_repository_oidc_subject_claim_customization_template/example_1.tf b/examples/data-sources/actions_repository_oidc_subject_claim_customization_template/example_1.tf new file mode 100644 index 0000000000..bc94f6bba2 --- /dev/null +++ b/examples/data-sources/actions_repository_oidc_subject_claim_customization_template/example_1.tf @@ -0,0 +1,3 @@ +data "github_actions_repository_oidc_subject_claim_customization_template" "example" { + name = "example_repository" +} diff --git a/examples/data-sources/actions_secrets/example_1.tf b/examples/data-sources/actions_secrets/example_1.tf new file mode 100644 index 0000000000..89c4036f2a --- /dev/null +++ b/examples/data-sources/actions_secrets/example_1.tf @@ -0,0 +1,3 @@ +data "github_actions_secrets" "example" { + name = "example" +} diff --git a/examples/data-sources/actions_variables/example_1.tf b/examples/data-sources/actions_variables/example_1.tf new file mode 100644 index 0000000000..e6a62d67c3 --- /dev/null +++ b/examples/data-sources/actions_variables/example_1.tf @@ -0,0 +1,3 @@ +data "github_actions_variables" "example" { + name = "example" +} diff --git a/examples/data-sources/app/example_1.tf b/examples/data-sources/app/example_1.tf new file mode 100644 index 0000000000..e6dd3e0a51 --- /dev/null +++ b/examples/data-sources/app/example_1.tf @@ -0,0 +1,3 @@ +data "github_app" "foobar" { + slug = "foobar" +} diff --git a/examples/data-sources/app_token/example_1.tf b/examples/data-sources/app_token/example_1.tf new file mode 100644 index 0000000000..2d578f3876 --- /dev/null +++ b/examples/data-sources/app_token/example_1.tf @@ -0,0 +1,5 @@ +data "github_app_token" "this" { + app_id = "123456" + installation_id = "78910" + pem_file = file("foo/bar.pem") +} diff --git a/examples/data-sources/branch/example_1.tf b/examples/data-sources/branch/example_1.tf new file mode 100644 index 0000000000..e78991a304 --- /dev/null +++ b/examples/data-sources/branch/example_1.tf @@ -0,0 +1,4 @@ +data "github_branch" "development" { + repository = "example" + branch = "development" +} diff --git a/examples/data-sources/branch_protection_rules/example_1.tf b/examples/data-sources/branch_protection_rules/example_1.tf new file mode 100644 index 0000000000..f829069632 --- /dev/null +++ b/examples/data-sources/branch_protection_rules/example_1.tf @@ -0,0 +1,3 @@ +data "github_branch_protection_rules" "example" { + repository = "example" +} diff --git a/examples/data-sources/codespaces_organization_public_key/example_1.tf b/examples/data-sources/codespaces_organization_public_key/example_1.tf new file mode 100644 index 0000000000..3fc45d0858 --- /dev/null +++ b/examples/data-sources/codespaces_organization_public_key/example_1.tf @@ -0,0 +1 @@ +data "github_codespaces_organization_public_key" "example" {} diff --git a/examples/data-sources/codespaces_organization_secrets/example_1.tf b/examples/data-sources/codespaces_organization_secrets/example_1.tf new file mode 100644 index 0000000000..a1cdf2742e --- /dev/null +++ b/examples/data-sources/codespaces_organization_secrets/example_1.tf @@ -0,0 +1,2 @@ +data "github_codespaces_organization_secrets" "example" { +} diff --git a/examples/data-sources/codespaces_public_key/example_1.tf b/examples/data-sources/codespaces_public_key/example_1.tf new file mode 100644 index 0000000000..4e40e874e6 --- /dev/null +++ b/examples/data-sources/codespaces_public_key/example_1.tf @@ -0,0 +1,3 @@ +data "github_codespaces_public_key" "example" { + repository = "example_repo" +} diff --git a/examples/data-sources/codespaces_secrets/example_1.tf b/examples/data-sources/codespaces_secrets/example_1.tf new file mode 100644 index 0000000000..c00b20454d --- /dev/null +++ b/examples/data-sources/codespaces_secrets/example_1.tf @@ -0,0 +1,7 @@ +data "github_codespaces_secrets" "example" { + name = "example_repository" +} + +data "github_codespaces_secrets" "example_2" { + full_name = "org/example_repository" +} diff --git a/examples/data-sources/codespaces_user_public_key/example_1.tf b/examples/data-sources/codespaces_user_public_key/example_1.tf new file mode 100644 index 0000000000..f2c40f1862 --- /dev/null +++ b/examples/data-sources/codespaces_user_public_key/example_1.tf @@ -0,0 +1 @@ +data "github_codespaces_user_public_key" "example" {} diff --git a/examples/data-sources/codespaces_user_secrets/example_1.tf b/examples/data-sources/codespaces_user_secrets/example_1.tf new file mode 100644 index 0000000000..9daa1908c1 --- /dev/null +++ b/examples/data-sources/codespaces_user_secrets/example_1.tf @@ -0,0 +1,2 @@ +data "github_codespaces_user_secrets" "example" { +} diff --git a/examples/data-sources/collaborators/example_1.tf b/examples/data-sources/collaborators/example_1.tf new file mode 100644 index 0000000000..cb25f12da8 --- /dev/null +++ b/examples/data-sources/collaborators/example_1.tf @@ -0,0 +1,4 @@ +data "github_collaborators" "test" { + owner = "example_owner" + repository = "example_repository" +} diff --git a/examples/data-sources/dependabot_organization_public_key/example_1.tf b/examples/data-sources/dependabot_organization_public_key/example_1.tf new file mode 100644 index 0000000000..52373c44d8 --- /dev/null +++ b/examples/data-sources/dependabot_organization_public_key/example_1.tf @@ -0,0 +1 @@ +data "github_dependabot_organization_public_key" "example" {} diff --git a/examples/data-sources/dependabot_organization_secrets/example_1.tf b/examples/data-sources/dependabot_organization_secrets/example_1.tf new file mode 100644 index 0000000000..4f92aec63d --- /dev/null +++ b/examples/data-sources/dependabot_organization_secrets/example_1.tf @@ -0,0 +1,2 @@ +data "github_dependabot_organization_secrets" "example" { +} diff --git a/examples/data-sources/dependabot_public_key/example_1.tf b/examples/data-sources/dependabot_public_key/example_1.tf new file mode 100644 index 0000000000..b650d702ab --- /dev/null +++ b/examples/data-sources/dependabot_public_key/example_1.tf @@ -0,0 +1,3 @@ +data "github_dependabot_public_key" "example" { + repository = "example_repo" +} diff --git a/examples/data-sources/dependabot_secrets/example_1.tf b/examples/data-sources/dependabot_secrets/example_1.tf new file mode 100644 index 0000000000..eef8dbc22d --- /dev/null +++ b/examples/data-sources/dependabot_secrets/example_1.tf @@ -0,0 +1,3 @@ +data "github_dependabot_secrets" "example" { + name = "example" +} diff --git a/examples/data-sources/external_groups/example_1.tf b/examples/data-sources/external_groups/example_1.tf new file mode 100644 index 0000000000..6c0f3976c1 --- /dev/null +++ b/examples/data-sources/external_groups/example_1.tf @@ -0,0 +1,9 @@ +data "github_external_groups" "example_external_groups" {} + +locals { + local_groups = data.github_external_groups.example_external_groups +} + +output "groups" { + value = local.local_groups +} diff --git a/examples/data-sources/ip_ranges/example_1.tf b/examples/data-sources/ip_ranges/example_1.tf new file mode 100644 index 0000000000..c1b4dd4083 --- /dev/null +++ b/examples/data-sources/ip_ranges/example_1.tf @@ -0,0 +1 @@ +data "github_ip_ranges" "test" {} diff --git a/examples/data-sources/issue_labels/example_1.tf b/examples/data-sources/issue_labels/example_1.tf new file mode 100644 index 0000000000..8da56c7def --- /dev/null +++ b/examples/data-sources/issue_labels/example_1.tf @@ -0,0 +1,3 @@ +data "github_labels" "test" { + repository = "example_repository" +} diff --git a/examples/data-sources/membership/example_1.tf b/examples/data-sources/membership/example_1.tf new file mode 100644 index 0000000000..aaeeb72bdf --- /dev/null +++ b/examples/data-sources/membership/example_1.tf @@ -0,0 +1,3 @@ +data "github_membership" "membership_for_some_user" { + username = "SomeUser" +} diff --git a/examples/data-sources/organization/example_1.tf b/examples/data-sources/organization/example_1.tf new file mode 100644 index 0000000000..8c59e7f212 --- /dev/null +++ b/examples/data-sources/organization/example_1.tf @@ -0,0 +1,3 @@ +data "github_organization" "example" { + name = "github" +} diff --git a/examples/data-sources/organization_app_installations/example_1.tf b/examples/data-sources/organization_app_installations/example_1.tf new file mode 100644 index 0000000000..8879ac2315 --- /dev/null +++ b/examples/data-sources/organization_app_installations/example_1.tf @@ -0,0 +1 @@ +data "github_organization_app_installations" "all" {} diff --git a/examples/data-sources/organization_custom_properties/example_1.tf b/examples/data-sources/organization_custom_properties/example_1.tf new file mode 100644 index 0000000000..5bda02686d --- /dev/null +++ b/examples/data-sources/organization_custom_properties/example_1.tf @@ -0,0 +1,3 @@ +data "github_organization_custom_properties" "environment" { + property_name = "environment" +} diff --git a/examples/data-sources/organization_custom_role/example_1.tf b/examples/data-sources/organization_custom_role/example_1.tf new file mode 100644 index 0000000000..469a9d2f16 --- /dev/null +++ b/examples/data-sources/organization_custom_role/example_1.tf @@ -0,0 +1,3 @@ +data "github_organization_custom_role" "example" { + name = "example" +} diff --git a/examples/data-sources/organization_external_identities/example_1.tf b/examples/data-sources/organization_external_identities/example_1.tf new file mode 100644 index 0000000000..3111709a63 --- /dev/null +++ b/examples/data-sources/organization_external_identities/example_1.tf @@ -0,0 +1 @@ +data "github_organization_external_identities" "all" {} diff --git a/examples/data-sources/organization_ip_allow_list/example_1.tf b/examples/data-sources/organization_ip_allow_list/example_1.tf new file mode 100644 index 0000000000..b86d8115a0 --- /dev/null +++ b/examples/data-sources/organization_ip_allow_list/example_1.tf @@ -0,0 +1 @@ +data "github_organization_ip_allow_list" "all" {} diff --git a/examples/data-sources/organization_repository_role/example_1.tf b/examples/data-sources/organization_repository_role/example_1.tf new file mode 100644 index 0000000000..52b359b824 --- /dev/null +++ b/examples/data-sources/organization_repository_role/example_1.tf @@ -0,0 +1,3 @@ +data "github_organization_repository_role" "example" { + role_id = 1234 +} diff --git a/examples/data-sources/organization_repository_roles/example_1.tf b/examples/data-sources/organization_repository_roles/example_1.tf new file mode 100644 index 0000000000..83ac79284c --- /dev/null +++ b/examples/data-sources/organization_repository_roles/example_1.tf @@ -0,0 +1,2 @@ +data "github_organization_repository_roles" "example" { +} diff --git a/examples/data-sources/organization_role/example_1.tf b/examples/data-sources/organization_role/example_1.tf new file mode 100644 index 0000000000..b747f2df0d --- /dev/null +++ b/examples/data-sources/organization_role/example_1.tf @@ -0,0 +1,3 @@ +data "github_organization_role" "example" { + role_id = 1234 +} diff --git a/examples/data-sources/organization_role_teams/example_1.tf b/examples/data-sources/organization_role_teams/example_1.tf new file mode 100644 index 0000000000..23721f4648 --- /dev/null +++ b/examples/data-sources/organization_role_teams/example_1.tf @@ -0,0 +1,3 @@ +data "github_organization_role_teams" "example" { + role_id = 1234 +} diff --git a/examples/data-sources/organization_role_users/example_1.tf b/examples/data-sources/organization_role_users/example_1.tf new file mode 100644 index 0000000000..62e2554343 --- /dev/null +++ b/examples/data-sources/organization_role_users/example_1.tf @@ -0,0 +1,3 @@ +data "github_organization_role_users" "example" { + role_id = 1234 +} diff --git a/examples/data-sources/organization_roles/example_1.tf b/examples/data-sources/organization_roles/example_1.tf new file mode 100644 index 0000000000..ad06a5fd68 --- /dev/null +++ b/examples/data-sources/organization_roles/example_1.tf @@ -0,0 +1,2 @@ +data "github_organization_roles" "example" { +} diff --git a/examples/data-sources/organization_security_managers/example_1.tf b/examples/data-sources/organization_security_managers/example_1.tf new file mode 100644 index 0000000000..a8cb38d5a8 --- /dev/null +++ b/examples/data-sources/organization_security_managers/example_1.tf @@ -0,0 +1 @@ +data "github_organization_security_managers" "test" {} diff --git a/examples/data-sources/organization_team_sync_groups/example_1.tf b/examples/data-sources/organization_team_sync_groups/example_1.tf new file mode 100644 index 0000000000..19c77b153c --- /dev/null +++ b/examples/data-sources/organization_team_sync_groups/example_1.tf @@ -0,0 +1 @@ +data "github_organization_team_sync_groups" "test" {} diff --git a/examples/data-sources/organization_teams/example_1.tf b/examples/data-sources/organization_teams/example_1.tf new file mode 100644 index 0000000000..29688f01f4 --- /dev/null +++ b/examples/data-sources/organization_teams/example_1.tf @@ -0,0 +1 @@ +data "github_organization_teams" "all" {} diff --git a/examples/data-sources/organization_teams/example_2.tf b/examples/data-sources/organization_teams/example_2.tf new file mode 100644 index 0000000000..10ad7ef2c5 --- /dev/null +++ b/examples/data-sources/organization_teams/example_2.tf @@ -0,0 +1,3 @@ +data "github_organization_teams" "root_teams" { + root_teams_only = true +} diff --git a/examples/data-sources/organization_webhooks/example_1.tf b/examples/data-sources/organization_webhooks/example_1.tf new file mode 100644 index 0000000000..89b1a08651 --- /dev/null +++ b/examples/data-sources/organization_webhooks/example_1.tf @@ -0,0 +1 @@ +data "github_organization_webhooks" "all" {} diff --git a/examples/data-sources/ref/example_1.tf b/examples/data-sources/ref/example_1.tf new file mode 100644 index 0000000000..cc0d570d41 --- /dev/null +++ b/examples/data-sources/ref/example_1.tf @@ -0,0 +1,5 @@ +data "github_ref" "development" { + owner = "example" + repository = "example" + ref = "heads/development" +} diff --git a/examples/data-sources/release/example_1.tf b/examples/data-sources/release/example_1.tf new file mode 100644 index 0000000000..48f1b7f6b7 --- /dev/null +++ b/examples/data-sources/release/example_1.tf @@ -0,0 +1,5 @@ +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "latest" +} diff --git a/examples/data-sources/release/example_2.tf b/examples/data-sources/release/example_2.tf new file mode 100644 index 0000000000..22a2088a31 --- /dev/null +++ b/examples/data-sources/release/example_2.tf @@ -0,0 +1,6 @@ +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "id" + id = 12345 +} diff --git a/examples/data-sources/release/example_3.tf b/examples/data-sources/release/example_3.tf new file mode 100644 index 0000000000..832dfb4622 --- /dev/null +++ b/examples/data-sources/release/example_3.tf @@ -0,0 +1,6 @@ +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "tag" + release_tag = "v1.0.0" +} diff --git a/examples/data-sources/release_asset/example_1.tf b/examples/data-sources/release_asset/example_1.tf new file mode 100644 index 0000000000..2b7f90fc0a --- /dev/null +++ b/examples/data-sources/release_asset/example_1.tf @@ -0,0 +1,5 @@ +data "github_release_asset" "example" { + repository = "example-repository" + owner = "example-owner" + asset_id = 12345 +} diff --git a/examples/data-sources/release_asset/example_2.tf b/examples/data-sources/release_asset/example_2.tf new file mode 100644 index 0000000000..d250fa17a7 --- /dev/null +++ b/examples/data-sources/release_asset/example_2.tf @@ -0,0 +1,6 @@ +data "github_release_asset" "example" { + repository = "example-repository" + owner = "example-owner" + asset_id = 12345 + download_file = true +} diff --git a/examples/data-sources/release_asset/example_3.tf b/examples/data-sources/release_asset/example_3.tf new file mode 100644 index 0000000000..3318883e64 --- /dev/null +++ b/examples/data-sources/release_asset/example_3.tf @@ -0,0 +1,11 @@ +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "latest" +} + +data "github_release_asset" "example" { + repository = "example-repository" + owner = "example-owner" + asset_id = data.github_release.example.assets[0].id +} diff --git a/examples/data-sources/release_asset/example_4.tf b/examples/data-sources/release_asset/example_4.tf new file mode 100644 index 0000000000..a327d30be7 --- /dev/null +++ b/examples/data-sources/release_asset/example_4.tf @@ -0,0 +1,12 @@ +data "github_release" "example" { + repository = "example-repository" + owner = "example-owner" + retrieve_by = "latest" +} + +data "github_release_asset" "example" { + count = length(data.github_release.example.assets) + repository = "example-repository" + owner = "example-owner" + asset_id = data.github_release.example.assets[count.index].id +} diff --git a/examples/data-sources/repositories/example_1.tf b/examples/data-sources/repositories/example_1.tf new file mode 100644 index 0000000000..03e246705e --- /dev/null +++ b/examples/data-sources/repositories/example_1.tf @@ -0,0 +1,4 @@ +data "github_repositories" "example" { + query = "org:hashicorp language:Go" + include_repo_id = true +} diff --git a/examples/data-sources/repository/example_1.tf b/examples/data-sources/repository/example_1.tf new file mode 100644 index 0000000000..f1a2db8b84 --- /dev/null +++ b/examples/data-sources/repository/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository" "example" { + full_name = "hashicorp/terraform" +} diff --git a/examples/data-sources/repository_autolink_references/example_1.tf b/examples/data-sources/repository_autolink_references/example_1.tf new file mode 100644 index 0000000000..b2a6b64e6b --- /dev/null +++ b/examples/data-sources/repository_autolink_references/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_autolink_references" "example" { + repository = "example-repository" +} diff --git a/examples/data-sources/repository_branches/example_1.tf b/examples/data-sources/repository_branches/example_1.tf new file mode 100644 index 0000000000..733508faec --- /dev/null +++ b/examples/data-sources/repository_branches/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_branches" "example" { + repository = "example-repository" +} diff --git a/examples/data-sources/repository_custom_properties/example_1.tf b/examples/data-sources/repository_custom_properties/example_1.tf new file mode 100644 index 0000000000..81700d6fb9 --- /dev/null +++ b/examples/data-sources/repository_custom_properties/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_custom_properties" "example" { + repository = "example-repository" +} diff --git a/examples/data-sources/repository_deploy_keys/example_1.tf b/examples/data-sources/repository_deploy_keys/example_1.tf new file mode 100644 index 0000000000..c5c13993df --- /dev/null +++ b/examples/data-sources/repository_deploy_keys/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_deploy_keys" "example" { + repository = "example-repository" +} diff --git a/examples/data-sources/repository_deployment_branch_policies/example_1.tf b/examples/data-sources/repository_deployment_branch_policies/example_1.tf new file mode 100644 index 0000000000..3af736d213 --- /dev/null +++ b/examples/data-sources/repository_deployment_branch_policies/example_1.tf @@ -0,0 +1,4 @@ +data "github_repository_deployment_branch_policies" "example" { + repository = "example-repository" + environment_name = "env_name" +} diff --git a/examples/data-sources/repository_environment_deployment_policies/example_1.tf b/examples/data-sources/repository_environment_deployment_policies/example_1.tf new file mode 100644 index 0000000000..6fcfaecfee --- /dev/null +++ b/examples/data-sources/repository_environment_deployment_policies/example_1.tf @@ -0,0 +1,4 @@ +data "github_repository_environment_deployment_policies" "example" { + repository = "example-repository" + environment = "env-name" +} diff --git a/examples/data-sources/repository_environments/example_1.tf b/examples/data-sources/repository_environments/example_1.tf new file mode 100644 index 0000000000..cd390dbf9a --- /dev/null +++ b/examples/data-sources/repository_environments/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_environments" "example" { + repository = "example-repository" +} diff --git a/examples/data-sources/repository_file/example_1.tf b/examples/data-sources/repository_file/example_1.tf new file mode 100644 index 0000000000..3729961433 --- /dev/null +++ b/examples/data-sources/repository_file/example_1.tf @@ -0,0 +1,6 @@ +data "github_repository_file" "foo" { + repository = github_repository.foo.name + branch = "main" + file = ".gitignore" +} + diff --git a/examples/data-sources/repository_milestone/example_1.tf b/examples/data-sources/repository_milestone/example_1.tf new file mode 100644 index 0000000000..a30c7a14eb --- /dev/null +++ b/examples/data-sources/repository_milestone/example_1.tf @@ -0,0 +1,5 @@ +data "github_repository_milestone" "example" { + owner = "example-owner" + repository = "example-repository" + number = 1 +} diff --git a/examples/data-sources/repository_pages/example_1.tf b/examples/data-sources/repository_pages/example_1.tf new file mode 100644 index 0000000000..62bc9f20e8 --- /dev/null +++ b/examples/data-sources/repository_pages/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_pages" "example" { + repository = "my-repo" +} diff --git a/examples/data-sources/repository_pull_request/example_1.tf b/examples/data-sources/repository_pull_request/example_1.tf new file mode 100644 index 0000000000..4f4d7fc269 --- /dev/null +++ b/examples/data-sources/repository_pull_request/example_1.tf @@ -0,0 +1,4 @@ +data "github_repository_pull_request" "example" { + base_repository = "example_repository" + number = 1 +} diff --git a/examples/data-sources/repository_pull_requests/example_1.tf b/examples/data-sources/repository_pull_requests/example_1.tf new file mode 100644 index 0000000000..aeed51df5a --- /dev/null +++ b/examples/data-sources/repository_pull_requests/example_1.tf @@ -0,0 +1,7 @@ +data "github_repository_pull_requests" "example" { + base_repository = "example-repository" + base_ref = "main" + sort_by = "updated" + sort_direction = "desc" + state = "open" +} diff --git a/examples/data-sources/repository_teams/example_1.tf b/examples/data-sources/repository_teams/example_1.tf new file mode 100644 index 0000000000..f507ba7a3f --- /dev/null +++ b/examples/data-sources/repository_teams/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_teams" "example" { + name = "example" +} diff --git a/examples/data-sources/repository_webhooks/example_1.tf b/examples/data-sources/repository_webhooks/example_1.tf new file mode 100644 index 0000000000..d740a8a02f --- /dev/null +++ b/examples/data-sources/repository_webhooks/example_1.tf @@ -0,0 +1,3 @@ +data "github_repository_webhooks" "repo" { + repository = "foo" +} diff --git a/examples/data-sources/rest_api/example_1.tf b/examples/data-sources/rest_api/example_1.tf new file mode 100644 index 0000000000..c0a2ca49cc --- /dev/null +++ b/examples/data-sources/rest_api/example_1.tf @@ -0,0 +1,3 @@ +data "github_rest_api" "example" { + endpoint = "repos/example_repo/git/refs/heads/main" +} diff --git a/examples/data-sources/ssh_keys/example_1.tf b/examples/data-sources/ssh_keys/example_1.tf new file mode 100644 index 0000000000..72159b2f54 --- /dev/null +++ b/examples/data-sources/ssh_keys/example_1.tf @@ -0,0 +1 @@ +data "github_ssh_keys" "test" {} diff --git a/examples/data-sources/team/example_1.tf b/examples/data-sources/team/example_1.tf new file mode 100644 index 0000000000..9769d1b1e4 --- /dev/null +++ b/examples/data-sources/team/example_1.tf @@ -0,0 +1,3 @@ +data "github_team" "example" { + slug = "example" +} diff --git a/examples/data-sources/tree/example_1.tf b/examples/data-sources/tree/example_1.tf new file mode 100644 index 0000000000..f071612178 --- /dev/null +++ b/examples/data-sources/tree/example_1.tf @@ -0,0 +1,19 @@ +data "github_repository" "this" { + name = "example" +} + +data "github_branch" "this" { + branch = data.github_repository.this.default_branch + repository = data.github_repository.this.name +} + +data "github_tree" "this" { + recursive = false + repository = data.github_repository.this.name + tree_sha = data.github_branch.this.sha +} + +output "entries" { + value = data.github_tree.this.entries +} + diff --git a/examples/data-sources/user/example_1.tf b/examples/data-sources/user/example_1.tf new file mode 100644 index 0000000000..ed02deb62a --- /dev/null +++ b/examples/data-sources/user/example_1.tf @@ -0,0 +1,14 @@ +# Retrieve information about a GitHub user. +data "github_user" "example" { + username = "example" +} + +# Retrieve information about the currently authenticated user. +data "github_user" "current" { + username = "" +} + +output "current_github_login" { + value = data.github_user.current.login +} + diff --git a/examples/data-sources/user_external_identity/example_1.tf b/examples/data-sources/user_external_identity/example_1.tf new file mode 100644 index 0000000000..c4df822cd5 --- /dev/null +++ b/examples/data-sources/user_external_identity/example_1.tf @@ -0,0 +1,3 @@ +data "github_user_external_identity" "example_user" { + username = "example-user" +} diff --git a/examples/data-sources/users/example_1.tf b/examples/data-sources/users/example_1.tf new file mode 100644 index 0000000000..ab3d3faae0 --- /dev/null +++ b/examples/data-sources/users/example_1.tf @@ -0,0 +1,12 @@ +# Retrieve information about multiple GitHub users. +data "github_users" "example" { + usernames = ["example1", "example2", "example3"] +} + +output "valid_users" { + value = data.github_users.example.logins +} + +output "invalid_users" { + value = data.github_users.example.unknown_logins +} diff --git a/examples/enterprise_settings/README.md b/examples/enterprise_settings/README.md index 3a6bd9ae57..7d51a2261d 100644 --- a/examples/enterprise_settings/README.md +++ b/examples/enterprise_settings/README.md @@ -40,7 +40,7 @@ terraform apply # Allow all actions for all organizations resource "github_enterprise_actions_permissions" "basic" { enterprise_slug = "my-enterprise" - + enabled_organizations = "all" allowed_actions = "all" } @@ -48,7 +48,7 @@ resource "github_enterprise_actions_permissions" "basic" { # Use restrictive workflow permissions resource "github_enterprise_actions_workflow_permissions" "basic" { enterprise_slug = "my-enterprise" - + default_workflow_permissions = "read" can_approve_pull_request_reviews = false } @@ -60,10 +60,10 @@ resource "github_enterprise_actions_workflow_permissions" "basic" { # Selective actions and organizations resource "github_enterprise_actions_permissions" "advanced" { enterprise_slug = "my-enterprise" - + enabled_organizations = "selected" allowed_actions = "selected" - + allowed_actions_config { github_owned_allowed = true verified_allowed = true @@ -73,7 +73,7 @@ resource "github_enterprise_actions_permissions" "advanced" { "my-org/custom-action@v1" ] } - + enabled_organizations_config { organization_ids = [123456, 789012] # Replace with actual org IDs } @@ -82,7 +82,7 @@ resource "github_enterprise_actions_permissions" "advanced" { # More permissive workflow settings resource "github_enterprise_actions_workflow_permissions" "advanced" { enterprise_slug = "my-enterprise" - + default_workflow_permissions = "write" can_approve_pull_request_reviews = true } @@ -91,13 +91,16 @@ resource "github_enterprise_actions_workflow_permissions" "advanced" { ## Available Enterprise Resources ### Actions & Workflow Management + - **`github_enterprise_actions_permissions`** - Controls which organizations can use GitHub Actions and which actions are allowed to run - **`github_enterprise_actions_workflow_permissions`** - Manages default GITHUB_TOKEN permissions and whether GitHub Actions can approve pull requests ### Security & Analysis + - **`github_enterprise_security_analysis_settings`** - Manages Advanced Security, secret scanning, and code analysis features for new repositories ### Additional Resources (Available) + - **`github_enterprise_actions_runner_group`** - Manages enterprise-level runner groups for GitHub Actions ## Security Recommendations @@ -167,6 +170,7 @@ terraform import github_enterprise_settings.example my-enterprise ### Verification After applying, verify settings in the GitHub Enterprise dashboard: + 1. Go to your enterprise settings 2. Navigate to "Policies" > "Actions" -3. Check that the configured settings match your Terraform configuration \ No newline at end of file +3. Check that the configured settings match your Terraform configuration diff --git a/examples/enterprise_settings/main.tf b/examples/enterprise_settings/main.tf index 695b47a35d..a7ab7eb095 100644 --- a/examples/enterprise_settings/main.tf +++ b/examples/enterprise_settings/main.tf @@ -25,9 +25,9 @@ variable "enterprise_slug" { # Basic Enterprise Actions Permissions - Allow all actions for all organizations resource "github_enterprise_actions_permissions" "basic" { enterprise_slug = var.enterprise_slug - + enabled_organizations = "all" - allowed_actions = "all" + allowed_actions = "all" } # Basic Enterprise Workflow Permissions - Restrictive settings @@ -41,17 +41,17 @@ resource "github_enterprise_actions_workflow_permissions" "basic" { # Advanced Enterprise Actions Permissions - Selective configuration resource "github_enterprise_actions_permissions" "advanced" { enterprise_slug = var.enterprise_slug - + enabled_organizations = "selected" - allowed_actions = "selected" - + allowed_actions = "selected" + # Configure allowed actions when "selected" policy is used allowed_actions_config { github_owned_allowed = true verified_allowed = true patterns_allowed = [ "actions/cache@*", - "actions/checkout@*", + "actions/checkout@*", "actions/setup-node@*", "actions/setup-python@*", "actions/upload-artifact@*", @@ -59,7 +59,7 @@ resource "github_enterprise_actions_permissions" "advanced" { "my-org/custom-action@v1" ] } - + # Configure enabled organizations when "selected" policy is used enabled_organizations_config { organization_ids = [123456, 789012] # Replace with actual org IDs @@ -77,12 +77,12 @@ resource "github_enterprise_actions_workflow_permissions" "advanced" { # Security Analysis Settings - Enable security features for new repositories resource "github_enterprise_security_analysis_settings" "example" { enterprise_slug = var.enterprise_slug - - advanced_security_enabled_for_new_repositories = true - secret_scanning_enabled_for_new_repositories = true + + advanced_security_enabled_for_new_repositories = true + secret_scanning_enabled_for_new_repositories = true secret_scanning_push_protection_enabled_for_new_repositories = true - secret_scanning_validity_checks_enabled = true - secret_scanning_push_protection_custom_link = "https://octokit.com/security-help" + secret_scanning_validity_checks_enabled = true + secret_scanning_push_protection_custom_link = "https://octokit.com/security-help" } output "basic_enterprise_actions" { @@ -90,7 +90,7 @@ output "basic_enterprise_actions" { value = { enterprise_slug = github_enterprise_actions_permissions.basic.enterprise_slug enabled_organizations = github_enterprise_actions_permissions.basic.enabled_organizations - allowed_actions = github_enterprise_actions_permissions.basic.allowed_actions + allowed_actions = github_enterprise_actions_permissions.basic.allowed_actions } } @@ -108,7 +108,7 @@ output "advanced_enterprise_actions" { value = { enterprise_slug = github_enterprise_actions_permissions.advanced.enterprise_slug enabled_organizations = github_enterprise_actions_permissions.advanced.enabled_organizations - allowed_actions = github_enterprise_actions_permissions.advanced.allowed_actions + allowed_actions = github_enterprise_actions_permissions.advanced.allowed_actions } } diff --git a/examples/example_1.tf b/examples/example_1.tf new file mode 100644 index 0000000000..285894e915 --- /dev/null +++ b/examples/example_1.tf @@ -0,0 +1,16 @@ +terraform { + required_providers { + github = { + source = "integrations/github" + version = "~> 6.0" + } + } +} + +# Configure the GitHub Provider +provider "github" {} + +# Add a user to the organization +resource "github_membership" "membership_for_user_x" { + # ... +} diff --git a/examples/example_2.tf b/examples/example_2.tf new file mode 100644 index 0000000000..247641b8a0 --- /dev/null +++ b/examples/example_2.tf @@ -0,0 +1,9 @@ +# Configure the GitHub Provider +provider "github" { + version = "~> 5.0" +} + +# Add a user to the organization +resource "github_membership" "membership_for_user_x" { + # ... +} diff --git a/examples/example_3.tf b/examples/example_3.tf new file mode 100644 index 0000000000..0e0f42fb61 --- /dev/null +++ b/examples/example_3.tf @@ -0,0 +1,3 @@ +provider "github" { + token = var.token # or `GITHUB_TOKEN` +} diff --git a/examples/example_4.tf b/examples/example_4.tf new file mode 100644 index 0000000000..abf529aae9 --- /dev/null +++ b/examples/example_4.tf @@ -0,0 +1,8 @@ +provider "github" { + owner = var.github_organization + app_auth { + id = var.app_id # or `GITHUB_APP_ID` + installation_id = var.app_installation_id # or `GITHUB_APP_INSTALLATION_ID` + pem_file = var.app_pem_file # or `GITHUB_APP_PEM_FILE` + } +} diff --git a/examples/example_5.tf b/examples/example_5.tf new file mode 100644 index 0000000000..0c3fb2cfd9 --- /dev/null +++ b/examples/example_5.tf @@ -0,0 +1,4 @@ +provider "github" { + owner = var.github_organization + app_auth {} # When using `GITHUB_APP_XXX` environment variables +} diff --git a/examples/hosted_runner/main.tf b/examples/hosted_runner/main.tf index 0f1838cb40..435724ef9b 100644 --- a/examples/hosted_runner/main.tf +++ b/examples/hosted_runner/main.tf @@ -8,9 +8,9 @@ resource "github_actions_runner_group" "example" { # The image ID is numeric, not a string like "ubuntu-latest" resource "github_actions_hosted_runner" "example" { name = "example-hosted-runner" - + image { - id = "2306" # Ubuntu Latest (24.04) - query your org for available IDs + id = "2306" # Ubuntu Latest (24.04) - query your org for available IDs source = "github" } @@ -21,9 +21,9 @@ resource "github_actions_hosted_runner" "example" { # Advanced example with optional parameters resource "github_actions_hosted_runner" "advanced" { name = "advanced-hosted-runner" - + image { - id = "2306" # Ubuntu Latest (24.04) - query your org for available IDs + id = "2306" # Ubuntu Latest (24.04) - query your org for available IDs source = "github" } diff --git a/examples/organization_security_manager/README.md b/examples/organization_security_manager/README.md index 249708bfb6..af07360890 100644 --- a/examples/organization_security_manager/README.md +++ b/examples/organization_security_manager/README.md @@ -3,6 +3,7 @@ This example demonstrates creating an organization security manager team. It will: + - Create a team with the specified `team_name` in the specified `owner` organization - Assign the organization security manager role to the team diff --git a/examples/release/README.md b/examples/release/README.md index 573afe0891..d1ed586225 100644 --- a/examples/release/README.md +++ b/examples/release/README.md @@ -2,7 +2,7 @@ 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. +This example will look up a GitHub release available to the specified `owner` organization or a personal account. See for details on configuring [`providers.tf`](./providers.tf) accordingly. Alternatively, you may use variables passed via command line: @@ -13,6 +13,8 @@ export RELEASE_OWNER= export RELEASE_REPOSITORY= export RELEASE_TAG= ``` + + ```console terraform apply \ -var "organization=${GITHUB_ORG}" \ diff --git a/examples/repository_collaborator/README.md b/examples/repository_collaborator/README.md index 49ff4d3d0e..12c47ae0fe 100644 --- a/examples/repository_collaborator/README.md +++ b/examples/repository_collaborator/README.md @@ -2,7 +2,7 @@ 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. +This example will also create a repository in the specified `owner` organization. See for details on configuring [`providers.tf`](./providers.tf) accordingly. Alternatively, you may use variables passed via command line: diff --git a/examples/repository_delete_branch_on_merge/README.md b/examples/repository_delete_branch_on_merge/README.md index 0d42a2c731..94fbae9559 100644 --- a/examples/repository_delete_branch_on_merge/README.md +++ b/examples/repository_delete_branch_on_merge/README.md @@ -2,7 +2,7 @@ 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. +This example will create a repository in the specified `owner` organization. See for details on configuring [`providers.tf`](./providers.tf) accordingly. Alternatively, you may use variables passed via command line: diff --git a/examples/repository_non_org_owner/README.md b/examples/repository_non_org_owner/README.md index ca2d99bb6b..7000b55a57 100644 --- a/examples/repository_non_org_owner/README.md +++ b/examples/repository_non_org_owner/README.md @@ -2,7 +2,7 @@ This displays repository management for non-organization GitHub accounts. -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. +This example will create a repository in the specified `owner` organization. See for details on configuring [`providers.tf`](./providers.tf) accordingly. Alternatively, you may use variables passed via command line: diff --git a/examples/repository_org_internal/README.md b/examples/repository_org_internal/README.md index 20c5fa91e5..706c58f934 100644 --- a/examples/repository_org_internal/README.md +++ b/examples/repository_org_internal/README.md @@ -2,7 +2,7 @@ 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. +This example will create a repository in the specified `owner` organization. See 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) diff --git a/examples/repository_security_and_analysis/README.md b/examples/repository_security_and_analysis/README.md index 074f68e824..ff74f54de7 100644 --- a/examples/repository_security_and_analysis/README.md +++ b/examples/repository_security_and_analysis/README.md @@ -1,8 +1,8 @@ # Repository Visibility Example -This demos setting `security_and_analysis` for a repository. See https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository for details on what these settings do. +This demos setting `security_and_analysis` for a repository. See for details on what these settings do. -This example will create a repositories in the specified `owner` organization. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly. +This example will create a repositories in the specified `owner` organization. See for details on configuring [`providers.tf`](./providers.tf) accordingly. Alternatively, you may use variables passed via command line: @@ -15,4 +15,4 @@ export GITHUB_TOKEN= terraform apply \ -var "owner=${GITHUB_OWNER}" \ -var "github_token=${GITHUB_TOKEN}" -``` \ No newline at end of file +``` diff --git a/examples/repository_team/README.md b/examples/repository_team/README.md index e81708d4bb..6d9df73fae 100644 --- a/examples/repository_team/README.md +++ b/examples/repository_team/README.md @@ -1,8 +1,8 @@ # Repository Team Example -This demos populating a repository with a team. +This demos populating a repository with a team. -This example will create a repositories in the specified `owner` organization. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly. +This example will create a repositories in the specified `owner` organization. See for details on configuring [`providers.tf`](./providers.tf) accordingly. Alternatively, you may use variables passed via command line: diff --git a/examples/repository_visibility/README.md b/examples/repository_visibility/README.md index 28bfad39b6..b1e5ccbefa 100644 --- a/examples/repository_visibility/README.md +++ b/examples/repository_visibility/README.md @@ -2,7 +2,7 @@ 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 repositories in the specified `owner` organization. See https://www.terraform.io/docs/providers/github/index.html for details on configuring [`providers.tf`](./providers.tf) accordingly. +This example will create a repositories in the specified `owner` organization. See for details on configuring [`providers.tf`](./providers.tf) accordingly. Alternatively, you may use variables passed via command line: diff --git a/examples/resources/actions_environment_secret/example_1.tf b/examples/resources/actions_environment_secret/example_1.tf new file mode 100644 index 0000000000..8b17f7632c --- /dev/null +++ b/examples/resources/actions_environment_secret/example_1.tf @@ -0,0 +1,14 @@ +resource "github_actions_environment_secret" "example_plaintext" { + repository = "example-repo" + environment = "example-environment" + secret_name = "example_secret_name" + plaintext_value = "example-value" +} + +resource "github_actions_environment_secret" "example_encrypted" { + repository = "example-repo" + environment = "example-environment" + secret_name = "example_secret_name" + key_id = var.key_id + encrypted_value = var.encrypted_secret_string +} diff --git a/examples/resources/actions_environment_secret/example_2.tf b/examples/resources/actions_environment_secret/example_2.tf new file mode 100644 index 0000000000..3e0fbb9ec1 --- /dev/null +++ b/examples/resources/actions_environment_secret/example_2.tf @@ -0,0 +1,15 @@ +data "github_repository" "example" { + full_name = "my-org/repo" +} + +resource "github_repository_environment" "example_plaintext" { + repository = data.github_repository.example.name + environment = "example-environment" +} + +resource "github_actions_environment_secret" "example_encrypted" { + repository = data.github_repository.example.name + environment = github_repository_environment.example.environment + secret_name = "test_secret_name" + plaintext_value = "example-value" +} diff --git a/examples/resources/actions_environment_secret/example_3.tf b/examples/resources/actions_environment_secret/example_3.tf new file mode 100644 index 0000000000..a622c1b1b9 --- /dev/null +++ b/examples/resources/actions_environment_secret/example_3.tf @@ -0,0 +1,10 @@ +resource "github_actions_environment_secret" "example_allow_drift" { + repository = "example-repo" + environment = "example-environment" + secret_name = "example_secret_name" + plaintext_value = "placeholder" + + lifecycle { + ignore_changes = [remote_updated_at] + } +} diff --git a/examples/resources/actions_environment_secret/example_4.tf b/examples/resources/actions_environment_secret/example_4.tf new file mode 100644 index 0000000000..d832c9bc01 --- /dev/null +++ b/examples/resources/actions_environment_secret/example_4.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_environment_secret.example + id = "myrepo:myenv:mysecret" +} diff --git a/examples/resources/actions_environment_variable/example_1.tf b/examples/resources/actions_environment_variable/example_1.tf new file mode 100644 index 0000000000..52da906824 --- /dev/null +++ b/examples/resources/actions_environment_variable/example_1.tf @@ -0,0 +1,6 @@ +resource "github_actions_environment_variable" "example" { + repository = "example-repo" + environment = "example-environment" + variable_name = "example_variable_name" + value = "example-value" +} diff --git a/examples/resources/actions_environment_variable/example_2.tf b/examples/resources/actions_environment_variable/example_2.tf new file mode 100644 index 0000000000..bf90f30a5a --- /dev/null +++ b/examples/resources/actions_environment_variable/example_2.tf @@ -0,0 +1,15 @@ +data "github_repository" "example" { + full_name = "my-org/repo" +} + +resource "github_repository_environment" "example" { + repository = data.github_repository.example.name + environment = "example_environment" +} + +resource "github_actions_environment_variable" "example" { + repository = data.github_repository.example.name + environment = github_repository_environment.example.environment + variable_name = "example_variable_name" + value = "example-value" +} diff --git a/examples/resources/actions_environment_variable/example_3.tf b/examples/resources/actions_environment_variable/example_3.tf new file mode 100644 index 0000000000..0677166071 --- /dev/null +++ b/examples/resources/actions_environment_variable/example_3.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_environment_variable.example + id = "myrepo:myenv:myvariable" +} diff --git a/examples/resources/actions_hosted_runner/example_1.tf b/examples/resources/actions_hosted_runner/example_1.tf new file mode 100644 index 0000000000..ef5ae400c3 --- /dev/null +++ b/examples/resources/actions_hosted_runner/example_1.tf @@ -0,0 +1,16 @@ +resource "github_actions_runner_group" "example" { + name = "example-runner-group" + visibility = "all" +} + +resource "github_actions_hosted_runner" "example" { + name = "example-hosted-runner" + + image { + id = "2306" + source = "github" + } + + size = "4-core" + runner_group_id = github_actions_runner_group.example.id +} diff --git a/examples/resources/actions_hosted_runner/example_2.tf b/examples/resources/actions_hosted_runner/example_2.tf new file mode 100644 index 0000000000..ee7e3f69f7 --- /dev/null +++ b/examples/resources/actions_hosted_runner/example_2.tf @@ -0,0 +1,18 @@ +resource "github_actions_runner_group" "advanced" { + name = "advanced-runner-group" + visibility = "selected" +} + +resource "github_actions_hosted_runner" "advanced" { + name = "advanced-hosted-runner" + + image { + id = "2306" + source = "github" + } + + size = "8-core" + runner_group_id = github_actions_runner_group.advanced.id + maximum_runners = 10 + public_ip_enabled = true +} diff --git a/examples/resources/actions_hosted_runner/example_3.tf b/examples/resources/actions_hosted_runner/example_3.tf new file mode 100644 index 0000000000..195b7aeb8c --- /dev/null +++ b/examples/resources/actions_hosted_runner/example_3.tf @@ -0,0 +1,15 @@ +resource "github_actions_hosted_runner" "example" { + name = "example-hosted-runner" + + image { + id = "2306" + source = "github" + } + + size = "4-core" + runner_group_id = github_actions_runner_group.example.id + + timeouts { + delete = "15m" + } +} diff --git a/examples/resources/actions_organization_oidc_subject_claim_customization_template/example_1.tf b/examples/resources/actions_organization_oidc_subject_claim_customization_template/example_1.tf new file mode 100644 index 0000000000..ac86ab0f65 --- /dev/null +++ b/examples/resources/actions_organization_oidc_subject_claim_customization_template/example_1.tf @@ -0,0 +1,3 @@ +resource "github_actions_organization_oidc_subject_claim_customization_template" "example_template" { + include_claim_keys = ["actor", "context", "repository_owner"] +} diff --git a/examples/resources/actions_organization_permissions/example_1.tf b/examples/resources/actions_organization_permissions/example_1.tf new file mode 100644 index 0000000000..fa97dab7c7 --- /dev/null +++ b/examples/resources/actions_organization_permissions/example_1.tf @@ -0,0 +1,16 @@ +resource "github_repository" "example" { + name = "my-repository" +} + +resource "github_actions_organization_permissions" "test" { + allowed_actions = "selected" + enabled_repositories = "selected" + allowed_actions_config { + github_owned_allowed = true + patterns_allowed = ["actions/cache@*", "actions/checkout@*"] + verified_allowed = true + } + enabled_repositories_config { + repository_ids = [github_repository.example.repo_id] + } +} diff --git a/examples/resources/actions_organization_secret/example_1.tf b/examples/resources/actions_organization_secret/example_1.tf new file mode 100644 index 0000000000..2966a7d986 --- /dev/null +++ b/examples/resources/actions_organization_secret/example_1.tf @@ -0,0 +1,11 @@ +resource "github_actions_organization_secret" "example_plaintext" { + secret_name = "example_secret_name" + visibility = "all" + plaintext_value = var.some_secret_string +} + +resource "github_actions_organization_secret" "example_encrypted" { + secret_name = "example_secret_name" + visibility = "all" + encrypted_value = var.some_encrypted_secret_string +} diff --git a/examples/resources/actions_organization_secret/example_2.tf b/examples/resources/actions_organization_secret/example_2.tf new file mode 100644 index 0000000000..f8326d6a10 --- /dev/null +++ b/examples/resources/actions_organization_secret/example_2.tf @@ -0,0 +1,17 @@ +data "github_repository" "repo" { + full_name = "my-org/repo" +} + +resource "github_actions_organization_secret" "example_encrypted" { + secret_name = "example_secret_name" + visibility = "selected" + plaintext_value = var.some_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} + +resource "github_actions_organization_secret" "example_secret" { + secret_name = "example_secret_name" + visibility = "selected" + encrypted_value = var.some_encrypted_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} diff --git a/examples/resources/actions_organization_secret/example_3.tf b/examples/resources/actions_organization_secret/example_3.tf new file mode 100644 index 0000000000..0298d21782 --- /dev/null +++ b/examples/resources/actions_organization_secret/example_3.tf @@ -0,0 +1,9 @@ +resource "github_actions_organization_secret" "example_allow_drift" { + secret_name = "example_secret_name" + visibility = "all" + plaintext_value = "placeholder" + + lifecycle { + ignore_changes = [remote_updated_at] + } +} diff --git a/examples/resources/actions_organization_secret/example_4.tf b/examples/resources/actions_organization_secret/example_4.tf new file mode 100644 index 0000000000..01fbd76ede --- /dev/null +++ b/examples/resources/actions_organization_secret/example_4.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_organization_secret.example + id = "mysecret" +} diff --git a/examples/resources/actions_organization_secret_repositories/example_1.tf b/examples/resources/actions_organization_secret_repositories/example_1.tf new file mode 100644 index 0000000000..8fff9780cc --- /dev/null +++ b/examples/resources/actions_organization_secret_repositories/example_1.tf @@ -0,0 +1,15 @@ +resource "github_actions_organization_secret" "example" { + secret_name = "mysecret" + plaintext_value = "foo" + visibility = "selected" +} + +resource "github_repository" "example" { + name = "myrepo" + visibility = "public" +} + +resource "github_actions_organization_secret_repositories" "example" { + secret_name = github_actions_organization_secret.example.name + selected_repository_ids = [github_repository.example.repo_id] +} diff --git a/examples/resources/actions_organization_secret_repositories/example_2.tf b/examples/resources/actions_organization_secret_repositories/example_2.tf new file mode 100644 index 0000000000..d6159c884e --- /dev/null +++ b/examples/resources/actions_organization_secret_repositories/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_organization_secret_repositories.example + id = "mysecret" +} diff --git a/examples/resources/actions_organization_secret_repository/example_1.tf b/examples/resources/actions_organization_secret_repository/example_1.tf new file mode 100644 index 0000000000..c7a9041937 --- /dev/null +++ b/examples/resources/actions_organization_secret_repository/example_1.tf @@ -0,0 +1,15 @@ +resource "github_actions_organization_secret" "example" { + secret_name = "mysecret" + plaintext_value = "foo" + visibility = "selected" +} + +resource "github_repository" "example" { + name = "myrepo" + visibility = "public" +} + +resource "github_actions_organization_secret_repository" "example" { + secret_name = github_actions_organization_secret.example.name + repository_id = github_repository.example.repo_id +} diff --git a/examples/resources/actions_organization_secret_repository/example_2.tf b/examples/resources/actions_organization_secret_repository/example_2.tf new file mode 100644 index 0000000000..70a81dbfa7 --- /dev/null +++ b/examples/resources/actions_organization_secret_repository/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_organization_secret_repository.example + id = "mysecret:123456" +} diff --git a/examples/resources/actions_organization_variable/example_1.tf b/examples/resources/actions_organization_variable/example_1.tf new file mode 100644 index 0000000000..f6ce615735 --- /dev/null +++ b/examples/resources/actions_organization_variable/example_1.tf @@ -0,0 +1,5 @@ +resource "github_actions_organization_variable" "example_variable" { + variable_name = "example_variable_name" + visibility = "private" + value = "example_variable_value" +} diff --git a/examples/resources/actions_organization_variable/example_2.tf b/examples/resources/actions_organization_variable/example_2.tf new file mode 100644 index 0000000000..cb19a329da --- /dev/null +++ b/examples/resources/actions_organization_variable/example_2.tf @@ -0,0 +1,10 @@ +data "github_repository" "repo" { + full_name = "my-org/repo" +} + +resource "github_actions_organization_variable" "example_variable" { + variable_name = "example_variable_name" + visibility = "selected" + value = "example_variable_value" + selected_repository_ids = [data.github_repository.repo.repo_id] +} diff --git a/examples/resources/actions_organization_variable/example_3.tf b/examples/resources/actions_organization_variable/example_3.tf new file mode 100644 index 0000000000..cb11903e03 --- /dev/null +++ b/examples/resources/actions_organization_variable/example_3.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_organization_variable.example + id = "myvariable" +} diff --git a/examples/resources/actions_organization_variable_repositories/example_1.tf b/examples/resources/actions_organization_variable_repositories/example_1.tf new file mode 100644 index 0000000000..a5d19f1bb4 --- /dev/null +++ b/examples/resources/actions_organization_variable_repositories/example_1.tf @@ -0,0 +1,15 @@ +resource "github_actions_organization_variable" "example" { + variable_name = "myvariable" + plaintext_value = "foo" + visibility = "selected" +} + +resource "github_repository" "example" { + name = "myrepo" + visibility = "public" +} + +resource "github_actions_organization_variable_repositories" "example" { + variable_name = github_actions_organization_variable.example.name + selected_repository_ids = [github_repository.example.repo_id] +} diff --git a/examples/resources/actions_organization_variable_repositories/example_2.tf b/examples/resources/actions_organization_variable_repositories/example_2.tf new file mode 100644 index 0000000000..b5eb3fff4b --- /dev/null +++ b/examples/resources/actions_organization_variable_repositories/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_organization_variable_repositories.example + id = "myvariable" +} diff --git a/examples/resources/actions_organization_variable_repository/example_1.tf b/examples/resources/actions_organization_variable_repository/example_1.tf new file mode 100644 index 0000000000..39531f0597 --- /dev/null +++ b/examples/resources/actions_organization_variable_repository/example_1.tf @@ -0,0 +1,15 @@ +resource "github_actions_organization_variable" "example" { + variable_name = "myvariable" + plaintext_value = "foo" + visibility = "selected" +} + +resource "github_repository" "example" { + name = "myrepo" + visibility = "public" +} + +resource "github_actions_organization_variable_repository" "example" { + variable_name = github_actions_organization_variable.example.name + repository_id = github_repository.example.repo_id +} diff --git a/examples/resources/actions_organization_variable_repository/example_2.tf b/examples/resources/actions_organization_variable_repository/example_2.tf new file mode 100644 index 0000000000..cc1d45ca0c --- /dev/null +++ b/examples/resources/actions_organization_variable_repository/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_organization_variable_repository.example + id = "myvariable:123456" +} diff --git a/examples/resources/actions_organization_workflow_permissions/example_1.tf b/examples/resources/actions_organization_workflow_permissions/example_1.tf new file mode 100644 index 0000000000..db182194ca --- /dev/null +++ b/examples/resources/actions_organization_workflow_permissions/example_1.tf @@ -0,0 +1,15 @@ +# Basic workflow permissions configuration +resource "github_actions_organization_workflow_permissions" "example" { + organization_slug = "my-organization" + + default_workflow_permissions = "read" + can_approve_pull_request_reviews = false +} + +# Allow write permissions and PR approvals +resource "github_actions_organization_workflow_permissions" "permissive" { + organization_slug = "my-organization" + + default_workflow_permissions = "write" + can_approve_pull_request_reviews = true +} diff --git a/examples/resources/actions_repository_access_level/example_1.tf b/examples/resources/actions_repository_access_level/example_1.tf new file mode 100644 index 0000000000..6ea586b92d --- /dev/null +++ b/examples/resources/actions_repository_access_level/example_1.tf @@ -0,0 +1,9 @@ +resource "github_repository" "example" { + name = "my-repository" + visibility = "private" +} + +resource "github_actions_repository_access_level" "test" { + access_level = "user" + repository = github_repository.example.name +} diff --git a/examples/resources/actions_repository_oidc_subject_claim_customization_template/example_1.tf b/examples/resources/actions_repository_oidc_subject_claim_customization_template/example_1.tf new file mode 100644 index 0000000000..6dbbc9b32b --- /dev/null +++ b/examples/resources/actions_repository_oidc_subject_claim_customization_template/example_1.tf @@ -0,0 +1,9 @@ +resource "github_repository" "example" { + name = "example-repository" +} + +resource "github_actions_repository_oidc_subject_claim_customization_template" "example_template" { + repository = github_repository.example.name + use_default = false + include_claim_keys = ["actor", "context", "repository_owner"] +} diff --git a/examples/resources/actions_repository_permissions/example_1.tf b/examples/resources/actions_repository_permissions/example_1.tf new file mode 100644 index 0000000000..f5ca96575f --- /dev/null +++ b/examples/resources/actions_repository_permissions/example_1.tf @@ -0,0 +1,13 @@ +resource "github_repository" "example" { + name = "my-repository" +} + +resource "github_actions_repository_permissions" "test" { + allowed_actions = "selected" + allowed_actions_config { + github_owned_allowed = true + patterns_allowed = ["actions/cache@*", "actions/checkout@*"] + verified_allowed = true + } + repository = github_repository.example.name +} diff --git a/examples/resources/actions_runner_group/example_1.tf b/examples/resources/actions_runner_group/example_1.tf new file mode 100644 index 0000000000..88a1344df2 --- /dev/null +++ b/examples/resources/actions_runner_group/example_1.tf @@ -0,0 +1,9 @@ +resource "github_repository" "example" { + name = "my-repository" +} + +resource "github_actions_runner_group" "example" { + name = github_repository.example.name + visibility = "selected" + selected_repository_ids = [github_repository.example.repo_id] +} diff --git a/examples/resources/actions_secret/example_1.tf b/examples/resources/actions_secret/example_1.tf new file mode 100644 index 0000000000..f9e1d73dcd --- /dev/null +++ b/examples/resources/actions_secret/example_1.tf @@ -0,0 +1,11 @@ +resource "github_actions_secret" "example_plaintext" { + repository = "example_repository" + secret_name = "example_secret_name" + plaintext_value = var.some_secret_string +} + +resource "github_actions_secret" "example_encrypted" { + repository = "example_repository" + secret_name = "example_secret_name" + encrypted_value = var.some_encrypted_secret_string +} diff --git a/examples/resources/actions_secret/example_2.tf b/examples/resources/actions_secret/example_2.tf new file mode 100644 index 0000000000..bc6e77a0a4 --- /dev/null +++ b/examples/resources/actions_secret/example_2.tf @@ -0,0 +1,9 @@ +resource "github_actions_secret" "example_allow_drift" { + repository = "example_repository" + secret_name = "example_secret_name" + plaintext_value = "placeholder" + + lifecycle { + ignore_changes = [remote_updated_at] + } +} diff --git a/examples/resources/actions_secret/example_3.tf b/examples/resources/actions_secret/example_3.tf new file mode 100644 index 0000000000..e3c387a977 --- /dev/null +++ b/examples/resources/actions_secret/example_3.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_secret.example + id = "myrepo:mysecret" +} diff --git a/examples/resources/actions_variable/example_1.tf b/examples/resources/actions_variable/example_1.tf new file mode 100644 index 0000000000..72dfdbb114 --- /dev/null +++ b/examples/resources/actions_variable/example_1.tf @@ -0,0 +1,5 @@ +resource "github_actions_variable" "example_variable" { + repository = "example_repository" + variable_name = "example_variable_name" + value = "example_variable_value" +} diff --git a/examples/resources/actions_variable/example_2.tf b/examples/resources/actions_variable/example_2.tf new file mode 100644 index 0000000000..3446ad0c97 --- /dev/null +++ b/examples/resources/actions_variable/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_actions_variable.example + id = "myrepo:myvariable" +} diff --git a/examples/resources/app_installation_repositories/example_1.tf b/examples/resources/app_installation_repositories/example_1.tf new file mode 100644 index 0000000000..e3d6086038 --- /dev/null +++ b/examples/resources/app_installation_repositories/example_1.tf @@ -0,0 +1,14 @@ +# Create some repositories. +resource "github_repository" "some_repo" { + name = "some-repo" +} + +resource "github_repository" "another_repo" { + name = "another-repo" +} + +resource "github_app_installation_repositories" "some_app_repos" { + # The installation id of the app (in the organization). + installation_id = "1234567" + selected_repositories = [github_repository.some_repo.name, github_repository.another_repo.name] +} diff --git a/examples/resources/app_installation_repository/example_1.tf b/examples/resources/app_installation_repository/example_1.tf new file mode 100644 index 0000000000..c392cc7158 --- /dev/null +++ b/examples/resources/app_installation_repository/example_1.tf @@ -0,0 +1,10 @@ +# Create a repository. +resource "github_repository" "some_repo" { + name = "some-repo" +} + +resource "github_app_installation_repository" "some_app_repo" { + # The installation id of the app (in the organization). + installation_id = "1234567" + repository = github_repository.some_repo.name +} diff --git a/examples/resources/branch/example_1.tf b/examples/resources/branch/example_1.tf new file mode 100644 index 0000000000..d6b2903047 --- /dev/null +++ b/examples/resources/branch/example_1.tf @@ -0,0 +1,4 @@ +resource "github_branch" "development" { + repository = "example" + branch = "development" +} diff --git a/examples/resources/branch_default/example_1.tf b/examples/resources/branch_default/example_1.tf new file mode 100644 index 0000000000..4606efe8ae --- /dev/null +++ b/examples/resources/branch_default/example_1.tf @@ -0,0 +1,15 @@ +resource "github_repository" "example" { + name = "example" + description = "My awesome codebase" + auto_init = true +} + +resource "github_branch" "development" { + repository = github_repository.example.name + branch = "development" +} + +resource "github_branch_default" "default" { + repository = github_repository.example.name + branch = github_branch.development.branch +} diff --git a/examples/resources/branch_default/example_2.tf b/examples/resources/branch_default/example_2.tf new file mode 100644 index 0000000000..3974b93ca7 --- /dev/null +++ b/examples/resources/branch_default/example_2.tf @@ -0,0 +1,11 @@ +resource "github_repository" "example" { + name = "example" + description = "My awesome codebase" + auto_init = true +} + +resource "github_branch_default" "default" { + repository = github_repository.example.name + branch = "development" + rename = true +} diff --git a/examples/resources/branch_protection/example_1.tf b/examples/resources/branch_protection/example_1.tf new file mode 100644 index 0000000000..d1fe8d96ac --- /dev/null +++ b/examples/resources/branch_protection/example_1.tf @@ -0,0 +1,69 @@ +# Protect the main branch of the foo repository. Additionally, require that +# the "ci/travis" context to be passing and only allow the engineers team merge +# to the branch. + +resource "github_branch_protection" "example" { + repository_id = github_repository.example.node_id + # also accepts repository name + # repository_id = github_repository.example.name + + pattern = "main" + enforce_admins = true + allows_deletions = true + + required_status_checks { + strict = false + contexts = ["ci/travis"] + } + + required_pull_request_reviews { + dismiss_stale_reviews = true + restrict_dismissals = true + dismissal_restrictions = [ + data.github_user.example.node_id, + github_team.example.node_id, + "/exampleuser", + "exampleorganization/exampleteam", + ] + } + + restrict_pushes { + push_allowances = [ + data.github_user.example.node_id, + "/exampleuser", + "exampleorganization/exampleteam", + # you can have more than one type of restriction (teams + users). If you use + # more than one type, you must use node_ids of each user and each team. + # github_team.example.node_id + # github_user.example-2.node_id + ] + } + + force_push_bypassers = [ + data.github_user.example.node_id, + "/exampleuser", + "exampleorganization/exampleteam", + # you can have more than one type of restriction (teams + users) + # github_team.example.node_id + # github_team.example-2.node_id + ] + +} + +resource "github_repository" "example" { + name = "test" +} + +data "github_user" "example" { + username = "example" +} + +resource "github_team" "example" { + name = "Example Name" +} + +resource "github_team_repository" "example" { + team_id = github_team.example.id + repository = github_repository.example.name + permission = "pull" +} diff --git a/examples/resources/branch_protection_v3/example_1.tf b/examples/resources/branch_protection_v3/example_1.tf new file mode 100644 index 0000000000..843d3cfba0 --- /dev/null +++ b/examples/resources/branch_protection_v3/example_1.tf @@ -0,0 +1,9 @@ +# Protect the main branch of the foo repository. Only allow a specific user to merge to the branch. +resource "github_branch_protection_v3" "example" { + repository = github_repository.example.name + branch = "main" + + restrictions { + users = ["foo-user"] + } +} diff --git a/examples/resources/branch_protection_v3/example_2.tf b/examples/resources/branch_protection_v3/example_2.tf new file mode 100644 index 0000000000..a8c4710298 --- /dev/null +++ b/examples/resources/branch_protection_v3/example_2.tf @@ -0,0 +1,49 @@ +# Protect the main branch of the foo repository. Additionally, require that +# the "ci/check" check ran by the Github Actions app is passing and only allow +# the engineers team merge to the branch. + +resource "github_branch_protection_v3" "example" { + repository = github_repository.example.name + branch = "main" + enforce_admins = true + + required_status_checks { + strict = false + checks = [ + "ci/check:824642007264" + ] + } + + required_pull_request_reviews { + dismiss_stale_reviews = true + dismissal_users = ["foo-user"] + dismissal_teams = [github_team.example.slug] + dismissal_app = ["foo-app"] + + bypass_pull_request_allowances { + users = ["foo-user"] + teams = [github_team.example.slug] + apps = ["foo-app"] + } + } + + restrictions { + users = ["foo-user"] + teams = [github_team.example.slug] + apps = ["foo-app"] + } +} + +resource "github_repository" "example" { + name = "example" +} + +resource "github_team" "example" { + name = "Example Name" +} + +resource "github_team_repository" "example" { + team_id = github_team.example.id + repository = github_repository.example.name + permission = "pull" +} diff --git a/examples/resources/codespaces_organization_secret/example_1.tf b/examples/resources/codespaces_organization_secret/example_1.tf new file mode 100644 index 0000000000..6b76567b33 --- /dev/null +++ b/examples/resources/codespaces_organization_secret/example_1.tf @@ -0,0 +1,11 @@ +resource "github_codespaces_organization_secret" "example_secret" { + secret_name = "example_secret_name" + visibility = "private" + plaintext_value = var.some_secret_string +} + +resource "github_codespaces_organization_secret" "example_secret" { + secret_name = "example_secret_name" + visibility = "private" + encrypted_value = var.some_encrypted_secret_string +} diff --git a/examples/resources/codespaces_organization_secret/example_2.tf b/examples/resources/codespaces_organization_secret/example_2.tf new file mode 100644 index 0000000000..684cb8cb9e --- /dev/null +++ b/examples/resources/codespaces_organization_secret/example_2.tf @@ -0,0 +1,17 @@ +data "github_repository" "repo" { + full_name = "my-org/repo" +} + +resource "github_codespaces_organization_secret" "example_secret" { + secret_name = "example_secret_name" + visibility = "selected" + plaintext_value = var.some_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} + +resource "github_codespaces_organization_secret" "example_secret" { + secret_name = "example_secret_name" + visibility = "selected" + encrypted_value = var.some_encrypted_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} diff --git a/examples/resources/codespaces_organization_secret_repositories/example_1.tf b/examples/resources/codespaces_organization_secret_repositories/example_1.tf new file mode 100644 index 0000000000..b83685e60b --- /dev/null +++ b/examples/resources/codespaces_organization_secret_repositories/example_1.tf @@ -0,0 +1,8 @@ +data "github_repository" "repo" { + full_name = "my-org/repo" +} + +resource "github_codespaces_organization_secret_repositories" "org_secret_repos" { + secret_name = "existing_secret_name" + selected_repository_ids = [data.github_repository.repo.repo_id] +} diff --git a/examples/resources/codespaces_secret/example_1.tf b/examples/resources/codespaces_secret/example_1.tf new file mode 100644 index 0000000000..59d12cb3df --- /dev/null +++ b/examples/resources/codespaces_secret/example_1.tf @@ -0,0 +1,15 @@ +data "github_codespaces_public_key" "example_public_key" { + repository = "example_repository" +} + +resource "github_codespaces_secret" "example_secret" { + repository = "example_repository" + secret_name = "example_secret_name" + plaintext_value = var.some_secret_string +} + +resource "github_codespaces_secret" "example_secret" { + repository = "example_repository" + secret_name = "example_secret_name" + encrypted_value = var.some_encrypted_secret_string +} diff --git a/examples/resources/codespaces_user_secret/example_1.tf b/examples/resources/codespaces_user_secret/example_1.tf new file mode 100644 index 0000000000..6cefaeec3f --- /dev/null +++ b/examples/resources/codespaces_user_secret/example_1.tf @@ -0,0 +1,15 @@ +data "github_repository" "repo" { + full_name = "my-org/repo" +} + +resource "github_codespaces_user_secret" "example_secret" { + secret_name = "example_secret_name" + plaintext_value = var.some_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} + +resource "github_codespaces_user_secret" "example_secret" { + secret_name = "example_secret_name" + encrypted_value = var.some_encrypted_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} diff --git a/examples/resources/dependabot_organization_secret/example_1.tf b/examples/resources/dependabot_organization_secret/example_1.tf new file mode 100644 index 0000000000..9cc517b0c7 --- /dev/null +++ b/examples/resources/dependabot_organization_secret/example_1.tf @@ -0,0 +1,11 @@ +resource "github_dependabot_organization_secret" "example_plaintext" { + secret_name = "example_secret_name" + visibility = "all" + plaintext_value = var.some_secret_string +} + +resource "github_dependabot_organization_secret" "example_secret" { + secret_name = "example_secret_name" + visibility = "all" + encrypted_value = var.some_encrypted_secret_string +} diff --git a/examples/resources/dependabot_organization_secret/example_2.tf b/examples/resources/dependabot_organization_secret/example_2.tf new file mode 100644 index 0000000000..0007e67124 --- /dev/null +++ b/examples/resources/dependabot_organization_secret/example_2.tf @@ -0,0 +1,17 @@ +data "github_repository" "repo" { + full_name = "my-org/repo" +} + +resource "github_dependabot_organization_secret" "example_plaintext" { + secret_name = "example_secret_name" + visibility = "selected" + plaintext_value = var.some_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} + +resource "github_dependabot_organization_secret" "example_encrypted" { + secret_name = "example_secret_name" + visibility = "selected" + encrypted_value = var.some_encrypted_secret_string + selected_repository_ids = [data.github_repository.repo.repo_id] +} diff --git a/examples/resources/dependabot_organization_secret/example_3.tf b/examples/resources/dependabot_organization_secret/example_3.tf new file mode 100644 index 0000000000..7a5f176641 --- /dev/null +++ b/examples/resources/dependabot_organization_secret/example_3.tf @@ -0,0 +1,9 @@ +resource "github_dependabot_organization_secret" "example_allow_drift" { + secret_name = "example_secret_name" + visibility = "all" + plaintext_value = "placeholder" + + lifecycle { + ignore_changes = [remote_updated_at] + } +} diff --git a/examples/resources/dependabot_organization_secret/example_4.tf b/examples/resources/dependabot_organization_secret/example_4.tf new file mode 100644 index 0000000000..efa9daac70 --- /dev/null +++ b/examples/resources/dependabot_organization_secret/example_4.tf @@ -0,0 +1,4 @@ +import { + to = github_dependabot_organization_secret.example + id = "mysecret" +} diff --git a/examples/resources/dependabot_organization_secret_repositories/example_1.tf b/examples/resources/dependabot_organization_secret_repositories/example_1.tf new file mode 100644 index 0000000000..b56a79c93b --- /dev/null +++ b/examples/resources/dependabot_organization_secret_repositories/example_1.tf @@ -0,0 +1,15 @@ +resource "github_dependabot_organization_secret" "example" { + secret_name = "mysecret" + plaintext_value = "foo" + visibility = "selected" +} + +resource "github_repository" "example" { + name = "myrepo" + visibility = "public" +} + +resource "github_dependabot_organization_secret_repositories" "example" { + secret_name = github_dependabot_organization_secret.example.name + selected_repository_ids = [github_repository.example.repo_id] +} diff --git a/examples/resources/dependabot_organization_secret_repositories/example_2.tf b/examples/resources/dependabot_organization_secret_repositories/example_2.tf new file mode 100644 index 0000000000..aafc2ea494 --- /dev/null +++ b/examples/resources/dependabot_organization_secret_repositories/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_dependabot_organization_secret_repositories.example + id = "mysecret" +} diff --git a/examples/resources/dependabot_organization_secret_repository/example_1.tf b/examples/resources/dependabot_organization_secret_repository/example_1.tf new file mode 100644 index 0000000000..9158520069 --- /dev/null +++ b/examples/resources/dependabot_organization_secret_repository/example_1.tf @@ -0,0 +1,15 @@ +resource "github_dependabot_organization_secret" "example" { + secret_name = "mysecret" + plaintext_value = "foo" + visibility = "selected" +} + +resource "github_repository" "example" { + name = "myrepo" + visibility = "public" +} + +resource "github_dependabot_organization_secret_repository" "example" { + secret_name = github_dependabot_organization_secret.example.name + repository_id = github_repository.example.repo_id +} diff --git a/examples/resources/dependabot_organization_secret_repository/example_2.tf b/examples/resources/dependabot_organization_secret_repository/example_2.tf new file mode 100644 index 0000000000..3171f9f186 --- /dev/null +++ b/examples/resources/dependabot_organization_secret_repository/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_dependabot_organization_secret_repository.example + id = "mysecret:123456" +} diff --git a/examples/resources/dependabot_secret/example_1.tf b/examples/resources/dependabot_secret/example_1.tf new file mode 100644 index 0000000000..3641436753 --- /dev/null +++ b/examples/resources/dependabot_secret/example_1.tf @@ -0,0 +1,11 @@ +resource "github_dependabot_secret" "example_plaintext" { + repository = "example_repository" + secret_name = "example_secret_name" + plaintext_value = var.some_secret_string +} + +resource "github_dependabot_secret" "example_encrypted" { + repository = "example_repository" + secret_name = "example_secret_name" + encrypted_value = var.some_encrypted_secret_string +} diff --git a/examples/resources/dependabot_secret/example_2.tf b/examples/resources/dependabot_secret/example_2.tf new file mode 100644 index 0000000000..7aac3f1e66 --- /dev/null +++ b/examples/resources/dependabot_secret/example_2.tf @@ -0,0 +1,9 @@ +resource "github_dependabot_secret" "example_allow_drift" { + repository = "example_repository" + secret_name = "example_secret_name" + plaintext_value = "placeholder" + + lifecycle { + ignore_changes = [remote_updated_at] + } +} diff --git a/examples/resources/dependabot_secret/example_3.tf b/examples/resources/dependabot_secret/example_3.tf new file mode 100644 index 0000000000..dc5642e41a --- /dev/null +++ b/examples/resources/dependabot_secret/example_3.tf @@ -0,0 +1,4 @@ +import { + to = github_dependabot_secret.example + id = "myrepo:mysecret" +} diff --git a/examples/resources/emu_group_mapping/example_1.tf b/examples/resources/emu_group_mapping/example_1.tf new file mode 100644 index 0000000000..535514a18c --- /dev/null +++ b/examples/resources/emu_group_mapping/example_1.tf @@ -0,0 +1,4 @@ +resource "github_emu_group_mapping" "example_emu_group_mapping" { + team_slug = "emu-test-team" # The GitHub team name to modify + group_id = 28836 # The group ID of the external group to link +} diff --git a/examples/resources/enterprise_actions_permissions/example_1.tf b/examples/resources/enterprise_actions_permissions/example_1.tf new file mode 100644 index 0000000000..1cf49e4907 --- /dev/null +++ b/examples/resources/enterprise_actions_permissions/example_1.tf @@ -0,0 +1,17 @@ +data "github_organization" "example-org" { + name = "my-org" +} + +resource "github_enterprise_actions_permissions" "test" { + enterprise_slug = "my-enterprise" + allowed_actions = "selected" + enabled_organizations = "selected" + allowed_actions_config { + github_owned_allowed = true + patterns_allowed = ["actions/cache@*", "actions/checkout@*"] + verified_allowed = true + } + enabled_organizations_config { + organization_ids = [data.github_organization.example-org.id] + } +} diff --git a/examples/resources/enterprise_actions_runner_group/example_1.tf b/examples/resources/enterprise_actions_runner_group/example_1.tf new file mode 100644 index 0000000000..165dd482d5 --- /dev/null +++ b/examples/resources/enterprise_actions_runner_group/example_1.tf @@ -0,0 +1,20 @@ +data "github_enterprise" "enterprise" { + slug = "my-enterprise" +} + +resource "github_enterprise_organization" "enterprise_organization" { + enterprise_id = data.github_enterprise.enterprise.id + name = "my-organization" + billing_email = "octocat@octo.cat" + admin_logins = ["octocat"] +} + +resource "github_enterprise_actions_runner_group" "example" { + name = "my-awesome-runner-group" + enterprise_slug = data.github_enterprise.enterprise.slug + allows_public_repositories = true + visibility = "selected" + selected_organization_ids = [github_enterprise_organization.enterprise_organization.database_id] + restricted_to_workflows = true + selected_workflows = ["my-organization/my-repo/.github/workflows/cool-workflow.yaml@refs/tags/v1"] +} diff --git a/examples/resources/enterprise_actions_workflow_permissions/example_1.tf b/examples/resources/enterprise_actions_workflow_permissions/example_1.tf new file mode 100644 index 0000000000..5c02e1a18c --- /dev/null +++ b/examples/resources/enterprise_actions_workflow_permissions/example_1.tf @@ -0,0 +1,15 @@ +# Basic workflow permissions configuration +resource "github_enterprise_actions_workflow_permissions" "example" { + enterprise_slug = "my-enterprise" + + default_workflow_permissions = "read" + can_approve_pull_request_reviews = false +} + +# Allow write permissions and PR approvals +resource "github_enterprise_actions_workflow_permissions" "permissive" { + enterprise_slug = "my-enterprise" + + default_workflow_permissions = "write" + can_approve_pull_request_reviews = true +} diff --git a/examples/resources/enterprise_ip_allow_list_entry/example_1.tf b/examples/resources/enterprise_ip_allow_list_entry/example_1.tf new file mode 100644 index 0000000000..8e4b1192ed --- /dev/null +++ b/examples/resources/enterprise_ip_allow_list_entry/example_1.tf @@ -0,0 +1,6 @@ +resource "github_enterprise_ip_allow_list_entry" "test" { + enterprise_slug = "my-enterprise" + ip = "192.168.1.0/20" + name = "My IP Range Name" + is_active = true +} diff --git a/examples/resources/enterprise_security_analysis_settings/example_1.tf b/examples/resources/enterprise_security_analysis_settings/example_1.tf new file mode 100644 index 0000000000..e82f5414a7 --- /dev/null +++ b/examples/resources/enterprise_security_analysis_settings/example_1.tf @@ -0,0 +1,17 @@ +# Basic security settings - enable secret scanning only +resource "github_enterprise_security_analysis_settings" "basic" { + enterprise_slug = "my-enterprise" + + secret_scanning_enabled_for_new_repositories = true +} + +# Full security configuration with all features enabled +resource "github_enterprise_security_analysis_settings" "comprehensive" { + enterprise_slug = "my-enterprise" + + advanced_security_enabled_for_new_repositories = true + secret_scanning_enabled_for_new_repositories = true + secret_scanning_push_protection_enabled_for_new_repositories = true + secret_scanning_validity_checks_enabled = true + secret_scanning_push_protection_custom_link = "https://octokit.com/security-guidelines" +} diff --git a/examples/resources/issue/example_1.tf b/examples/resources/issue/example_1.tf new file mode 100644 index 0000000000..35431162c6 --- /dev/null +++ b/examples/resources/issue/example_1.tf @@ -0,0 +1,12 @@ +# Create a simple issue +resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + has_issues = true +} + +resource "github_issue" "test" { + repository = github_repository.test.name + title = "My issue title" + body = "The body of my issue" +} diff --git a/examples/resources/issue/example_2.tf b/examples/resources/issue/example_2.tf new file mode 100644 index 0000000000..fc4ddcec69 --- /dev/null +++ b/examples/resources/issue/example_2.tf @@ -0,0 +1,24 @@ +# Create an issue with milestone and project assignment +resource "github_repository" "test" { + name = "tf-acc-test-%s" + auto_init = true + has_issues = true +} + +resource "github_repository_milestone" "test" { + owner = split("/", "${github_repository.test.full_name}")[0] + repository = github_repository.test.name + title = "v1.0.0" + description = "General Availability" + due_date = "2022-11-22" + state = "open" +} + +resource "github_issue" "test" { + repository = github_repository.test.name + title = "My issue" + body = "My issue body" + labels = ["bug", "documentation"] + assignees = ["bob-github"] + milestone_number = github_repository_milestone.test.number +} diff --git a/examples/resources/issue_label/example_1.tf b/examples/resources/issue_label/example_1.tf new file mode 100644 index 0000000000..4610cf8fc5 --- /dev/null +++ b/examples/resources/issue_label/example_1.tf @@ -0,0 +1,6 @@ +# Create a new, red colored label +resource "github_issue_label" "test_repo" { + repository = "test-repo" + name = "Urgent" + color = "FF0000" +} diff --git a/examples/resources/issue_labels/example_1.tf b/examples/resources/issue_labels/example_1.tf new file mode 100644 index 0000000000..dd9ea9236c --- /dev/null +++ b/examples/resources/issue_labels/example_1.tf @@ -0,0 +1,14 @@ +# Create a new, red colored label +resource "github_issue_labels" "test_repo" { + repository = "test-repo" + + label { + name = "Urgent" + color = "FF0000" + } + + label { + name = "Critical" + color = "FF0000" + } +} diff --git a/examples/resources/membership/example_1.tf b/examples/resources/membership/example_1.tf new file mode 100644 index 0000000000..ffc6e358ee --- /dev/null +++ b/examples/resources/membership/example_1.tf @@ -0,0 +1,5 @@ +# Add a user to the organization +resource "github_membership" "membership_for_some_user" { + username = "SomeUser" + role = "member" +} diff --git a/examples/resources/organization_block/example_1.tf b/examples/resources/organization_block/example_1.tf new file mode 100644 index 0000000000..0b8af6fafe --- /dev/null +++ b/examples/resources/organization_block/example_1.tf @@ -0,0 +1,3 @@ +resource "github_organization_block" "example" { + username = "paultyng" +} diff --git a/examples/resources/organization_custom_properties/example_1.tf b/examples/resources/organization_custom_properties/example_1.tf new file mode 100644 index 0000000000..f30a8ca52d --- /dev/null +++ b/examples/resources/organization_custom_properties/example_1.tf @@ -0,0 +1,12 @@ +resource "github_organization_custom_properties" "environment" { + property_name = "environment" + value_type = "single_select" + required = true + description = "The deployment environment for this repository" + default_value = "development" + allowed_values = [ + "development", + "staging", + "production" + ] +} diff --git a/examples/resources/organization_custom_properties/example_2.tf b/examples/resources/organization_custom_properties/example_2.tf new file mode 100644 index 0000000000..98ee261a19 --- /dev/null +++ b/examples/resources/organization_custom_properties/example_2.tf @@ -0,0 +1,7 @@ +resource "github_organization_custom_properties" "team_contact" { + property_name = "team_contact" + value_type = "string" + required = false + description = "Contact information for the team managing this repository" + values_editable_by = "org_and_repo_actors" +} diff --git a/examples/resources/organization_custom_properties/example_3.tf b/examples/resources/organization_custom_properties/example_3.tf new file mode 100644 index 0000000000..569bc0a24f --- /dev/null +++ b/examples/resources/organization_custom_properties/example_3.tf @@ -0,0 +1,6 @@ +resource "github_organization_custom_properties" "owner" { + property_name = "owner" + value_type = "string" + required = true + description = "The team or individual responsible for this repository" +} diff --git a/examples/resources/organization_custom_properties/example_4.tf b/examples/resources/organization_custom_properties/example_4.tf new file mode 100644 index 0000000000..cf449c4d54 --- /dev/null +++ b/examples/resources/organization_custom_properties/example_4.tf @@ -0,0 +1,7 @@ +resource "github_organization_custom_properties" "archived" { + property_name = "archived" + value_type = "true_false" + required = false + description = "Whether this repository is archived" + default_value = "false" +} diff --git a/examples/resources/organization_custom_role/example_1.tf b/examples/resources/organization_custom_role/example_1.tf new file mode 100644 index 0000000000..ea2ab6854a --- /dev/null +++ b/examples/resources/organization_custom_role/example_1.tf @@ -0,0 +1,26 @@ +resource "github_organization_custom_role" "example" { + name = "example" + description = "Example custom role that uses the read role as its base" + base_role = "read" + permissions = [ + "add_assignee", + "add_label", + "bypass_branch_protection", + "close_issue", + "close_pull_request", + "mark_as_duplicate", + "create_tag", + "delete_issue", + "delete_tag", + "manage_deploy_keys", + "push_protected_branch", + "read_code_scanning", + "reopen_issue", + "reopen_pull_request", + "request_pr_review", + "resolve_dependabot_alerts", + "resolve_secret_scanning_alerts", + "view_secret_scanning_alerts", + "write_code_scanning" + ] +} diff --git a/examples/resources/organization_project/example_1.tf b/examples/resources/organization_project/example_1.tf new file mode 100644 index 0000000000..d758491b32 --- /dev/null +++ b/examples/resources/organization_project/example_1.tf @@ -0,0 +1,4 @@ +resource "github_organization_project" "project" { + name = "A Organization Project" + body = "This is a organization project." +} diff --git a/examples/resources/organization_repository_role/example_1.tf b/examples/resources/organization_repository_role/example_1.tf new file mode 100644 index 0000000000..62905b7e26 --- /dev/null +++ b/examples/resources/organization_repository_role/example_1.tf @@ -0,0 +1,9 @@ +resource "github_organization_repository_role" "example" { + name = "example" + base_role = "read" + + permissions = [ + "add_assignee", + "add_label" + ] +} diff --git a/examples/resources/organization_role/example_1.tf b/examples/resources/organization_role/example_1.tf new file mode 100644 index 0000000000..a9d7605c62 --- /dev/null +++ b/examples/resources/organization_role/example_1.tf @@ -0,0 +1,9 @@ +resource "github_organization_role" "example" { + name = "example" + base_role = "read" + + permissions = [ + "read_organization_custom_org_role", + "read_organization_custom_repo_role" + ] +} diff --git a/examples/resources/organization_role_team/example_1.tf b/examples/resources/organization_role_team/example_1.tf new file mode 100644 index 0000000000..1b8f396be3 --- /dev/null +++ b/examples/resources/organization_role_team/example_1.tf @@ -0,0 +1,4 @@ +resource "github_organization_role_team" "example" { + role_id = 1234 + team_slug = "example-team" +} diff --git a/examples/resources/organization_role_team/example_2.tf b/examples/resources/organization_role_team/example_2.tf new file mode 100644 index 0000000000..a3ae1d452a --- /dev/null +++ b/examples/resources/organization_role_team/example_2.tf @@ -0,0 +1,10 @@ +locals { + security_manager_id = one([for x in data.github_organization_roles.all_roles.roles : x.role_id if x.name == "security_manager"]) +} + +data "github_organization_roles" "all_roles" {} + +resource "github_organization_role_team" "security_managers" { + role_id = local.security_manager_id + team_slug = "example-team" +} diff --git a/examples/resources/organization_role_team_assignment/example_1.tf b/examples/resources/organization_role_team_assignment/example_1.tf new file mode 100644 index 0000000000..8331e100b9 --- /dev/null +++ b/examples/resources/organization_role_team_assignment/example_1.tf @@ -0,0 +1,8 @@ +resource "github_team" "test-team" { + name = "test-team" +} + +resource "github_organization_role_team_assignment" "test-team-role-assignment" { + team_slug = github_team.test-team.slug + role_id = "8132" # all_repo_read (predefined) +} diff --git a/examples/resources/organization_role_user/example_1.tf b/examples/resources/organization_role_user/example_1.tf new file mode 100644 index 0000000000..743929075a --- /dev/null +++ b/examples/resources/organization_role_user/example_1.tf @@ -0,0 +1,4 @@ +resource "github_organization_role_user" "example" { + role_id = 1234 + login = "example-user" +} diff --git a/examples/resources/organization_ruleset/example_1.tf b/examples/resources/organization_ruleset/example_1.tf new file mode 100644 index 0000000000..5a5ac17bdd --- /dev/null +++ b/examples/resources/organization_ruleset/example_1.tf @@ -0,0 +1,85 @@ +resource "github_organization_ruleset" "example" { + name = "example" + target = "branch" + enforcement = "active" + + conditions { + ref_name { + include = ["~ALL"] + exclude = [] + } + } + + bypass_actors { + actor_id = 13473 + actor_type = "Integration" + bypass_mode = "always" + } + + rules { + creation = true + update = true + deletion = true + required_linear_history = true + required_signatures = true + + branch_name_pattern { + name = "example" + negate = false + operator = "starts_with" + pattern = "ex" + } + + required_workflows { + do_not_enforce_on_create = true + required_workflow { + repository_id = 1234 + path = ".github/workflows/ci.yml" + ref = "main" + } + } + + required_code_scanning { + required_code_scanning_tool { + alerts_threshold = "errors" + security_alerts_threshold = "high_or_higher" + tool = "CodeQL" + } + } + } +} + +# Example with push ruleset +# Note: Push targets must NOT have ref_name in conditions, only repository_name or repository_id +resource "github_organization_ruleset" "example_push" { + name = "example_push" + target = "push" + enforcement = "active" + + conditions { + repository_name { + include = ["~ALL"] + exclude = [] + } + } + + rules { + # Push targets only support these rules: + # file_path_restriction, max_file_size, max_file_path_length, file_extension_restriction + file_path_restriction { + restricted_file_paths = [".github/workflows/*", "*.env"] + } + + max_file_size { + max_file_size = 100 # 100 MB + } + + max_file_path_length { + max_file_path_length = 255 + } + + file_extension_restriction { + restricted_file_extensions = ["*.exe", "*.dll", "*.so"] + } + } +} diff --git a/examples/resources/organization_security_manager/example_1.tf b/examples/resources/organization_security_manager/example_1.tf new file mode 100644 index 0000000000..17b2487944 --- /dev/null +++ b/examples/resources/organization_security_manager/example_1.tf @@ -0,0 +1,8 @@ +resource "github_team" "some_team" { + name = "SomeTeam" + description = "Some cool team" +} + +resource "github_organization_security_manager" "some_team" { + team_slug = github_team.some_team.slug +} diff --git a/examples/resources/organization_settings/example_1.tf b/examples/resources/organization_settings/example_1.tf new file mode 100644 index 0000000000..1dab26f0ab --- /dev/null +++ b/examples/resources/organization_settings/example_1.tf @@ -0,0 +1,28 @@ +resource "github_organization_settings" "test" { + billing_email = "test@example.com" + company = "Test Company" + blog = "https://example.com" + email = "test@example.com" + twitter_username = "Test" + location = "Test Location" + name = "Test Name" + description = "Test Description" + has_organization_projects = true + has_repository_projects = true + default_repository_permission = "read" + members_can_create_repositories = true + members_can_create_public_repositories = true + members_can_create_private_repositories = true + members_can_create_internal_repositories = true + members_can_create_pages = true + members_can_create_public_pages = true + members_can_create_private_pages = true + members_can_fork_private_repositories = true + web_commit_signoff_required = true + advanced_security_enabled_for_new_repositories = false + dependabot_alerts_enabled_for_new_repositories = false + dependabot_security_updates_enabled_for_new_repositories = false + dependency_graph_enabled_for_new_repositories = false + secret_scanning_enabled_for_new_repositories = false + secret_scanning_push_protection_enabled_for_new_repositories = false +} diff --git a/examples/resources/organization_webhook/example_1.tf b/examples/resources/organization_webhook/example_1.tf new file mode 100644 index 0000000000..71142bc08d --- /dev/null +++ b/examples/resources/organization_webhook/example_1.tf @@ -0,0 +1,13 @@ +resource "github_organization_webhook" "foo" { + name = "web" + + configuration { + url = "https://google.de/" + content_type = "form" + insecure_ssl = false + } + + active = false + + events = ["issues"] +} diff --git a/examples/resources/project_card/example_1.tf b/examples/resources/project_card/example_1.tf new file mode 100644 index 0000000000..173cf7856b --- /dev/null +++ b/examples/resources/project_card/example_1.tf @@ -0,0 +1,14 @@ +resource "github_organization_project" "project" { + name = "An Organization Project" + body = "This is an organization project." +} + +resource "github_project_column" "column" { + project_id = github_organization_project.project.id + name = "Backlog" +} + +resource "github_project_card" "card" { + column_id = github_project_column.column.column_id + note = "## Unaccepted 👇" +} diff --git a/examples/resources/project_card/example_2.tf b/examples/resources/project_card/example_2.tf new file mode 100644 index 0000000000..91c5c6129a --- /dev/null +++ b/examples/resources/project_card/example_2.tf @@ -0,0 +1,28 @@ +resource "github_repository" "test" { + name = "myrepo" + has_projects = true + has_issues = true +} + +resource "github_issue" "test" { + repository = github_repository.test.id + title = "Test issue title" + body = "Test issue body" +} + +resource "github_repository_project" "test" { + name = "test" + repository = github_repository.test.name + body = "this is a test project" +} + +resource "github_project_column" "test" { + project_id = github_repository_project.test.id + name = "Backlog" +} + +resource "github_project_card" "test" { + column_id = github_project_column.test.column_id + content_id = github_issue.test.issue_id + content_type = "Issue" +} diff --git a/examples/resources/project_column/example_1.tf b/examples/resources/project_column/example_1.tf new file mode 100644 index 0000000000..ecdf9bfb83 --- /dev/null +++ b/examples/resources/project_column/example_1.tf @@ -0,0 +1,9 @@ +resource "github_organization_project" "project" { + name = "A Organization Project" + body = "This is an organization project." +} + +resource "github_project_column" "column" { + project_id = github_organization_project.project.id + name = "a column" +} diff --git a/examples/resources/release/example_1.tf b/examples/resources/release/example_1.tf new file mode 100644 index 0000000000..2b2372444f --- /dev/null +++ b/examples/resources/release/example_1.tf @@ -0,0 +1,11 @@ +resource "github_repository" "repo" { + name = "repo" + description = "GitHub repo managed by Terraform" + + private = false +} + +resource "github_release" "example" { + repository = github_repository.repo.name + tag_name = "v1.0.0" +} diff --git a/examples/resources/release/example_2.tf b/examples/resources/release/example_2.tf new file mode 100644 index 0000000000..8ae9659c58 --- /dev/null +++ b/examples/resources/release/example_2.tf @@ -0,0 +1,18 @@ +resource "github_repository" "example" { + name = "repo" + auto_init = true +} + +resource "github_branch" "example" { + repository = github_repository.example.name + branch = "branch_name" + source_branch = github_repository.example.default_branch +} + +resource "github_release" "example" { + repository = github_repository.example.name + tag_name = "v1.0.0" + target_commitish = github_branch.example.branch + draft = false + prerelease = false +} diff --git a/examples/resources/repository/example_1.tf b/examples/resources/repository/example_1.tf new file mode 100644 index 0000000000..5d87ccdfa8 --- /dev/null +++ b/examples/resources/repository/example_1.tf @@ -0,0 +1,12 @@ +resource "github_repository" "example" { + name = "example" + description = "My awesome codebase" + + visibility = "public" + + template { + owner = "github" + repository = "terraform-template-module" + include_all_branches = true + } +} diff --git a/examples/resources/repository/example_2.tf b/examples/resources/repository/example_2.tf new file mode 100644 index 0000000000..fcf599b252 --- /dev/null +++ b/examples/resources/repository/example_2.tf @@ -0,0 +1,13 @@ +resource "github_repository" "example" { + name = "example" + description = "My awesome web page" + + private = false + + pages { + source { + branch = "master" + path = "/docs" + } + } +} diff --git a/examples/resources/repository/example_3.tf b/examples/resources/repository/example_3.tf new file mode 100644 index 0000000000..b2e9f0b7a9 --- /dev/null +++ b/examples/resources/repository/example_3.tf @@ -0,0 +1,7 @@ +resource "github_repository" "forked_repo" { + name = "forked-repository" + description = "This is a fork of another repository" + fork = true + source_owner = "some-org" + source_repo = "original-repository" +} diff --git a/examples/resources/repository_autolink_reference/example_1.tf b/examples/resources/repository_autolink_reference/example_1.tf new file mode 100644 index 0000000000..13b723b3bc --- /dev/null +++ b/examples/resources/repository_autolink_reference/example_1.tf @@ -0,0 +1,14 @@ +resource "github_repository" "repo" { + name = "my-repo" + description = "GitHub repo managed by Terraform" + + private = false +} + +resource "github_repository_autolink_reference" "autolink" { + repository = github_repository.repo.name + + key_prefix = "TICKET-" + + target_url_template = "https://example.com/TICKET?query=" +} diff --git a/examples/resources/repository_collaborator/example_1.tf b/examples/resources/repository_collaborator/example_1.tf new file mode 100644 index 0000000000..8aa3a72428 --- /dev/null +++ b/examples/resources/repository_collaborator/example_1.tf @@ -0,0 +1,6 @@ +# Add a collaborator to a repository +resource "github_repository_collaborator" "a_repo_collaborator" { + repository = "our-cool-repo" + username = "SomeUser" + permission = "admin" +} diff --git a/examples/resources/repository_collaborators/example_1.tf b/examples/resources/repository_collaborators/example_1.tf new file mode 100644 index 0000000000..2c23d503aa --- /dev/null +++ b/examples/resources/repository_collaborators/example_1.tf @@ -0,0 +1,23 @@ +# Add collaborators to a repository +resource "github_team" "some_team" { + name = "SomeTeam" + description = "Some cool team" +} + +resource "github_repository" "some_repo" { + name = "some-repo" +} + +resource "github_repository_collaborators" "some_repo_collaborators" { + repository = github_repository.some_repo.name + + user { + permission = "admin" + username = "SomeUser" + } + + team { + permission = "pull" + team_id = github_team.some_team.slug + } +} diff --git a/examples/resources/repository_custom_property/example_1.tf b/examples/resources/repository_custom_property/example_1.tf new file mode 100644 index 0000000000..be5eb8fb8c --- /dev/null +++ b/examples/resources/repository_custom_property/example_1.tf @@ -0,0 +1,10 @@ +resource "github_repository" "example" { + name = "example" + description = "My awesome codebase" +} +resource "github_repository_custom_property" "string" { + repository = github_repository.example.name + property_name = "my-cool-property" + property_type = "string" + property_value = ["test"] +} diff --git a/examples/resources/repository_dependabot_security_updates/example_1.tf b/examples/resources/repository_dependabot_security_updates/example_1.tf new file mode 100644 index 0000000000..894bd1b753 --- /dev/null +++ b/examples/resources/repository_dependabot_security_updates/example_1.tf @@ -0,0 +1,14 @@ +resource "github_repository" "repo" { + name = "my-repo" + description = "GitHub repo managed by Terraform" + + private = false + + vulnerability_alerts = true +} + + +resource "github_repository_dependabot_security_updates" "example" { + repository = github_repository.test.name + enabled = true +} diff --git a/examples/resources/repository_deploy_key/example_1.tf b/examples/resources/repository_deploy_key/example_1.tf new file mode 100644 index 0000000000..2bf08c4167 --- /dev/null +++ b/examples/resources/repository_deploy_key/example_1.tf @@ -0,0 +1,12 @@ +# Generate an ssh key using provider "hashicorp/tls" +resource "tls_private_key" "example_repository_deploy_key" { + algorithm = "ED25519" +} + +# Add the ssh key as a deploy key +resource "github_repository_deploy_key" "example_repository_deploy_key" { + title = "Repository test key" + repository = "test-repo" + key = tls_private_key.example_repository_deploy_key.public_key_openssh + read_only = true +} diff --git a/examples/resources/repository_deployment_branch_policy/example_1.tf b/examples/resources/repository_deployment_branch_policy/example_1.tf new file mode 100644 index 0000000000..ae13bf3be7 --- /dev/null +++ b/examples/resources/repository_deployment_branch_policy/example_1.tf @@ -0,0 +1,16 @@ +resource "github_repository_environment" "env" { + repository = "my_repo" + environment = "my_env" + deployment_branch_policy { + protected_branches = false + custom_branch_policies = true + } +} + +resource "github_repository_deployment_branch_policy" "foo" { + depends_on = [github_repository_environment.env] + + repository = "my_repo" + environment_name = "my_env" + name = "foo" +} diff --git a/examples/resources/repository_environment/example_1.tf b/examples/resources/repository_environment/example_1.tf new file mode 100644 index 0000000000..fa22218d71 --- /dev/null +++ b/examples/resources/repository_environment/example_1.tf @@ -0,0 +1,21 @@ +data "github_user" "current" { + username = "" +} + +resource "github_repository" "example" { + name = "A Repository Project" + description = "My awesome codebase" +} + +resource "github_repository_environment" "example" { + environment = "example" + repository = github_repository.example.name + prevent_self_review = true + reviewers { + users = [data.github_user.current.id] + } + deployment_branch_policy { + protected_branches = true + custom_branch_policies = false + } +} diff --git a/examples/resources/repository_environment/example_2.tf b/examples/resources/repository_environment/example_2.tf new file mode 100644 index 0000000000..1d209897b7 --- /dev/null +++ b/examples/resources/repository_environment/example_2.tf @@ -0,0 +1,4 @@ +import { + to = github_repository_environment.example + id = "myrepo:myenv" +} diff --git a/examples/resources/repository_environment_deployment_policy/example_1.tf b/examples/resources/repository_environment_deployment_policy/example_1.tf new file mode 100644 index 0000000000..bdf98f28eb --- /dev/null +++ b/examples/resources/repository_environment_deployment_policy/example_1.tf @@ -0,0 +1,26 @@ +data "github_user" "current" { + username = "" +} + +resource "github_repository" "test" { + name = "tf-acc-test-%s" +} + +resource "github_repository_environment" "test" { + repository = github_repository.test.name + environment = "environment/test" + wait_timer = 10000 + reviewers { + users = [data.github_user.current.id] + } + deployment_branch_policy { + protected_branches = false + custom_branch_policies = true + } +} + +resource "github_repository_environment_deployment_policy" "test" { + repository = github_repository.test.name + environment = github_repository_environment.test.environment + branch_pattern = "releases/*" +} diff --git a/examples/resources/repository_environment_deployment_policy/example_2.tf b/examples/resources/repository_environment_deployment_policy/example_2.tf new file mode 100644 index 0000000000..c5e33b9f02 --- /dev/null +++ b/examples/resources/repository_environment_deployment_policy/example_2.tf @@ -0,0 +1,27 @@ + +data "github_user" "current" { + username = "" +} + +resource "github_repository" "test" { + name = "tf-acc-test-%s" +} + +resource "github_repository_environment" "test" { + repository = github_repository.test.name + environment = "environment/test" + wait_timer = 10000 + reviewers { + users = [data.github_user.current.id] + } + deployment_branch_policy { + protected_branches = false + custom_branch_policies = true + } +} + +resource "github_repository_environment_deployment_policy" "test" { + repository = github_repository.test.name + environment = github_repository_environment.test.environment + tag_pattern = "v*" +} diff --git a/examples/resources/repository_environment_deployment_policy/example_3.tf b/examples/resources/repository_environment_deployment_policy/example_3.tf new file mode 100644 index 0000000000..451b768b22 --- /dev/null +++ b/examples/resources/repository_environment_deployment_policy/example_3.tf @@ -0,0 +1,4 @@ +import { + to = github_repository_environment_deployment_policy.example + id = "myrepo:myenv:123456" +} diff --git a/examples/resources/repository_file/example_1.tf b/examples/resources/repository_file/example_1.tf new file mode 100644 index 0000000000..8fda073871 --- /dev/null +++ b/examples/resources/repository_file/example_1.tf @@ -0,0 +1,17 @@ + +resource "github_repository" "foo" { + name = "example" + auto_init = true +} + +resource "github_repository_file" "foo" { + repository = github_repository.foo.name + branch = "main" + file = ".gitignore" + content = "**/*.tfstate" + commit_message = "Managed by Terraform" + commit_author = "Terraform User" + commit_email = "terraform@example.com" + overwrite_on_create = true +} + diff --git a/examples/resources/repository_file/example_2.tf b/examples/resources/repository_file/example_2.tf new file mode 100644 index 0000000000..0cd472fba5 --- /dev/null +++ b/examples/resources/repository_file/example_2.tf @@ -0,0 +1,18 @@ + +resource "github_repository" "foo" { + name = "example" + auto_init = true +} + +resource "github_repository_file" "foo" { + repository = github_repository.foo.name + branch = "does/not/exist" + file = ".gitignore" + content = "**/*.tfstate" + commit_message = "Managed by Terraform" + commit_author = "Terraform User" + commit_email = "terraform@example.com" + overwrite_on_create = true + autocreate_branch = true +} + diff --git a/examples/resources/repository_milestone/example_1.tf b/examples/resources/repository_milestone/example_1.tf new file mode 100644 index 0000000000..7d15cf570a --- /dev/null +++ b/examples/resources/repository_milestone/example_1.tf @@ -0,0 +1,6 @@ +# Create a milestone for a repository +resource "github_repository_milestone" "example" { + owner = "example-owner" + repository = "example-repository" + title = "v1.1.0" +} diff --git a/examples/resources/repository_pages/example_1.tf b/examples/resources/repository_pages/example_1.tf new file mode 100644 index 0000000000..ea84418d94 --- /dev/null +++ b/examples/resources/repository_pages/example_1.tf @@ -0,0 +1,21 @@ +resource "github_repository" "example" { + name = "my-repo" + visibility = "public" + auto_init = true + + lifecycle { + ignore_changes = [ + pages, + ] + } +} + +resource "github_repository_pages" "example" { + repository = github_repository.example.name + build_type = "legacy" + + source { + branch = "main" + path = "/" + } +} diff --git a/examples/resources/repository_pages/example_2.tf b/examples/resources/repository_pages/example_2.tf new file mode 100644 index 0000000000..6133fa7600 --- /dev/null +++ b/examples/resources/repository_pages/example_2.tf @@ -0,0 +1,16 @@ +resource "github_repository" "example" { + name = "my-repo" + visibility = "public" + auto_init = true + + lifecycle { + ignore_changes = [ + pages, + ] + } +} + +resource "github_repository_pages" "example" { + repository = github_repository.example.name + build_type = "workflow" +} diff --git a/examples/resources/repository_pages/example_3.tf b/examples/resources/repository_pages/example_3.tf new file mode 100644 index 0000000000..b501075989 --- /dev/null +++ b/examples/resources/repository_pages/example_3.tf @@ -0,0 +1,23 @@ +resource "github_repository" "example" { + name = "my-repo" + visibility = "public" + auto_init = true + + lifecycle { + ignore_changes = [ + pages, + ] + } +} + +resource "github_repository_pages" "example" { + repository = github_repository.example.name + build_type = "legacy" + cname = "example.com" + https_enforced = true + + source { + branch = "main" + path = "/docs" + } +} diff --git a/examples/resources/repository_project/example_1.tf b/examples/resources/repository_project/example_1.tf new file mode 100644 index 0000000000..753d08d18a --- /dev/null +++ b/examples/resources/repository_project/example_1.tf @@ -0,0 +1,11 @@ +resource "github_repository" "example" { + name = "example" + description = "My awesome codebase" + has_projects = true +} + +resource "github_repository_project" "project" { + name = "A Repository Project" + repository = github_repository.example.name + body = "This is a repository project." +} diff --git a/examples/resources/repository_pull_request/example_1.tf b/examples/resources/repository_pull_request/example_1.tf new file mode 100644 index 0000000000..539f7ed4b8 --- /dev/null +++ b/examples/resources/repository_pull_request/example_1.tf @@ -0,0 +1,7 @@ +resource "github_repository_pull_request" "example" { + base_repository = "example-repository" + base_ref = "main" + head_ref = "feature-branch" + title = "My newest feature" + body = "This will change everything" +} diff --git a/examples/resources/repository_ruleset/example_1.tf b/examples/resources/repository_ruleset/example_1.tf new file mode 100644 index 0000000000..f8c018146f --- /dev/null +++ b/examples/resources/repository_ruleset/example_1.tf @@ -0,0 +1,70 @@ +resource "github_repository" "example" { + name = "example" + description = "Example repository" +} + +resource "github_repository_ruleset" "example" { + name = "example" + repository = github_repository.example.name + target = "branch" + enforcement = "active" + + conditions { + ref_name { + include = ["~ALL"] + exclude = [] + } + } + + bypass_actors { + actor_id = 13473 + actor_type = "Integration" + bypass_mode = "always" + } + + rules { + creation = true + update = true + deletion = true + required_linear_history = true + required_signatures = true + + required_deployments { + required_deployment_environments = ["test"] + } + + required_code_scanning { + required_code_scanning_tool { + alerts_threshold = "errors" + security_alerts_threshold = "high_or_higher" + tool = "CodeQL" + } + } + } +} + +# Example with push ruleset +resource "github_repository_ruleset" "example_push" { + name = "example_push" + repository = github_repository.example.name + target = "push" + enforcement = "active" + + rules { + file_path_restriction { + restricted_file_paths = [".github/workflows/*", "*.env"] + } + + max_file_size { + max_file_size = 100 # 100 MB + } + + max_file_path_length { + max_file_path_length = 255 + } + + file_extension_restriction { + restricted_file_extensions = ["*.exe", "*.dll", "*.so"] + } + } +} diff --git a/examples/resources/repository_topics/example_1.tf b/examples/resources/repository_topics/example_1.tf new file mode 100644 index 0000000000..53b9533089 --- /dev/null +++ b/examples/resources/repository_topics/example_1.tf @@ -0,0 +1,8 @@ +data "github_repository" "test" { + name = "test" +} + +resource "github_repository_topics" "test" { + repository = github_repository.test.name + topics = ["topic-1", "topic-2"] +} diff --git a/examples/resources/repository_vulnerability_alerts/example_1.tf b/examples/resources/repository_vulnerability_alerts/example_1.tf new file mode 100644 index 0000000000..9cc8b8cd10 --- /dev/null +++ b/examples/resources/repository_vulnerability_alerts/example_1.tf @@ -0,0 +1,10 @@ +resource "github_repository" "example" { + name = "my-repo" + description = "GitHub repo managed by Terraform" + visibility = "private" +} + +resource "github_repository_vulnerability_alerts" "example" { + repository = github_repository.example.name + enabled = true +} diff --git a/examples/resources/repository_webhook/example_1.tf b/examples/resources/repository_webhook/example_1.tf new file mode 100644 index 0000000000..07ce862c9e --- /dev/null +++ b/examples/resources/repository_webhook/example_1.tf @@ -0,0 +1,21 @@ +resource "github_repository" "repo" { + name = "foo" + description = "Terraform acceptance tests" + homepage_url = "http://example.com/" + + visibility = "public" +} + +resource "github_repository_webhook" "foo" { + repository = github_repository.repo.name + + configuration { + url = "https://google.de/" + content_type = "form" + insecure_ssl = false + } + + active = false + + events = ["issues"] +} diff --git a/examples/resources/team/example_1.tf b/examples/resources/team/example_1.tf new file mode 100644 index 0000000000..6c0ed30c98 --- /dev/null +++ b/examples/resources/team/example_1.tf @@ -0,0 +1,6 @@ +# Add a team to the organization +resource "github_team" "some_team" { + name = "some-team" + description = "Some cool team" + privacy = "closed" +} diff --git a/examples/resources/team_members/example_1.tf b/examples/resources/team_members/example_1.tf new file mode 100644 index 0000000000..cb46d6d340 --- /dev/null +++ b/examples/resources/team_members/example_1.tf @@ -0,0 +1,29 @@ +# Add a user to the organization +resource "github_membership" "membership_for_some_user" { + username = "SomeUser" + role = "member" +} + +resource "github_membership" "membership_for_another_user" { + username = "AnotherUser" + role = "member" +} + +resource "github_team" "some_team" { + name = "SomeTeam" + description = "Some cool team" +} + +resource "github_team_members" "some_team_members" { + team_id = github_team.some_team.id + + members { + username = "SomeUser" + role = "maintainer" + } + + members { + username = "AnotherUser" + role = "member" + } +} diff --git a/examples/resources/team_membership/example_1.tf b/examples/resources/team_membership/example_1.tf new file mode 100644 index 0000000000..c96a4d2c38 --- /dev/null +++ b/examples/resources/team_membership/example_1.tf @@ -0,0 +1,16 @@ +# Add a user to the organization +resource "github_membership" "membership_for_some_user" { + username = "SomeUser" + role = "member" +} + +resource "github_team" "some_team" { + name = "SomeTeam" + description = "Some cool team" +} + +resource "github_team_membership" "some_team_membership" { + team_id = github_team.some_team.id + username = "SomeUser" + role = "member" +} diff --git a/examples/resources/team_repository/example_1.tf b/examples/resources/team_repository/example_1.tf new file mode 100644 index 0000000000..c2276ec830 --- /dev/null +++ b/examples/resources/team_repository/example_1.tf @@ -0,0 +1,15 @@ +# Add a repository to the team +resource "github_team" "some_team" { + name = "SomeTeam" + description = "Some cool team" +} + +resource "github_repository" "some_repo" { + name = "some-repo" +} + +resource "github_team_repository" "some_team_repo" { + team_id = github_team.some_team.id + repository = github_repository.some_repo.name + permission = "pull" +} diff --git a/examples/resources/team_settings/example_1.tf b/examples/resources/team_settings/example_1.tf new file mode 100644 index 0000000000..a90d4aca25 --- /dev/null +++ b/examples/resources/team_settings/example_1.tf @@ -0,0 +1,14 @@ +# Add a repository to the team +resource "github_team" "some_team" { + name = "SomeTeam" + description = "Some cool team" +} + +resource "github_team_settings" "code_review_settings" { + team_id = github_team.some_team.id + review_request_delegation { + algorithm = "ROUND_ROBIN" + member_count = 1 + notify = true + } +} diff --git a/examples/resources/team_settings/example_2.tf b/examples/resources/team_settings/example_2.tf new file mode 100644 index 0000000000..e2d7b318da --- /dev/null +++ b/examples/resources/team_settings/example_2.tf @@ -0,0 +1,13 @@ +resource "github_team" "some_team" { + name = "SomeTeam" + description = "Some cool team" +} + +resource "github_team_settings" "code_review_settings" { + team_id = github_team.some_team.id + notify = true + review_request_delegation { + algorithm = "ROUND_ROBIN" + member_count = 1 + } +} diff --git a/examples/resources/team_sync_group_mapping/example_1.tf b/examples/resources/team_sync_group_mapping/example_1.tf new file mode 100644 index 0000000000..5c8c175704 --- /dev/null +++ b/examples/resources/team_sync_group_mapping/example_1.tf @@ -0,0 +1,15 @@ + +data "github_organization_team_sync_groups" "example_groups" {} + +resource "github_team_sync_group_mapping" "example_group_mapping" { + team_slug = "example" + + dynamic "group" { + for_each = [for g in data.github_organization_team_sync_groups.example_groups.groups : g if g.group_name == "some_team_group"] + content { + group_id = group.value.group_id + group_name = group.value.group_name + group_description = group.value.group_description + } + } +} diff --git a/examples/resources/user_gpg_key/example_1.tf b/examples/resources/user_gpg_key/example_1.tf new file mode 100644 index 0000000000..3b3165f269 --- /dev/null +++ b/examples/resources/user_gpg_key/example_1.tf @@ -0,0 +1,3 @@ +resource "github_user_gpg_key" "example" { + armored_public_key = "-----BEGIN PGP PUBLIC KEY BLOCK-----\n...\n-----END PGP PUBLIC KEY BLOCK-----" +} diff --git a/examples/resources/user_invitation_accepter/example_1.tf b/examples/resources/user_invitation_accepter/example_1.tf new file mode 100644 index 0000000000..eaf70ea04e --- /dev/null +++ b/examples/resources/user_invitation_accepter/example_1.tf @@ -0,0 +1,19 @@ +resource "github_repository" "example" { + name = "example-repo" +} + +resource "github_repository_collaborator" "example" { + repository = github_repository.example.name + username = "example-username" + permission = "push" +} + +provider "github" { + alias = "invitee" + token = var.invitee_token +} + +resource "github_user_invitation_accepter" "example" { + provider = "github.invitee" + invitation_id = github_repository_collaborator.example.invitation_id +} diff --git a/examples/resources/user_ssh_key/example_1.tf b/examples/resources/user_ssh_key/example_1.tf new file mode 100644 index 0000000000..d6d3f5d702 --- /dev/null +++ b/examples/resources/user_ssh_key/example_1.tf @@ -0,0 +1,4 @@ +resource "github_user_ssh_key" "example" { + title = "example title" + key = file("~/.ssh/id_rsa.pub") +} diff --git a/examples/resources/workflow_repository_permissions/example_1.tf b/examples/resources/workflow_repository_permissions/example_1.tf new file mode 100644 index 0000000000..3ef762c6b1 --- /dev/null +++ b/examples/resources/workflow_repository_permissions/example_1.tf @@ -0,0 +1,9 @@ +resource "github_repository" "example" { + name = "my-repository" +} + +resource "github_workflow_repository_permissions" "test" { + default_workflow_permissions = "read" + can_approve_pull_request_reviews = true + repository = github_repository.example.name +} diff --git a/examples/secret-drifting/main.tf b/examples/secret-drifting/main.tf index b228efccf2..83fd11804b 100644 --- a/examples/secret-drifting/main.tf +++ b/examples/secret-drifting/main.tf @@ -4,15 +4,15 @@ provider "github" { terraform { required_providers { github = { - source = "integrations/github" + source = "integrations/github" } } } resource "github_actions_organization_secret" "plaintext_secret" { - secret_name = "test_plaintext_secret" - plaintext_value = "123" - visibility = "private" + secret_name = "test_plaintext_secret" + plaintext_value = "123" + visibility = "private" } resource "github_actions_organization_secret" "encrypted_secret" { diff --git a/github/test-fixtures/README.md b/github/test-fixtures/README.md index 874f61a31a..52478a6d36 100644 --- a/github/test-fixtures/README.md +++ b/github/test-fixtures/README.md @@ -1,4 +1,4 @@ -# Hi fellow bots and humans :wave: +# Hi fellow bots and humans If you're about to panic about leaked private keys, then please don't. These are purposefully exposed cryptographic materials used in tests of diff --git a/templates/data-sources.md.tmpl b/templates/data-sources.md.tmpl new file mode 100644 index 0000000000..3bb5a23038 --- /dev/null +++ b/templates/data-sources.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} +{{- if .HasImport }} + +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} diff --git a/templates/data-sources/actions_environment_public_key.md.tmpl b/templates/data-sources/actions_environment_public_key.md.tmpl new file mode 100644 index 0000000000..59b26f18ed --- /dev/null +++ b/templates/data-sources/actions_environment_public_key.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Actions Environment Public Key. +--- + +# {{.Name}} ({{.Type}}) + +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 + +{{ tffile "examples/data-sources/actions_environment_public_key/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. +- `environment` - (Required) Name of the environment to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/actions_environment_secrets.md.tmpl b/templates/data-sources/actions_environment_secrets.md.tmpl new file mode 100644 index 0000000000..0ef95a0421 --- /dev/null +++ b/templates/data-sources/actions_environment_secrets.md.tmpl @@ -0,0 +1,22 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get Actions secrets of the repository environment +--- + +# github\_actions\_environment\_secrets + +Use this data source to retrieve the list of secrets of the repository environment. + +## Example Usage + +{{ tffile "examples/data-sources/actions_environment_secrets/example_1.tf" }} + +## 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 diff --git a/templates/data-sources/actions_environment_variables.md.tmpl b/templates/data-sources/actions_environment_variables.md.tmpl new file mode 100644 index 0000000000..4b443e54ac --- /dev/null +++ b/templates/data-sources/actions_environment_variables.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get Actions variables of the repository environment +--- + +# github\_actions\_environment\_variables + +Use this data source to retrieve the list of variables of the repository environment. + +## Example Usage + +{{ tffile "examples/data-sources/actions_environment_variables/example_1.tf" }} + +## 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 diff --git a/templates/data-sources/actions_organization_oidc_subject_claim_customization_template.md.tmpl b/templates/data-sources/actions_organization_oidc_subject_claim_customization_template.md.tmpl new file mode 100644 index 0000000000..dd63b3a36d --- /dev/null +++ b/templates/data-sources/actions_organization_oidc_subject_claim_customization_template.md.tmpl @@ -0,0 +1,19 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get a GitHub Actions organization OpenID Connect customization template +--- + +# actions_organization_oidc_subject_claim_customization_template + +Use this data source to retrieve the OpenID Connect subject claim customization template for an organization + +## Example Usage + +{{ tffile "examples/data-sources/actions_organization_oidc_subject_claim_customization_template/example_1.tf" }} + +## Argument Reference + +## Attributes Reference + +- `include_claim_keys` - The list of OpenID Connect claim keys. diff --git a/templates/data-sources/actions_organization_public_key.md.tmpl b/templates/data-sources/actions_organization_public_key.md.tmpl new file mode 100644 index 0000000000..0f2e9fa431 --- /dev/null +++ b/templates/data-sources/actions_organization_public_key.md.tmpl @@ -0,0 +1,18 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Actions Organization Public Key. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub Actions Organization public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an organization to retrieve it's action public key. + +## Example Usage + +{{ tffile "examples/data-sources/actions_organization_public_key/example_1.tf" }} + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/actions_organization_registration_token.md.tmpl b/templates/data-sources/actions_organization_registration_token.md.tmpl new file mode 100644 index 0000000000..32e04addda --- /dev/null +++ b/templates/data-sources/actions_organization_registration_token.md.tmpl @@ -0,0 +1,20 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get a GitHub Actions organization registration token. +--- + +# actions_registration_token + +Use this data source to retrieve a GitHub Actions organization registration token. This token can then be used to register a self-hosted runner. + +## Example Usage + +{{ tffile "examples/data-sources/actions_organization_registration_token/example_1.tf" }} + +## Argument Reference + +## Attributes Reference + +- `token` - The token that has been retrieved. +- `expires_at` - The token expiration date. diff --git a/templates/data-sources/actions_organization_secrets.md.tmpl b/templates/data-sources/actions_organization_secrets.md.tmpl new file mode 100644 index 0000000000..8c28b308fe --- /dev/null +++ b/templates/data-sources/actions_organization_secrets.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get actions secrets of the organization +--- + +# github\_actions\_organization\_secrets + +Use this data source to retrieve the list of secrets of the organization. + +## Example Usage + +{{ tffile "examples/data-sources/actions_organization_secrets/example_1.tf" }} + +## Argument Reference + +## Attributes Reference + +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/templates/data-sources/actions_organization_variables.md.tmpl b/templates/data-sources/actions_organization_variables.md.tmpl new file mode 100644 index 0000000000..9b4c4ccf2a --- /dev/null +++ b/templates/data-sources/actions_organization_variables.md.tmpl @@ -0,0 +1,24 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get Actions variables of the organization +--- + +# github\_actions\_organization\_variables + +Use this data source to retrieve the list of variables of the organization. + +## Example Usage + +{{ tffile "examples/data-sources/actions_organization_variables/example_1.tf" }} + +## Argument Reference + +## Attributes Reference + +- `variables` - list of variables for the repository + - `name` - Name of the variable + - `value` - Value of the variable + - `visibility` - Visibility of the variable + - `created_at` - Timestamp of the variable creation + - `updated_at` - Timestamp of the variable last update diff --git a/templates/data-sources/actions_public_key.md.tmpl b/templates/data-sources/actions_public_key.md.tmpl new file mode 100644 index 0000000000..dabdac6976 --- /dev/null +++ b/templates/data-sources/actions_public_key.md.tmpl @@ -0,0 +1,22 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Actions Public Key. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub Actions public key. 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 it's action public key. + +## Example Usage + +{{ tffile "examples/data-sources/actions_public_key/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/actions_registration_token.md.tmpl b/templates/data-sources/actions_registration_token.md.tmpl new file mode 100644 index 0000000000..a93991bd78 --- /dev/null +++ b/templates/data-sources/actions_registration_token.md.tmpl @@ -0,0 +1,22 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get a GitHub Actions repository registration token. +--- + +# actions_registration_token + +Use this data source to retrieve a GitHub Actions repository registration token. This token can then be used to register a self-hosted runner. + +## Example Usage + +{{ tffile "examples/data-sources/actions_registration_token/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to get a GitHub Actions registration token for. + +## Attributes Reference + +- `token` - The token that has been retrieved. +- `expires_at` - The token expiration date. diff --git a/templates/data-sources/actions_repository_oidc_subject_claim_customization_template.md.tmpl b/templates/data-sources/actions_repository_oidc_subject_claim_customization_template.md.tmpl new file mode 100644 index 0000000000..c0a9a483fc --- /dev/null +++ b/templates/data-sources/actions_repository_oidc_subject_claim_customization_template.md.tmpl @@ -0,0 +1,22 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get a GitHub Actions repository's OpenID Connect customization template +--- + +# actions_repository_oidc_subject_claim_customization_template + +Use this data source to retrieve the OpenID Connect subject claim customization template for a repository + +## Example Usage + +{{ tffile "examples/data-sources/actions_repository_oidc_subject_claim_customization_template/example_1.tf" }} + +## Argument Reference + +- `name` - (Required) Name of the repository to get the OpenID Connect subject claim customization template for. + +## Attributes Reference + +- `use_default` - Whether the repository uses the default template. +- `include_claim_keys` - The list of OpenID Connect claim keys. diff --git a/templates/data-sources/actions_secrets.md.tmpl b/templates/data-sources/actions_secrets.md.tmpl new file mode 100644 index 0000000000..f84e868425 --- /dev/null +++ b/templates/data-sources/actions_secrets.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get actions secrets for a repository +--- + +# github\_actions\_secrets + +Use this data source to retrieve the list of secrets for a GitHub repository. + +## Example Usage + +{{ tffile "examples/data-sources/actions_secrets/example_1.tf" }} + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/templates/data-sources/actions_variables.md.tmpl b/templates/data-sources/actions_variables.md.tmpl new file mode 100644 index 0000000000..f08c6c47df --- /dev/null +++ b/templates/data-sources/actions_variables.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get Actions variables for a repository +--- + +# github\_actions\_variables + +Use this data source to retrieve the list of variables for a GitHub repository. + +## Example Usage + +{{ tffile "examples/data-sources/actions_variables/example_1.tf" }} + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `variables` - list of variables for the repository + - `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 diff --git a/templates/data-sources/app.md.tmpl b/templates/data-sources/app.md.tmpl new file mode 100644 index 0000000000..9c042ba8f8 --- /dev/null +++ b/templates/data-sources/app.md.tmpl @@ -0,0 +1,29 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information about an app. +--- + +# github\_app + +Use this data source to retrieve information about an app. + +## Example Usage + +{{ tffile "examples/data-sources/app/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `slug` - (Required) The URL-friendly name of your GitHub App. + +## Attribute Reference + +The following additional attributes are exported: + +- `description` - The app's description. + +- `name` - The app's full name. + +- `node_id` - The Node ID of the app. diff --git a/templates/data-sources/app_token.md.tmpl b/templates/data-sources/app_token.md.tmpl new file mode 100644 index 0000000000..e006802bd3 --- /dev/null +++ b/templates/data-sources/app_token.md.tmpl @@ -0,0 +1,29 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Generate a GitHub APP JWT. +--- + +# github\_app\_token + +Use this data source to generate a [GitHub App JWT](https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/generating-a-json-web-token-jwt-for-a-github-app). + +## Example Usage + +{{ tffile "examples/data-sources/app_token/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `app_id` - (Required) This is the ID of the GitHub App. + +- `installation_id` - (Required) This is the ID of the GitHub App installation. + +- `pem_file` - (Required) This is the contents of the GitHub App private key PEM file. + +## Attribute Reference + +The following additional attributes are exported: + +- `token` - The generated GitHub APP JWT. diff --git a/templates/data-sources/branch.md.tmpl b/templates/data-sources/branch.md.tmpl new file mode 100644 index 0000000000..0cd38571b3 --- /dev/null +++ b/templates/data-sources/branch.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information about a repository branch. +--- + +# github\_branch + +Use this data source to retrieve information about a repository branch. + +## Example Usage + +{{ tffile "examples/data-sources/branch/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository name. + +- `branch` - (Required) The repository branch to retrieve. + +## Attribute Reference + +The following additional attributes are exported: + +- `etag` - An etag representing the Branch object. + +- `ref` - A string representing a branch reference, in the form of `refs/heads/`. + +- `sha` - A string storing the reference's `HEAD` commit's SHA1. diff --git a/templates/data-sources/branch_protection_rules.md.tmpl b/templates/data-sources/branch_protection_rules.md.tmpl new file mode 100644 index 0000000000..eabb26080b --- /dev/null +++ b/templates/data-sources/branch_protection_rules.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information about a repository branch protection rules. +--- + +# github\_branch\_protection\_rules + +Use this data source to retrieve a list of repository branch protection rules. + +## Example Usage + +{{ tffile "examples/data-sources/branch_protection_rules/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository name. + +## Attribute Reference + +- `rules` - Collection of Branch Protection Rules. Each of the results conforms to the following scheme: + + - `pattern` - Identifies the protection rule pattern. diff --git a/templates/data-sources/codespaces_organization_public_key.md.tmpl b/templates/data-sources/codespaces_organization_public_key.md.tmpl new file mode 100644 index 0000000000..09295b9b2c --- /dev/null +++ b/templates/data-sources/codespaces_organization_public_key.md.tmpl @@ -0,0 +1,18 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Codespaces Organization Public Key. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub Codespaces Organization public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an organization to retrieve it's Codespaces public key. + +## Example Usage + +{{ tffile "examples/data-sources/codespaces_organization_public_key/example_1.tf" }} + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/codespaces_organization_secrets.md.tmpl b/templates/data-sources/codespaces_organization_secrets.md.tmpl new file mode 100644 index 0000000000..cc39022e76 --- /dev/null +++ b/templates/data-sources/codespaces_organization_secrets.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get codespaces secrets of the organization +--- + +# github\_codespaces\_organization\_secrets + +Use this data source to retrieve the list of codespaces secrets of the organization. + +## Example Usage + +{{ tffile "examples/data-sources/codespaces_organization_secrets/example_1.tf" }} + +## Argument Reference + +## Attributes Reference + +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/templates/data-sources/codespaces_public_key.md.tmpl b/templates/data-sources/codespaces_public_key.md.tmpl new file mode 100644 index 0000000000..dbd9233adf --- /dev/null +++ b/templates/data-sources/codespaces_public_key.md.tmpl @@ -0,0 +1,22 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Codespaces Public Key. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub Codespaces public key. 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 it's Codespaces public key. + +## Example Usage + +{{ tffile "examples/data-sources/codespaces_public_key/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/codespaces_secrets.md.tmpl b/templates/data-sources/codespaces_secrets.md.tmpl new file mode 100644 index 0000000000..653fa46fb8 --- /dev/null +++ b/templates/data-sources/codespaces_secrets.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get codespaces secrets for a repository +--- + +# github\_codespaces\_secrets + +Use this data source to retrieve the list of codespaces secrets for a GitHub repository. + +## Example Usage + +{{ tffile "examples/data-sources/codespaces_secrets/example_1.tf" }} + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `secrets` - list of codespaces secrets for the repository + - `name` - Secret name + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/templates/data-sources/codespaces_user_public_key.md.tmpl b/templates/data-sources/codespaces_user_public_key.md.tmpl new file mode 100644 index 0000000000..ef6ae21fdd --- /dev/null +++ b/templates/data-sources/codespaces_user_public_key.md.tmpl @@ -0,0 +1,18 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Codespaces User Public Key. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub Codespaces User public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an user to retrieve it's Codespaces public key. + +## Example Usage + +{{ tffile "examples/data-sources/codespaces_user_public_key/example_1.tf" }} + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/codespaces_user_secrets.md.tmpl b/templates/data-sources/codespaces_user_secrets.md.tmpl new file mode 100644 index 0000000000..d7096dbab7 --- /dev/null +++ b/templates/data-sources/codespaces_user_secrets.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get codespaces secrets of the user +--- + +# github\_codespaces\_user\_secrets + +Use this data source to retrieve the list of codespaces secrets of the user. + +## Example Usage + +{{ tffile "examples/data-sources/codespaces_user_secrets/example_1.tf" }} + +## Argument Reference + +## Attributes Reference + +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/templates/data-sources/collaborators.md.tmpl b/templates/data-sources/collaborators.md.tmpl new file mode 100644 index 0000000000..b982267d33 --- /dev/null +++ b/templates/data-sources/collaborators.md.tmpl @@ -0,0 +1,63 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get the collaborators for a given repository. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve the collaborators for a given repository. + +## Example Usage + +{{ tffile "examples/data-sources/collaborators/example_1.tf" }} + +## Arguments Reference + +- `owner` - (Required) The organization that owns the repository. + +- `repository` - (Required) The name of the repository. + +- `affiliation` - (Optional) Filter collaborators returned by their affiliation. Can be one of: `outside`, `direct`, `all`. Defaults to `all`. + +- `permission` - (Optional) Filter collaborators returned by their permission. Can be one of: `pull`, `triage`, `push`, `maintain`, `admin`. Defaults to not doing any filtering on permission. + +## Attributes Reference + +- `collaborator` - An Array of GitHub collaborators. Each `collaborator` block consists of the fields documented below. + +--- + +The `collaborator` block consists of: + +- `login` - The collaborator's login. + +- `id` - The ID of the collaborator. + +- `url` - The GitHub API URL for the collaborator. + +- `html_url` - The GitHub HTML URL for the collaborator. + +- `followers_url` - The GitHub API URL for the collaborator's followers. + +- `following_url` - The GitHub API URL for those following the collaborator. + +- `gists_url` - The GitHub API URL for the collaborator's gists. + +- `starred_url` - The GitHub API URL for the collaborator's starred repositories. + +- `subscriptions_url` - The GitHub API URL for the collaborator's subscribed repositories. + +- `organizations_url` - The GitHub API URL for the collaborator's organizations. + +- `repos_url` - The GitHub API URL for the collaborator's repositories. + +- `events_url` - The GitHub API URL for the collaborator's events. + +- `received_events_url` - The GitHub API URL for the collaborator's received events. + +- `type` - The type of the collaborator (ex. `user`). + +- `site_admin` - Whether the user is a GitHub admin. + +- `permission` - The permission of the collaborator. diff --git a/templates/data-sources/dependabot_organization_public_key.md.tmpl b/templates/data-sources/dependabot_organization_public_key.md.tmpl new file mode 100644 index 0000000000..9221c33280 --- /dev/null +++ b/templates/data-sources/dependabot_organization_public_key.md.tmpl @@ -0,0 +1,18 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Dependabot Organization Public Key. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub Dependabot Organization public key. This data source is required to be used with other GitHub secrets interactions. Note that the provider `token` must have admin rights to an organization to retrieve it's Dependabot public key. + +## Example Usage + +{{ tffile "examples/data-sources/dependabot_organization_public_key/example_1.tf" }} + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/dependabot_organization_secrets.md.tmpl b/templates/data-sources/dependabot_organization_secrets.md.tmpl new file mode 100644 index 0000000000..a630b96d79 --- /dev/null +++ b/templates/data-sources/dependabot_organization_secrets.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get dependabot secrets of the organization +--- + +# github\_dependabot\_organization\_secrets + +Use this data source to retrieve the list of dependabot secrets of the organization. + +## Example Usage + +{{ tffile "examples/data-sources/dependabot_organization_secrets/example_1.tf" }} + +## Argument Reference + +## Attributes Reference + +- `secrets` - list of secrets for the repository + - `name` - Secret name + - `visibility` - Secret visibility + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/templates/data-sources/dependabot_public_key.md.tmpl b/templates/data-sources/dependabot_public_key.md.tmpl new file mode 100644 index 0000000000..74020ac944 --- /dev/null +++ b/templates/data-sources/dependabot_public_key.md.tmpl @@ -0,0 +1,22 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Dependabot Public Key. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub Dependabot public key. 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 it's Dependabot public key. + +## Example Usage + +{{ tffile "examples/data-sources/dependabot_public_key/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to get public key from. + +## Attributes Reference + +- `key_id` - ID of the key that has been retrieved. +- `key` - Actual key retrieved. diff --git a/templates/data-sources/dependabot_secrets.md.tmpl b/templates/data-sources/dependabot_secrets.md.tmpl new file mode 100644 index 0000000000..49a3eba279 --- /dev/null +++ b/templates/data-sources/dependabot_secrets.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get dependabot secrets for a repository +--- + +# github\_dependabot\_secrets + +Use this data source to retrieve the list of dependabot secrets for a GitHub repository. + +## Example Usage + +{{ tffile "examples/data-sources/dependabot_secrets/example_1.tf" }} + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `secrets` - list of dependabot secrets for the repository + - `name` - Secret name + - `created_at` - Timestamp of the secret creation + - `updated_at` - Timestamp of the secret last update diff --git a/templates/data-sources/enterprise.md.tmpl b/templates/data-sources/enterprise.md.tmpl new file mode 100644 index 0000000000..a1c8435bbc --- /dev/null +++ b/templates/data-sources/enterprise.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get an enterprise. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve basic information about a GitHub enterprise. + +## Example Usage + +```hcl +data "github_enterprise" "example" { + slug = "example-co" +} +``` + +## Attributes Reference + +- `id` - The ID of the enterprise. +- `database_id` - The database ID of the enterprise. +- `slug` - The URL slug identifying the enterprise. +- `name` - The name of the enterprise. +- `description` - The description of the enterprise. +- `created_at` - The time the enterprise was created. +- `url` - The url for the enterprise. diff --git a/templates/data-sources/external_groups.md.tmpl b/templates/data-sources/external_groups.md.tmpl new file mode 100644 index 0000000000..c9b8fbb4ce --- /dev/null +++ b/templates/data-sources/external_groups.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Retrieve external groups belonging to an organization. +--- + +# github\_external\_groups + +Use this data source to retrieve external groups belonging to an organization. + +## Example Usage + +{{ tffile "examples/data-sources/external_groups/example_1.tf" }} + +## Argument Reference + +N/A. This resource will retrieve all the external groups belonging to an organization. + +## Attributes Reference + +- `external_groups` - an array of external groups belonging to the organization. Each group consists of the fields documented below. + +--- + +- `group_id` - the ID of the group. +- `group_name` - the name of the group. +- `updated_at` - the date the group was last updated. diff --git a/templates/data-sources/ip_ranges.md.tmpl b/templates/data-sources/ip_ranges.md.tmpl new file mode 100644 index 0000000000..9d19c4dcb3 --- /dev/null +++ b/templates/data-sources/ip_ranges.md.tmpl @@ -0,0 +1,49 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on GitHub's IP addresses. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about GitHub's IP addresses. + +## Example Usage + +{{ tffile "examples/data-sources/ip_ranges/example_1.tf" }} + +## Attributes Reference + +- `actions` - An array of IP addresses in CIDR format specifying the addresses that incoming requests from GitHub Actions will originate from. +- `actions_ipv4` - A subset of the `actions` array that contains IP addresses in IPv4 CIDR format. +- `actions_ipv6` - A subset of the `actions` array that contains IP addresses in IPv6 CIDR format. +- `actions_macos` - An array of IP addresses in CIDR format specifying the addresses that GitHub Actions macOS runners will originate from. +- `actions_macos_ipv4` - A subset of the `actions_macos` array that contains IP addresses in IPv4 CIDR format. +- `actions_macos_ipv6` - A subset of the `actions_macos` array that contains IP addresses in IPv6 CIDR format. +- `dependabot` - **Deprecated.** Dependabot now uses GitHub Actions IP addresses. An array of IP addresses in CIDR format specifying the A records for Dependabot. +- `dependabot_ipv4` - **Deprecated.** A subset of the `dependabot` array that contains IP addresses in IPv4 CIDR format. +- `dependabot_ipv6` - **Deprecated.** A subset of the `dependabot` array that contains IP addresses in IPv6 CIDR format. +- `github_enterprise_importer` - An array of IP addresses in CIDR format specifying the addresses that GitHub Enterprise Importer will originate from. +- `github_enterprise_importer_ipv4` - A subset of the `github_enterprise_importer` array that contains IP addresses in IPv4 CIDR format. +- `github_enterprise_importer_ipv6` - A subset of the `github_enterprise_importer` array that contains IP addresses in IPv6 CIDR format. +- `hooks` - An Array of IP addresses in CIDR format specifying the addresses that incoming service hooks will originate from. +- `hooks_ipv4` - A subset of the `hooks` array that contains IP addresses in IPv4 CIDR format. +- `hooks_ipv6` - A subset of the `hooks` array that contains IP addresses in IPv6 CIDR format. +- `git` - An Array of IP addresses in CIDR format specifying the Git servers. +- `git_ipv4` - A subset of the `git` array that contains IP addresses in IPv4 CIDR format. +- `git_ipv6` - A subset of the `git` array that contains IP addresses in IPv6 CIDR format. +- `web` - An Array of IP addresses in CIDR format for GitHub Web. +- `web_ipv4` - A subset of the `web` array that contains IP addresses in IPv4 CIDR format. +- `web_ipv6` - A subset of the `web` array that contains IP addresses in IPv6 CIDR format. +- `api` - An Array of IP addresses in CIDR format for the GitHub API. +- `api_ipv4` - A subset of the `api` array that contains IP addresses in IPv4 CIDR format. +- `api_ipv6` - A subset of the `api` array that contains IP addresses in IPv6 CIDR format. +- `packages` - An Array of IP addresses in CIDR format specifying the A records for GitHub Packages. +- `packages_ipv4` - A subset of the `packages` array that contains IP addresses in IPv4 CIDR format. +- `packages_ipv6` - A subset of the `packages` array that contains IP addresses in IPv6 CIDR format. +- `pages` - An Array of IP addresses in CIDR format specifying the A records for GitHub Pages. +- `pages_ipv4` - A subset of the `pages` array that contains IP addresses in IPv4 CIDR format. +- `pages_ipv6` - A subset of the `pages` array that contains IP addresses in IPv6 CIDR format. +- `importer` - An Array of IP addresses in CIDR format specifying the A records for GitHub Importer. +- `importer_ipv4` - A subset of the `importer` array that contains IP addresses in IPv4 CIDR format. +- `importer_ipv6` - A subset of the `importer` array that contains IP addresses in IPv6 CIDR format. diff --git a/templates/data-sources/issue_labels.md.tmpl b/templates/data-sources/issue_labels.md.tmpl new file mode 100644 index 0000000000..338005a673 --- /dev/null +++ b/templates/data-sources/issue_labels.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get the labels for a given repository. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve the labels for a given repository. + +## Example Usage + +{{ tffile "examples/data-sources/issue_labels/example_1.tf" }} + +## Arguments Reference + +- `repository` - (Required) The name of the repository. + +## Attributes Reference + +- `labels` - The list of this repository's labels. Each element of `labels` has the following attributes: + - `name` - The name of the label. + - `color` - The hexadecimal color code for the label, without the leading #. + - `description` - A short description of the label. + - `url` - The URL of the label. diff --git a/templates/data-sources/membership.md.tmpl b/templates/data-sources/membership.md.tmpl new file mode 100644 index 0000000000..c034a8ee98 --- /dev/null +++ b/templates/data-sources/membership.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on user membership in an organization. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to find out if a user is a member of your organization, as well as what role they have within it. If the user's membership in the organization is pending their acceptance of an invite, the role they would have once they accept will be returned. + +## Example Usage + +{{ tffile "examples/data-sources/membership/example_1.tf" }} + +## Argument Reference + +- `username` - (Required) The username to lookup in the organization. + +- `organization` - (Optional) The organization to check for the above username. + +## Attributes Reference + +- `username` - The username. +- `role` - `admin` or `member` -- the role the user has within the organization. +- `etag` - An etag representing the membership object. +- `state` - `active` or `pending` -- the state of membership within the organization. `active` if the member has accepted the invite, or `pending` if the invite is still pending. diff --git a/templates/data-sources/organization.md.tmpl b/templates/data-sources/organization.md.tmpl new file mode 100644 index 0000000000..bc36284217 --- /dev/null +++ b/templates/data-sources/organization.md.tmpl @@ -0,0 +1,54 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get an organization. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve basic information about a GitHub Organization. + +## Example Usage + +{{ tffile "examples/data-sources/organization/example_1.tf" }} + +## Argument Reference + +- `name` - (Required) The name of the organization. +- `ignore_archived_repos` - (Optional) Whether or not to include archived repos in the `repositories` list. Defaults to `false`. +- `summary_only` - (Optional) Exclude the repos, members and other attributes from the returned result. Defaults to `false`. + +## Attributes Reference + +- `id` - The ID of the organization +- `node_id` - GraphQL global node ID for use with the v4 API +- `name` - The organization's public profile name +- `orgname` - The organization's name as used in URLs and the API +- `login` - The organization account login +- `description` - The organization account description +- `plan` - The organization account plan name +- `repositories` - (`list`) A list of the full names of the repositories in the organization formatted as `owner/name` strings +- `members` - **Deprecated**: use `users` instead by replacing `github_organization.example.members` to `github_organization.example.users[*].login` which will give you the same value, expect this field to be removed in next major version +- `users` - (`list`) A list with the members of the organization with following fields: + - `id` - The ID of the member + - `login` - The members login + - `email` - Publicly available email + - `role` - Member role `ADMIN`, `MEMBER` +- `two_factor_requirement_enabled` - Whether two-factor authentication is required for all members of the organization. +- `default_repository_permission` - Default permission level members have for organization repositories. +- `members_allowed_repository_creation_type` - The type of repository allowed to be created by members of the organization. Can be one of `ALL`, `PUBLIC`, `PRIVATE`, `NONE`. +- `members_can_create_repositories` - Whether non-admin organization members can create repositories. +- `members_can_create_internal_repositories` - Whether organization members can create internal repositories. +- `members_can_create_private_repositories` - Whether organization members can create private repositories. +- `members_can_create_public_repositories` - Whether organization members can create public repositories. +- `members_can_create_pages` - Whether organization members can create pages sites. +- `members_can_create_public_pages` - Whether organization members can create public pages sites. +- `members_can_create_private_pages` - Whether organization members can create private pages sites. +- `members_can_fork_private_repositories` - Whether organization members can create private repository forks. +- `web_commit_signoff_required` - Whether organization members must sign all commits. +- `advanced_security_enabled_for_new_repositories` - Whether advanced security is enabled for new repositories. +- `dependabot_alerts_enabled_for_new_repositories` - Whether Dependabot alerts is automatically enabled for new repositories. +- `dependabot_security_updates_enabled_for_new_repositories` - Whether Dependabot security updates is automatically enabled for new repositories. +- `dependency_graph_enabled_for_new_repositories` - Whether dependency graph is automatically enabled for new repositories. +- `secret_scanning_enabled_for_new_repositories` - Whether secret scanning is automatically enabled for new repositories. +- `secret_scanning_push_protection_enabled_for_new_repositories` - Whether secret scanning push protection is automatically enabled for new repositories. diff --git a/templates/data-sources/organization_app_installations.md.tmpl b/templates/data-sources/organization_app_installations.md.tmpl new file mode 100644 index 0000000000..6b038bf535 --- /dev/null +++ b/templates/data-sources/organization_app_installations.md.tmpl @@ -0,0 +1,37 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on all GitHub App installations of the organization. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve all GitHub App installations of the organization. + +## Example Usage + +To retrieve *all* GitHub App installations of the organization: + +{{tffile "examples/data-sources/organization_app_installations/example_1.tf"}} + +## Attributes Reference + +- `installations` - List of GitHub App installations in the organization. Each `installation` block consists of the fields documented below. + +--- + +The `installation` block consists of: + +- `id` - The ID of the GitHub App installation. +- `app_slug` - The URL-friendly name of the GitHub App. +- `app_id` - The ID of the GitHub App. +- `repository_selection` - Whether the installation has access to all repositories or only selected ones. Possible values are `all` or `selected`. +- `permissions` - A map of the permissions granted to the GitHub App installation. +- `events` - The list of events the GitHub App installation subscribes to. +- `client_id` - The OAuth client ID of the GitHub App. +- `target_id` - The ID of the account the GitHub App is installed on. +- `target_type` - The type of account the GitHub App is installed on. Possible values are `Organization` or `User`. +- `suspended` - Whether the GitHub App installation is currently suspended. +- `single_file_paths` - The list of single file paths the GitHub App installation has access to. +- `created_at` - The date the GitHub App installation was created. +- `updated_at` - The date the GitHub App installation was last updated. diff --git a/templates/data-sources/organization_custom_properties.md.tmpl b/templates/data-sources/organization_custom_properties.md.tmpl new file mode 100644 index 0000000000..45a0ddfe97 --- /dev/null +++ b/templates/data-sources/organization_custom_properties.md.tmpl @@ -0,0 +1,35 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information about a GitHub organization custom property +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub organization custom property. + +## Example Usage + +{{ tffile "examples/data-sources/organization_custom_properties/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `property_name` - (Required) The name of the custom property to retrieve. + +## Attributes Reference + +- `property_name` - The name of the custom property. + +- `value_type` - The type of the custom property. Can be one of `string`, `single_select`, `multi_select`, or `true_false`. + +- `required` - Whether the custom property is required. + +- `description` - The description of the custom property. + +- `default_value` - The default value of the custom property. + +- `allowed_values` - List of allowed values for the custom property. Only populated when `value_type` is `single_select` or `multi_select`. + +- `values_editable_by` - Who can edit the values of the custom property. Can be one of `org_actors` or `org_and_repo_actors`. diff --git a/templates/data-sources/organization_custom_role.md.tmpl b/templates/data-sources/organization_custom_role.md.tmpl new file mode 100644 index 0000000000..8e6a38d1b0 --- /dev/null +++ b/templates/data-sources/organization_custom_role.md.tmpl @@ -0,0 +1,32 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get a custom role from a GitHub Organization for use in repositories. +--- + +# github\_organization\_custom\_role + +~> **Note:** This data source is deprecated, please use the `github_organization_repository_role` data source instead. + +Use this data source to retrieve information about a custom role in a GitHub Organization. + +~> Note: Custom roles are currently only available in GitHub Enterprise Cloud. + +## Example Usage + +{{ tffile "examples/data-sources/organization_custom_role/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the custom role. + +## Attributes Reference + +The following additional attributes are exported: + +- `id` - The ID of the custom role. +- `description` - The description for the custom role. +- `base_role` - The system role from which the role inherits permissions. +- `permissions` - A list of additional permissions included in this role. diff --git a/templates/data-sources/organization_external_identities.md.tmpl b/templates/data-sources/organization_external_identities.md.tmpl new file mode 100644 index 0000000000..1d2d51655e --- /dev/null +++ b/templates/data-sources/organization_external_identities.md.tmpl @@ -0,0 +1,43 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get a list of organization members and their SAML linked external identity NameID +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve each organization member's SAML or SCIM user attributes. + +## Example Usage + +{{ tffile "examples/data-sources/organization_external_identities/example_1.tf" }} + +## Attributes Reference + +- `identities` - An Array of identities returned from GitHub + +--- + +Each element in the `identities` block consists of: + +- `login` - The username of the GitHub user +- `saml_identity` - An Object containing the user's SAML data. This object will be empty if the user is not managed by SAML. +- `scim_identity` - An Object contining the user's SCIM data. This object will be empty if the user is not managed by SCIM. + +--- + +If a user is managed by SAML, the `saml_identity` object will contain: + +- `name_id` - The member's SAML NameID +- `username` - The member's SAML Username +- `family_name` - The member's SAML Family Name +- `given_name` - The member's SAML Given Name + +--- + +If a user is managed by SCIM, the `scim_identity` object will contain: + +- `username` - The member's SCIM Username. (will be empty string if user is not managed by SCIM) +- `groups` - The member's SCIM Groups +- `family_name` - The member's SCIM Family Name +- `given_name` - The member's SCIM Given Name diff --git a/templates/data-sources/organization_ip_allow_list.md.tmpl b/templates/data-sources/organization_ip_allow_list.md.tmpl new file mode 100644 index 0000000000..6e6488a434 --- /dev/null +++ b/templates/data-sources/organization_ip_allow_list.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get the IP allow list of an organization. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about the IP allow list of an organization. The allow list for IP addresses will block access to private resources via the web, API, and Git from any IP addresses that are not on the allow list. + +## Example Usage + +{{ tffile "examples/data-sources/organization_ip_allow_list/example_1.tf" }} + +## Attributes Reference + +- `ip_allow_list` - An Array of allowed IP addresses. + +--- + +Each element in the `ip_allow_list` block consists of: + +- `id` - The ID of the IP allow list entry. +- `name` - The name of the IP allow list entry. +- `allow_list_value` - A single IP address or range of IP addresses in CIDR notation. +- `is_active` - Whether the entry is currently active. +- `created_at` - Identifies the date and time when the object was created. +- `updated_at` - Identifies the date and time when the object was last updated. diff --git a/templates/data-sources/organization_repository_role.md.tmpl b/templates/data-sources/organization_repository_role.md.tmpl new file mode 100644 index 0000000000..86610161d0 --- /dev/null +++ b/templates/data-sources/organization_repository_role.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Lookup a custom organization repository role. +--- + +# {{.Name}} ({{.Type}}) + +Lookup a custom organization repository role. + +~> **Note**: Custom organization repository roles are currently only available in GitHub Enterprise Cloud. + +## Example Usage + +{{ tffile "examples/data-sources/organization_repository_role/example_1.tf" }} + +## Schema + +### Required + +- `role_id` (Number) The ID of the organization repository role. + +### Read-Only + +- `name` (String) The name of the organization repository role. +- `description` (String) The description of the organization repository role. +- `base_role` (String) The system role from which this role inherits permissions. +- `permissions` (Set of String) The permissions included in this role. diff --git a/templates/data-sources/organization_repository_roles.md.tmpl b/templates/data-sources/organization_repository_roles.md.tmpl new file mode 100644 index 0000000000..d217b29314 --- /dev/null +++ b/templates/data-sources/organization_repository_roles.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Lookup all custom repository roles in an organization. +--- + +# {{.Name}} ({{.Type}}) + +Lookup all custom repository roles in an organization. + +~> **Note**: Custom organization repository roles are currently only available in GitHub Enterprise Cloud. + +## Example Usage + +{{ tffile "examples/data-sources/organization_repository_roles/example_1.tf" }} + +## Schema + +### Read-Only + +- `roles` (Set of Object, see [schema](#nested-schema-for-roles)) Available organization repository roles. + +## Nested Schema for `roles` + +### Read-Only + +- `role_id` (Number) The ID of the organization repository role. +- `name` (String) The name of the organization repository role. +- `description` (String) The description of the organization repository role. +- `base_role` (String) The system role from which this role inherits permissions. +- `permissions` (Set of String) The permissions included in this role. diff --git a/templates/data-sources/organization_role.md.tmpl b/templates/data-sources/organization_role.md.tmpl new file mode 100644 index 0000000000..f3fba000df --- /dev/null +++ b/templates/data-sources/organization_role.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Lookup a custom organization role. +--- + +# {{.Name}} ({{.Type}}) + +Lookup a custom organization role. + +## Example Usage + +{{ tffile "examples/data-sources/organization_role/example_1.tf" }} + +## Schema + +### Required + +- `role_id` (Number) The ID of the organization role. + +### Read-Only + +- `name` (String) The name of the organization role. +- `description` (String) The description of the organization role. +- `source` (String) The source of this role; one of `Predefined`, `Organization`, or `Enterprise`. +- `base_role` (String) The system role from which this role inherits permissions. +- `permissions` (Set of String) The permissions included in this role. diff --git a/templates/data-sources/organization_role_teams.md.tmpl b/templates/data-sources/organization_role_teams.md.tmpl new file mode 100644 index 0000000000..9219b7ffb0 --- /dev/null +++ b/templates/data-sources/organization_role_teams.md.tmpl @@ -0,0 +1,32 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Lookup all teams assigned to a custom organization role. +--- + +# {{.Name}} ({{.Type}}) + +Lookup all teams assigned to a custom organization role. + +## Example Usage + +{{ tffile "examples/data-sources/organization_role_teams/example_1.tf" }} + +## Schema + +### Required + +- `role_id` (Number) The ID of the organization role. + +### Read-Only + +- `teams` (Set of Object, see [schema](#nested-schema-for-teams)) Teams assigned to the organization role. + +## Nested Schema for `teams` + +### Read-Only + +- `team_id` (Number) The ID of the team. +- `slug` (String) The Slug of the team name. +- `name` (String) The name of the team. +- `permission` (String) The permission that the team will have for its repositories. diff --git a/templates/data-sources/organization_role_users.md.tmpl b/templates/data-sources/organization_role_users.md.tmpl new file mode 100644 index 0000000000..56e9d26212 --- /dev/null +++ b/templates/data-sources/organization_role_users.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Lookup all users assigned to a custom organization role. +--- + +# {{.Name}} ({{.Type}}) + +Lookup all users assigned to a custom organization role. + +## Example Usage + +{{ tffile "examples/data-sources/organization_role_users/example_1.tf" }} + +## Schema + +### Required + +- `role_id` (Number) The ID of the organization role. + +### Read-Only + +- `users` (Set of Object, see [schema](#nested-schema-for-users)) Users assigned to the organization role. + +## Nested Schema for `users` + +### Read-Only + +- `user_id` (Number) The ID of the user. +- `login` (String) The login for the GitHub user account. diff --git a/templates/data-sources/organization_roles.md.tmpl b/templates/data-sources/organization_roles.md.tmpl new file mode 100644 index 0000000000..15ea0ef7cd --- /dev/null +++ b/templates/data-sources/organization_roles.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Lookup all custom roles in an organization. +--- + +# {{.Name}} ({{.Type}}) + +Lookup all custom roles in an organization. + +## Example Usage + +{{ tffile "examples/data-sources/organization_roles/example_1.tf" }} + +## Schema + +### Read-Only + +- `roles` (Set of Object, see [schema](#nested-schema-for-roles)) Available organization roles. + +## Nested Schema for `roles` + +### Read-Only + +- `role_id` (Number) The ID of the organization role. +- `name` (String) The name of the organization role. +- `description` (String) The description of the organization role. +- `source` (String) The source of this role; one of `Predefined`, `Organization`, or `Enterprise`. +- `base_role` (String) The system role from which this role inherits permissions. +- `permissions` (Set of String) The permissions included in this role. diff --git a/templates/data-sources/organization_security_managers.md.tmpl b/templates/data-sources/organization_security_managers.md.tmpl new file mode 100644 index 0000000000..43d332e150 --- /dev/null +++ b/templates/data-sources/organization_security_managers.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get the security managers for an organization. +--- + +# {{.Name}} ({{.Type}}) + +~> **Note:** This data source is deprecated, please use the `github_organization_role_team` resource instead. + +Use this data source to retrieve the security managers for an organization. + +## Example Usage + +{{ tffile "examples/data-sources/organization_security_managers/example_1.tf" }} + +## Attributes Reference + +- `teams` - An list of GitHub teams. Each `team` block consists of the fields documented below. + +---___ + +The `team` block consists of: + +- `id` - Unique identifier of the team. +- `slug` - Name based identifier of the team. +- `name` - Name of the team. +- `permission` - Permission that the team will have for its repositories. diff --git a/templates/data-sources/organization_team_sync_groups.md.tmpl b/templates/data-sources/organization_team_sync_groups.md.tmpl new file mode 100644 index 0000000000..119f4639d3 --- /dev/null +++ b/templates/data-sources/organization_team_sync_groups.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get the external identity provider (IdP) groups for an organization. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve the identity provider (IdP) groups for an organization. + +## Example Usage + +{{ tffile "examples/data-sources/organization_team_sync_groups/example_1.tf" }} + +## Attributes Reference + +- `groups` - An Array of GitHub Identity Provider Groups. Each `group` block consists of the fields documented below. + +--- + +The `group` block consists of: + +- `group_id` - The ID of the IdP group. + +- `group_name` - The name of the IdP group. + +- `group_description` - The description of the IdP group. diff --git a/templates/data-sources/organization_teams.md.tmpl b/templates/data-sources/organization_teams.md.tmpl new file mode 100644 index 0000000000..f30e42aae0 --- /dev/null +++ b/templates/data-sources/organization_teams.md.tmpl @@ -0,0 +1,42 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on all GitHub teams of an organization. +--- + +# github\_organization\_teams + +Use this data source to retrieve information about all GitHub teams in an organization. + +## Example Usage + +To retrieve *all- teams of the organization: + +{{ tffile "examples/data-sources/organization_teams/example_1.tf" }} + +To retrieve only the team's at the root of the organization: + +{{ tffile "examples/data-sources/organization_teams/example_2.tf" }} + +## Attributes Reference + +- `teams` - (Required) An Array of GitHub Teams. Each `team` block consists of the fields documented below. +- `root_teams_only` - (Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to `false`. +- `summary_only` - (Optional) Exclude the members and repositories of the team from the returned result. Defaults to `false`. +- `results_per_page` - (Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to `100`. + +--- + +The `team` block consists of: + +- `id` - The ID of the team. +- `node_id` - The Node ID of the team. +- `slug` - The slug of the team. +- `name` - The team's full name. +- `description` - The team's description. +- `privacy` - The team's privacy type. +- `members` - List of team members. Not returned if `summary_only = true` +- `repositories` - List of team repositories. Not returned if `summary_only = true` +- `parent_team_id` - The ID of the parent team, if there is one. +- `parent_team_slug` - The slug of the parent team, if there is one. +- `parent` - (**DEPRECATED**) The parent team, use `parent_team_id` or `parent_team_slug` instead. diff --git a/templates/data-sources/organization_webhooks.md.tmpl b/templates/data-sources/organization_webhooks.md.tmpl new file mode 100644 index 0000000000..a78d373a0b --- /dev/null +++ b/templates/data-sources/organization_webhooks.md.tmpl @@ -0,0 +1,29 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on all GitHub webhooks of the organization. +--- + +# github\_organization\_webhooks + +Use this data source to retrieve all webhooks of the organization. + +## Example Usage + +To retrieve *all- webhooks of the organization: + +{{ tffile "examples/data-sources/organization_webhooks/example_1.tf" }} + +## Attributes Reference + +- `webhooks` - An Array of GitHub Webhooks. Each `webhook` block consists of the fields documented below. + +--- + +The `webhook` block consists of: + +- `id` - the ID of the webhook. +- `type` - the type of the webhook. +- `name` - the name of the webhook. +- `url` - the url of the webhook. +- `active` - `true` if the webhook is active. diff --git a/templates/data-sources/ref.md.tmpl b/templates/data-sources/ref.md.tmpl new file mode 100644 index 0000000000..724db9a03a --- /dev/null +++ b/templates/data-sources/ref.md.tmpl @@ -0,0 +1,33 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information about a repository ref. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a repository ref. + +## Example Usage + +{{ tffile "examples/data-sources/ref/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `owner` - (Required) Owner of the repository. + +- `repository` - (Required) The GitHub repository name. + +- `ref` - (Required) The repository ref to look up. Must be formatted `heads/` for branches, and `tags/` for tags. + +## Attribute Reference + +The following additional attributes are exported: + +- `etag` - An etag representing the ref. + +- `id` - A string storing a reference to the repository name and ref. + +- `sha` - A string storing the reference's `HEAD` commit's SHA1. diff --git a/templates/data-sources/release.md.tmpl b/templates/data-sources/release.md.tmpl new file mode 100644 index 0000000000..4d7ead0729 --- /dev/null +++ b/templates/data-sources/release.md.tmpl @@ -0,0 +1,65 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub release. +--- + +# github\_release + +Use this data source to retrieve information about a GitHub release in a specific repository. + +## Example Usage + +To retrieve the latest release that is present in a repository: + +{{ tffile "examples/data-sources/release/example_1.tf" }} + +To retrieve a specific release from a repository based on its ID: + +{{ tffile "examples/data-sources/release/example_2.tf" }} + +Finally, to retrieve a release based on its tag: + +{{ tffile "examples/data-sources/release/example_3.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the release from. + +- `owner` - (Required) Owner of the repository. + +- `retrieve_by` - (Required) Describes how to fetch the release. Valid values are `id`, `tag`, `latest`. + +- `release_id` - (Optional) ID of the release to retrieve. Must be specified when `retrieve_by` = `id`. + +- `release_tag` - (Optional) Tag of the release to retrieve. Must be specified when `retrieve_by` = `tag`. + +## Attributes Reference + +- `release_tag` - Tag of release +- `release_id` - ID of release +- `target_commitish` - Commitish value that determines where the Git release is created from +- `name` - Name of release +- `body` - Contents of the description (body) of a release +- `draft` - (`Boolean`) indicates whether the release is a draft +- `prerelease` - (`Boolean`) indicates whether the release is a prerelease +- `created_at` - Date of release creation +- `published_at` - Date of release publishing +- `url` - Base URL of the release +- `html_url` - URL directing to detailed information on the release +- `assets_url` - URL of any associated assets with the release +- `asserts_url` - **Deprecated**: Use `assets_url` resource instead +- `upload_url` - URL that can be used to upload Assets to the release +- `zipball_url` - Download URL of a specific release in `zip` format +- `tarball_url` - Download URL of a specific release in `tar.gz` format +- `assets` - Collection of assets for the release. Each asset conforms to the following schema: + - `id` - ID of the asset + - `url` - URL of the asset + - `node_id` - Node ID of the asset + - `name` - The file name of the asset + - `label` - Label for the asset + - `content_type` - MIME type of the asset + - `size` - Size in byte + - `created_at` - Date the asset was created + - `updated_at` - Date the asset was last updated + - `browser_download_url` - Browser download URL diff --git a/templates/data-sources/release_asset.md.tmpl b/templates/data-sources/release_asset.md.tmpl new file mode 100644 index 0000000000..4c600d334e --- /dev/null +++ b/templates/data-sources/release_asset.md.tmpl @@ -0,0 +1,48 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub release asset. +--- + +# github\_release\_asset + +Use this data source to retrieve information about a GitHub release asset. + +## Example Usage + +To retrieve a specific release asset from a repository based on its ID: + +{{ tffile "examples/data-sources/release_asset/example_1.tf" }} + +To retrieve a specific release asset from a repository, and download the file into a `file` attribute on the data source: + +{{ tffile "examples/data-sources/release_asset/example_2.tf" }} + +To retrieve the first release asset associated with the latest release in a repository: + +{{ tffile "examples/data-sources/release_asset/example_3.tf" }} + +To retrieve all release assets associated with the the latest release in a repository: + +{{ tffile "examples/data-sources/release_asset/example_4.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the release from +- `owner` - (Required) Owner of the repository +- `asset_id` - (Required) ID of the release asset to retrieve +- `download_file_contents` - (Optional) Whether to download the asset file content into the `file_contents` attribute (defaults to `false`) + +## Attributes Reference + +- `id` - ID of the asset +- `url` - URL of the asset +- `node_id` - Node ID of the asset +- `name` - The file name of the asset +- `label` - Label for the asset +- `content_type` - MIME type of the asset +- `size` - Asset size in bytes +- `created_at` - Date the asset was created +- `updated_at` - Date the asset was last updated +- `browser_download_url` - Browser URL from which the release asset can be downloaded +- `file_contents` - The base64-encoded release asset file contents (requires `download_file_contents` to be `true`) diff --git a/templates/data-sources/repositories.md.tmpl b/templates/data-sources/repositories.md.tmpl new file mode 100644 index 0000000000..77e258ed68 --- /dev/null +++ b/templates/data-sources/repositories.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Search for GitHub repositories +--- + +# {{.Name}} ({{.Type}}) + +-> **Note:** The data source will return a maximum of `1000` repositories [as documented in official API docs](https://developer.github.com/v3/search/#about-the-search-api). + +Use this data source to retrieve a list of GitHub repositories using a search query. + +## Example Usage + +{{ tffile "examples/data-sources/repositories/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `query` - (Required) Search query. See [documentation for the search syntax](https://help.github.com/articles/understanding-the-search-syntax/). +- `sort` - (Optional) Sorts the repositories returned by the specified attribute. Valid values include `stars`, `fork`, and `updated`. Defaults to `updated`. +- `include_repo_id` - (Optional) Returns a list of found repository IDs +- `results_per_page` - (Optional) Set the number of repositories requested per API call. Can be useful to decrease if requests are timing out or to increase to reduce the number of API calls. Defaults to 100. + +## Attributes Reference + +- `full_names` - A list of full names of found repositories (e.g. `hashicorp/terraform`) +- `names` - A list of found repository names (e.g. `terraform`) +- `repo_ids` - (Optional) A list of found repository IDs (e.g. `449898861`) diff --git a/templates/data-sources/repository.md.tmpl b/templates/data-sources/repository.md.tmpl new file mode 100644 index 0000000000..f1e389a051 --- /dev/null +++ b/templates/data-sources/repository.md.tmpl @@ -0,0 +1,125 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get details about GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Optional) The name of the repository. + +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `node_id` - the Node ID of the repository. + +- `description` - A description of the repository. + +- `homepage_url` - URL of a page describing the project. + +- `private` - Whether the repository is private. + +- `visibility` - Whether the repository is public, private or internal. + +- `has_issues` - Whether the repository has GitHub Issues enabled. + +- `has_discussions` - Whether the repository has GitHub Discussions enabled. + +- `has_projects` - Whether the repository has the GitHub Projects enabled. + +- `has_wiki` - Whether the repository has the GitHub Wiki enabled. + +- `is_template` - Whether the repository is a template repository. + +- `fork` - Whether the repository is a fork. + +- `allow_merge_commit` - Whether the repository allows merge commits. + +- `allow_squash_merge` - Whether the repository allows squash merges. + +- `allow_rebase_merge` - Whether the repository allows rebase merges. + +- `allow_auto_merge` - Whether the repository allows auto-merging pull requests. + +- `allow_forking` - Whether the repository allows private forking; this is only relevant if the repository is owned by an organization and is private or internal. + +- `squash_merge_commit_title` - The default value for a squash merge commit title. + +- `squash_merge_commit_message` - The default value for a squash merge commit message. + +- `merge_commit_title` - The default value for a merge commit title. + +- `merge_commit_message` - The default value for a merge commit message. + +- `has_downloads` - (**DEPRECATED**) Whether the repository has Downloads feature enabled. This attribute is no longer in use, but it hasn't been removed yet. It will be removed in a future version. See [this discussion](https://github.com/orgs/community/discussions/102145#discussioncomment-8351756). + +- `default_branch` - The name of the default branch of the repository. + +- `primary_language` - The primary language used in the repository. + +- `archived` - Whether the repository is archived. + +- `pages` - (**DEPRECATED**) The repository's GitHub Pages configuration. Use the `github_repository_pages` data source instead. This field will be removed in a future version. + +- `topics` - The list of topics of the repository. + +- `template` - The repository source template configuration. + +- `html_url` - URL to the repository on the web. + +- `ssh_clone_url` - URL that can be provided to `git clone` to clone the repository via SSH. + +- `http_clone_url` - URL that can be provided to `git clone` to clone the repository via HTTPS. + +- `git_clone_url` - URL that can be provided to `git clone` to clone the repository anonymously via the git protocol. + +- `svn_url` - URL that can be provided to `svn checkout` to check out the repository via GitHub's Subversion protocol emulation. + +- `node_id` - GraphQL global node id for use with v4 API + +- `repo_id` - GitHub ID for the repository + +- `repository_license` - An Array of GitHub repository licenses. Each `repository_license` block consists of the fields documented below. + +--- + +The `repository_license` block consists of: + +- `content` - Content of the license file, encoded by encoding scheme mentioned below. +- `download_url` - The URL to download the raw content of the license file. +- `encoding` - The encoding used for the content (e.g., "base64"). +- `git_url` - The URL to access information about the license file as a Git blob. +- `html_url` - The URL to view the license file on GitHub. +- `license` - `license` block consists of the fields documented below. +- `name` - The name of the license file (e.g., "LICENSE"). +- `path` - The path to the license file within the repository. +- `sha` - The SHA hash of the license file. +- `size` - The size of the license file in bytes. +- `type` - The type of the content, (e.g., "file"). +- `url` - The URL to access information about the license file on GitHub. + +The `license` block consists of: + +- `body` - The text of the license. +- `conditions` - Conditions associated with the license. +- `description` - A description of the license. +- `featured` - Indicates if the license is featured. +- `html_url` - The URL to view the license details on GitHub. +- `implementation` - Details about the implementation of the license. +- `key` - A key representing the license type (e.g., "apache-2.0"). +- `limitations` - Limitations associated with the license. +- `name` - The name of the license (e.g., "Apache License 2.0"). +- `permissions` - Permissions associated with the license. +- `spdx_id` - The SPDX identifier for the license (e.g., "Apache-2.0"). +- `url` - The URL to access information about the license on GitHub. diff --git a/templates/data-sources/repository_autolink_references.md.tmpl b/templates/data-sources/repository_autolink_references.md.tmpl new file mode 100644 index 0000000000..e09b5514e7 --- /dev/null +++ b/templates/data-sources/repository_autolink_references.md.tmpl @@ -0,0 +1,24 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get autolink references for a Github repository. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve autolink references for a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_autolink_references/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the autolink references from. + +## Attributes Reference + +- `autolink_references` - The list of this repository's autolink references. Each element of `autolink_references` has the following attributes: + - `key_prefix` - Key prefix. + - `target_url_template` - Target url template. + - `is_alphanumeric` - True if alphanumeric. diff --git a/templates/data-sources/repository_branches.md.tmpl b/templates/data-sources/repository_branches.md.tmpl new file mode 100644 index 0000000000..eef68848aa --- /dev/null +++ b/templates/data-sources/repository_branches.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub repository's branches. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about branches in a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_branches/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the branches from. + +- `only_protected_branches` - (Optional). If true, the `branches` attributes will be populated only with protected branches. Default: `false`. + +- `only_non_protected_branches` - (Optional). If true, the `branches` attributes will be populated only with non protected branches. Default: `false`. + +## Attributes Reference + +- `branches` - The list of this repository's branches. Each element of `branches` has the following attributes: + - `name` - Name of the branch. + - `protected` - Whether the branch is protected. diff --git a/templates/data-sources/repository_custom_properties.md.tmpl b/templates/data-sources/repository_custom_properties.md.tmpl new file mode 100644 index 0000000000..418a8a5731 --- /dev/null +++ b/templates/data-sources/repository_custom_properties.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get all custom properties of a repository +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve all custom properties of a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_custom_properties/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the custom properties from. + +## Attributes Reference + +- `property` - The list of this repository's custom properties. Each element of `property` has the following attributes: + - `property_name` - Name of the property + - `property_value` - Value of the property diff --git a/templates/data-sources/repository_deploy_keys.md.tmpl b/templates/data-sources/repository_deploy_keys.md.tmpl new file mode 100644 index 0000000000..8981969d8b --- /dev/null +++ b/templates/data-sources/repository_deploy_keys.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get all deploy keys of a repository +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve all deploy keys of a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_deploy_keys/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the branches from. + +## Attributes Reference + +- `keys` - The list of this repository's deploy keys. Each element of `keys` has the following attributes: + - `id` - Key id + - `title` - Key title + - `key` - Key itself + - `verified` - `true` if the key was verified. diff --git a/templates/data-sources/repository_deployment_branch_policies.md.tmpl b/templates/data-sources/repository_deployment_branch_policies.md.tmpl new file mode 100644 index 0000000000..9f6a954806 --- /dev/null +++ b/templates/data-sources/repository_deployment_branch_policies.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get the list of deployment branch policies for a given repo / env. +--- + +# {{.Name}} ({{.Type}}) + +~> **Note:** This data source is deprecated, please use the `github_repository_environment_deployment_policies` data source instead. + +Use this data source to retrieve deployment branch policies for a repository / environment. + +## Example Usage + +{{ tffile "examples/data-sources/repository_deployment_branch_policies/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the deployment branch policies from. + +- `environment_name` - (Required) Name of the environment to retrieve the deployment branch policies from. + +## Attributes Reference + +- `deployment_branch_policies` - The list of this repository / environment deployment policies. Each element of `deployment_branch_policies` has the following attributes: + - `id` - Id of the policy. + - `name` - The name pattern that branches must match in order to deploy to the environment. diff --git a/templates/data-sources/repository_environment_deployment_policies.md.tmpl b/templates/data-sources/repository_environment_deployment_policies.md.tmpl new file mode 100644 index 0000000000..508a82ed11 --- /dev/null +++ b/templates/data-sources/repository_environment_deployment_policies.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get the list of environment deployment policies for a given repository environment. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve deployment branch policies for a repository environment. + +## Example Usage + +{{ tffile "examples/data-sources/repository_environment_deployment_policies/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the deployment branch policies from. + +- `environment` - (Required) Name of the environment to retrieve the deployment branch policies from. + +## Attributes Reference + +- `policies` - The list of deployment policies for the repository environment. Each element of `policies` has the following attributes: + - `type` - Type of the policy; this could be `branch` or `tag`. + - `pattern` - The pattern that branch or tag names must match in order to deploy to the environment. diff --git a/templates/data-sources/repository_environments.md.tmpl b/templates/data-sources/repository_environments.md.tmpl new file mode 100644 index 0000000000..5e654383e7 --- /dev/null +++ b/templates/data-sources/repository_environments.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub repository's environments. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about environments for a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_environments/example_1.tf" }} + +## Argument Reference + +- `repository` - (Required) Name of the repository to retrieve the environments from. + +## Attributes Reference + +- `environments` - The list of this repository's environments. Each element of `environments` has the following attributes: + - `name` - Environment name. + - `node_id` - Environment node id. diff --git a/templates/data-sources/repository_file.md.tmpl b/templates/data-sources/repository_file.md.tmpl new file mode 100644 index 0000000000..21f7855f48 --- /dev/null +++ b/templates/data-sources/repository_file.md.tmpl @@ -0,0 +1,41 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Reads files within a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This data source allows you to read files within a GitHub repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_file/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token. + +- `file` - (Required) The path of the file to read. + +- `branch` - (Optional) Git branch. Defaults to the repository's default branch. + +## Attributes Reference + +The following additional attributes are exported: + +- `content` - The file content. + +- `commit_sha` - The SHA of the commit that modified the file. + +- `sha` - The SHA blob of the file. + +- `commit_author` - Committer author name. + +- `commit_email` - Committer email address. + +- `commit_message` - Commit message when file was last updated. + +- `ref` - The name of the commit/branch/tag. diff --git a/templates/data-sources/repository_milestone.md.tmpl b/templates/data-sources/repository_milestone.md.tmpl new file mode 100644 index 0000000000..52b4674494 --- /dev/null +++ b/templates/data-sources/repository_milestone.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub Repository Milestone. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a specific GitHub milestone in a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_milestone/example_1.tf" }} + +## Argument Reference + +- `owner` - (Required) Owner of the repository. + +- `repository` - (Required) Name of the repository to retrieve the milestone from. + +- `number` - (Required) The number of the milestone. + +## Attributes Reference + +- `description` - Description of the milestone. +- `due_date` - The milestone due date (in ISO-8601 `yyyy-mm-dd` format). +- `state` - State of the milestone. +- `title` - Title of the milestone. diff --git a/templates/data-sources/repository_pages.md.tmpl b/templates/data-sources/repository_pages.md.tmpl new file mode 100644 index 0000000000..04fd9bb160 --- /dev/null +++ b/templates/data-sources/repository_pages.md.tmpl @@ -0,0 +1,49 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on GitHub Pages for a repository +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve GitHub Pages configuration for a repository. + +## Example Usage + +{{tffile "examples/data-sources/repository_pages/example_1.tf"}} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository name to get GitHub Pages information for. + +## Attribute Reference + +The following attributes are exported: + +- `build_type` - The type of GitHub Pages site. Can be `legacy` or `workflow`. + +- `cname` - The custom domain for the repository. + +- `custom_404` - Whether the rendered GitHub Pages site has a custom 404 page. + +- `html_url` - The absolute URL (with scheme) to the rendered GitHub Pages site. + +- `source` - The source branch and directory for the rendered Pages site. See [Source](#source) below for details. + +- `build_status` - The GitHub Pages site's build status (e.g., `building` or `built`). + +- `api_url` - The API URL of the GitHub Pages resource. + +- `public` - Whether the GitHub Pages site is public. + +- `https_enforced` - Whether HTTPS is enforced for the GitHub Pages site. This setting only applies when a custom domain is configured. + +### Source + +The `source` block contains: + +- `branch` - The repository branch used to publish the site's source files. + +- `path` - The repository directory from which the site publishes. diff --git a/templates/data-sources/repository_pull_request.md.tmpl b/templates/data-sources/repository_pull_request.md.tmpl new file mode 100644 index 0000000000..480baedd33 --- /dev/null +++ b/templates/data-sources/repository_pull_request.md.tmpl @@ -0,0 +1,51 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a single GitHub Pull Request. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a specific GitHub Pull Request in a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_pull_request/example_1.tf" }} + +## Argument Reference + +- `base_repository` - (Required) Name of the base repository to retrieve the Pull Request from. + +- `number` - (Required) The number of the Pull Request within the repository. + +- `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. + +## Attributes Reference + +- `base_ref` - Name of the ref (branch) of the Pull Request base. + +- `base_sha` - Head commit SHA of the Pull Request base. + +- `body` - Body of the Pull Request. + +- `draft` - Indicates Whether this Pull Request is a draft. + +- `head_owner` - Owner of the Pull Request head repository. + +- `head_repository` - Name of the Pull Request head repository. + +- `head_sha` - Head commit SHA of the Pull Request head. + +- `labels` - List of label names set on the Pull Request. + +- `maintainer_can_modify` - Indicates whether the base repository maintainers can modify the Pull Request. + +- `opened_at` - Unix timestamp indicating the Pull Request creation time. + +- `opened_by` - GitHub login of the user who opened the Pull Request. + +- `state` - the current Pull Request state - can be "open", "closed" or "merged". + +- `title` - The title of the Pull Request. + +- `updated_at` - The timestamp of the last Pull Request update. diff --git a/templates/data-sources/repository_pull_requests.md.tmpl b/templates/data-sources/repository_pull_requests.md.tmpl new file mode 100644 index 0000000000..b5976521cd --- /dev/null +++ b/templates/data-sources/repository_pull_requests.md.tmpl @@ -0,0 +1,65 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on multiple GitHub Pull Requests. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about multiple GitHub Pull Requests in a repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_pull_requests/example_1.tf" }} + +## Argument Reference + +- `base_repository` - (Required) Name of the base repository to retrieve the Pull Requests from. + +- `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. + +- `base_ref` - (Optional) If set, filters Pull Requests by base branch name. + +- `head_ref` - (Optional) If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch". + +- `sort_by` - (Optional) If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created". + +- `sort_direction` - (Optional) If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc". + +- `state` - (Optional) If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open". + +## Attributes Reference + +- `results` - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme: + + - `base_ref` - Name of the ref (branch) of the Pull Request base. + + - `base_sha` - Head commit SHA of the Pull Request base. + + - `body` - Body of the Pull Request. + + - `draft` - Indicates Whether this Pull Request is a draft. + + - `head_owner` - Owner of the Pull Request head repository. + + - `head_ref` - Value of the Pull Request `HEAD` reference. + + - `head_repository` - Name of the Pull Request head repository. + + - `head_sha` - Head commit SHA of the Pull Request head. + + - `labels` - List of label names set on the Pull Request. + + - `maintainer_can_modify` - Indicates whether the base repository maintainers can modify the Pull Request. + + - `number` - The number of the Pull Request within the repository. + + - `opened_at` - Unix timestamp indicating the Pull Request creation time. + + - `opened_by` - GitHub login of the user who opened the Pull Request. + + - `state` - the current Pull Request state - can be "open", "closed" or "merged". + + - `title` - The title of the Pull Request. + + - `updated_at` - The timestamp of the last Pull Request update. diff --git a/templates/data-sources/repository_teams.md.tmpl b/templates/data-sources/repository_teams.md.tmpl new file mode 100644 index 0000000000..0b62fa1a57 --- /dev/null +++ b/templates/data-sources/repository_teams.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get teams which have permission on the given repo. +--- + +# github\_repository\_teams + +Use this data source to retrieve the list of teams which have access to a GitHub repository. + +## Example Usage + +{{ tffile "examples/data-sources/repository_teams/example_1.tf" }} + +## Argument Reference + +- `name` - (Optional) The name of the repository. +- `full_name` - (Optional) Full name of the repository (in `org/name` format). + +## Attributes Reference + +- `teams` - List of teams which have access to the repository + - `name` - Team name + - `slug` - Team slug + - `permission` - Team permission diff --git a/templates/data-sources/repository_webhooks.md.tmpl b/templates/data-sources/repository_webhooks.md.tmpl new file mode 100644 index 0000000000..177ec01cf3 --- /dev/null +++ b/templates/data-sources/repository_webhooks.md.tmpl @@ -0,0 +1,29 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on all GitHub webhooks of the organization. +--- + +# github\_repository\_webhooks + +Use this data source to retrieve webhooks for a given repository. + +## Example Usage + +To retrieve webhooks of a repository: + +{{ tffile "examples/data-sources/repository_webhooks/example_1.tf" }} + +## Attributes Reference + +- `webhooks` - An Array of GitHub Webhooks. Each `webhook` block consists of the fields documented below. + +--- + +The `webhook` block consists of: + +- `id` - the ID of the webhook. +- `type` - the type of the webhook. +- `name` - the name of the webhook. +- `url` - the url of the webhook. +- `active` - `true` if the webhook is active. diff --git a/templates/data-sources/rest_api.md.tmpl b/templates/data-sources/rest_api.md.tmpl new file mode 100644 index 0000000000..d3480a5885 --- /dev/null +++ b/templates/data-sources/rest_api.md.tmpl @@ -0,0 +1,25 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub resource with a custom GET request to GitHub REST API. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a GitHub resource through REST API. + +## Example Usage + +{{ tffile "examples/data-sources/rest_api/example_1.tf" }} + +## Argument Reference + +- `endpoint` - (Required) REST API endpoint to send the GET request to. + +## Attributes Reference + +- `id` - The GitHub API Request ID +- `code` - A response status code. +- `status` - A response status string. +- `headers` - A JSON string containing response headers. +- `body` - A JSON string containing response body. diff --git a/templates/data-sources/ssh_keys.md.tmpl b/templates/data-sources/ssh_keys.md.tmpl new file mode 100644 index 0000000000..c73edd40f7 --- /dev/null +++ b/templates/data-sources/ssh_keys.md.tmpl @@ -0,0 +1,17 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on GitHub's SSH keys. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about GitHub's SSH keys. + +## Example Usage + +{{ tffile "examples/data-sources/ssh_keys/example_1.tf" }} + +## Attributes Reference + +- `keys` - An array of GitHub's SSH public keys. diff --git a/templates/data-sources/team.md.tmpl b/templates/data-sources/team.md.tmpl new file mode 100644 index 0000000000..86920ae69d --- /dev/null +++ b/templates/data-sources/team.md.tmpl @@ -0,0 +1,33 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub team. +--- + +# github\_team + +Use this data source to retrieve information about a GitHub team. + +## Example Usage + +{{ tffile "examples/data-sources/team/example_1.tf" }} + +## Argument Reference + +- `slug` - (Required) The team slug. +- `membership_type` - (Optional) Type of membership to be requested to fill the list of members. Can be either `all` *(default)- or `immediate`. +- `summary_only` - (Optional) Exclude the members and repositories of the team from the returned result. Defaults to `false`. +- `results_per_page` - (**DEPRECATED**) (Optional) Set the number of results per REST API query. Accepts a value between 0 - 100 *(defaults to `100`)*. + +## Attributes Reference + +- `id` - ID of the team. +- `node_id` - Node ID of the team. +- `name` - Team's full name. +- `description` - Team's description. +- `privacy` - Team's privacy type. Can either be `closed` or `secret`. +- `notification_setting` - Teams's notification setting. Can be either `notifications_enabled` or `notifications_disabled`. +- `permission` - (**DEPRECATED**) The permission that new repositories will be added to the team with when none is specified. +- `members` - List of team members (list of GitHub usernames). Not returned if `summary_only = true`. +- `repositories` - (**DEPRECATED**) List of team repositories (list of repo names). Not returned if `summary_only = true`. +- `repositories_detailed` - List of team repositories (each item comprises of `repo_id`, `repo_name` & [`role_name`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository#permission)). Not returned if `summary_only = true`. diff --git a/templates/data-sources/tree.md.tmpl b/templates/data-sources/tree.md.tmpl new file mode 100644 index 0000000000..e02e2623c6 --- /dev/null +++ b/templates/data-sources/tree.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Returns a single tree using the SHA1 value for that tree. +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve information about a single tree. + +## Example Usage + +{{ tffile "examples/data-sources/tree/example_1.tf" }} + +## Argument Reference + +- `recursive` - (Optional) Setting this parameter to `true` returns the objects or subtrees referenced by the tree specified in `tree_sha`. +- `repository` - (Required) The name of the repository. +- `tree_sha` - (Required) The SHA1 value for the tree. + +## Attributes Reference + +- `entries` - Objects (of `path`, `mode`, `type`, `size`, and `sha`) specifying a tree structure. diff --git a/templates/data-sources/user.md.tmpl b/templates/data-sources/user.md.tmpl new file mode 100644 index 0000000000..8b9a13e3b6 --- /dev/null +++ b/templates/data-sources/user.md.tmpl @@ -0,0 +1,41 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a GitHub user. +--- + +# github\_user + +Use this data source to retrieve information about a GitHub user. + +## Example Usage + +{{ tffile "examples/data-sources/user/example_1.tf" }} + +## Argument Reference + +- `username` - (Required) The username. Use an empty string `""` to retrieve information about the currently authenticated user. + +## Attributes Reference + +- `id` - the ID of the user. +- `node_id` - the Node ID of the user. +- `login` - the user's login. +- `avatar_url` - the user's avatar URL. +- `gravatar_id` - the user's gravatar ID. +- `site_admin` - whether the user is a GitHub admin. +- `name` - the user's full name. +- `company` - the user's company name. +- `blog` - the user's blog location. +- `location` - the user's location. +- `email` - the user's email. +- `gpg_keys` - list of user's GPG keys. +- `ssh_keys` - list of user's SSH keys. +- `bio` - the user's bio. +- `public_repos` - the number of public repositories. +- `public_gists` - the number of public gists. +- `followers` - the number of followers. +- `following` - the number of following users. +- `created_at` - the creation date. +- `updated_at` - the update date. +- `suspended_at` - the suspended date if the user is suspended. diff --git a/templates/data-sources/user_external_identity.md.tmpl b/templates/data-sources/user_external_identity.md.tmpl new file mode 100644 index 0000000000..ffe0f4b324 --- /dev/null +++ b/templates/data-sources/user_external_identity.md.tmpl @@ -0,0 +1,42 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get a specific organization member's SAML/SCIM linked external identity +--- + +# {{.Name}} ({{.Type}}) + +Use this data source to retrieve a specific organization member's SAML or SCIM user attributes. + +## Example Usage + +{{ tffile "examples/data-sources/user_external_identity/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `username` - (Required) The username of the member to fetch external identity for. + +## Attributes Reference + +- `login` - The username of the GitHub user +- `saml_identity` - An Object containing the user's SAML data. This object will be empty if the user is not managed by SAML. +- `scim_identity` - An Object contining the user's SCIM data. This object will be empty if the user is not managed by SCIM. + +--- + +If a user is managed by SAML, the `saml_identity` object will contain: + +- `name_id` - The member's SAML NameID +- `username` - The member's SAML Username +- `family_name` - The member's SAML Family Name +- `given_name` - The member's SAML Given Name + +--- + +If a user is managed by SCIM, the `scim_identity` object will contain: + +- `scim_username` - The member's SCIM Username. (will be empty string if user is not managed by SCIM) +- `scim_family_name` - The member's SCIM Family Name +- `scim_given_name` - The member's SCIM Given Name diff --git a/templates/data-sources/users.md.tmpl b/templates/data-sources/users.md.tmpl new file mode 100644 index 0000000000..935fe481f6 --- /dev/null +++ b/templates/data-sources/users.md.tmpl @@ -0,0 +1,24 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information about multiple GitHub users. +--- + +# github\_users + +Use this data source to retrieve information about multiple GitHub users at once. + +## Example Usage + +{{ tffile "examples/data-sources/users/example_1.tf" }} + +## Argument Reference + +- `usernames` - (Required) List of usernames. + +## Attributes Reference + +- `node_ids` - list of Node IDs of users that could be found. +- `logins` - list of logins of users that could be found. +- `emails` - list of the user's publicly visible profile email (will be empty string in case if user decided not to show it). +- `unknown_logins` - list of logins without matching user. diff --git a/templates/index.md.tmpl b/templates/index.md.tmpl new file mode 100644 index 0000000000..bd0d4d46e3 --- /dev/null +++ b/templates/index.md.tmpl @@ -0,0 +1,91 @@ +--- +page_title: "{{.RenderedProviderName}} Provider" +description: |- + The GitHub provider is used to interact with GitHub resources. +--- + +# {{.RenderedProviderName}} Provider + +The GitHub provider is used to interact with GitHub resources. + +The provider allows you to manage your GitHub organization's members and teams easily. It needs to be configured with the proper credentials before it can be used. + +Use the navigation to the left to read about the available resources. + +## Example Usage + +Terraform 0.13 and later: + +{{ tffile "examples/example_1.tf" }} + +- You **must*- add a `required_providers` block to every module that will create resources with this provider. If you do not explicitly require `integrations/github` in a submodule, your terraform run may [break in hard-to-troubleshoot ways](https://github.com/integrations/terraform-provider-github/issues/876#issuecomment-1303790559). + +Terraform 0.12 and earlier: + +{{ tffile "examples/example_2.tf"}} + +~> **Note:** When upgrading from `hashicorp/github` to `integrations/github`, use `terraform state replace-provider`. Otherwise, Terraform will still require the old provider to interact with the state file. + +## Authentication + +The GitHub provider offers multiple ways to authenticate with GitHub API. + +### GitHub CLI + +The GitHub provider taps into [GitHub CLI](https://cli.github.com/) authentication, where it picks up the token issued by [`gh auth login`](https://cli.github.com/manual/gh_auth_login) command. It is possible to specify the path to the `gh` executable in the `GH_PATH` environment variable, which is useful for when the GitHub Terraform provider can not properly determine its the path to GitHub CLI such as in the cygwin terminal. + +### OAuth / Personal Access Token + +To authenticate using OAuth tokens, ensure that the `token` argument or the `GITHUB_TOKEN` environment variable is set. + +{{ tffile "examples/example_3.tf" }} + +### GitHub App Installation + +To authenticate using a GitHub App installation, ensure that arguments in the `app_auth` block or the `GITHUB_APP_XXX` environment variables are set. The `owner` parameter required in this situation. Leaving out will throw a `403 "Resource not accessible by integration"` error. + +Some API operations may not be available when using a GitHub App installation configuration. For more information, refer to the list of [supported endpoints](https://docs.github.com/en/rest/overview/endpoints-available-for-github-apps). + +{{ tffile "examples/example_4.tf" }} + +~> **Note:** When using environment variables, an empty `app_auth` block is required to allow provider configurations from environment variables to be specified. See: + +{{ tffile "examples/example_5.tf" }} + +## Argument Reference + +The following arguments are supported in the `provider` block: + +- `token` - (Optional) A GitHub OAuth / Personal Access Token. When not provided or made available via the `GITHUB_TOKEN` environment variable, the provider can only access resources available anonymously. + +- `base_url` - (Optional) This is the target GitHub base API endpoint. Providing a value is a requirement when working with GitHub Enterprise. It is optional to provide this value and it can also be sourced from the `GITHUB_BASE_URL` environment variable. The value must end with a slash, for example: `https://terraformtesting-ghe.westus.cloudapp.azure.com/` + +- `owner` - (Optional) This is the target GitHub organization or individual user account to manage. For example, `torvalds` and `github` are valid owners. It is optional to provide this value and it can also be sourced from the `GITHUB_OWNER` environment variable. When not provided and a `token` is available, the individual user account owning the `token` will be used. When not provided and no `token` is available, the provider may not function correctly. It is required in case of GitHub App Installation. + +- `organization` - (Deprecated) This behaves the same as `owner`, which should be used instead. This value can also be sourced from the `GITHUB_ORGANIZATION` environment variable. + +- `app_auth` - (Optional) Configuration block to use GitHub App installation token. When not provided, the provider can only access resources available anonymously. + - `id` - (Required) This is the ID of the GitHub App. It can sourced from the `GITHUB_APP_ID` environment variable. + - `installation_id` - (Required) This is the ID of the GitHub App installation. It can sourced from the `GITHUB_APP_INSTALLATION_ID` environment variable. + - `pem_file` - (Required) This is the contents of the GitHub App private key PEM file. It can also be sourced from the `GITHUB_APP_PEM_FILE` environment variable and may use `\n` instead of actual new lines. + +- `write_delay_ms` - (Optional) The number of milliseconds to sleep in between write operations in order to satisfy the GitHub API rate limits. Note that requests to the GraphQL API are implemented as `POST` requests under the hood, so this setting affects those calls as well. Defaults to 1000ms or 1 second if not provided. + +- `retry_delay_ms` - (Optional) Amount of time in milliseconds to sleep in between requests to GitHub API after an error response. Defaults to 1000ms or 1 second if not provided, the max_retries must be set to greater than zero. + +- `read_delay_ms` - (Optional) The number of milliseconds to sleep in between non-write operations in order to satisfy the GitHub API rate limits. Defaults to 0ms. + +- `retryable_errors` - (Optional) "Allow the provider to retry after receiving an error status code, the max_retries should be set for this to work. Defaults to [500, 502, 503, 504] + +- `max_retries` - (Optional) Number of times to retry a request after receiving an error status code. Defaults to 3 + +Note: If you have a PEM file on disk, you can pass it in via `pem_file = file("path/to/file.pem")`. + +For backwards compatibility, if more than one of `owner`, `organization`, `GITHUB_OWNER` and `GITHUB_ORGANIZATION` are set, the first in this list takes priority. + +1. Setting `organization` in the GitHub provider configuration. +2. Setting the `GITHUB_ORGANIZATION` environment variable. +3. Setting the `GITHUB_OWNER` environment variable. +4. Setting `owner` in the GitHub provider configuration. + +~> It is a bug that `GITHUB_OWNER` takes precedence over `owner`, which may be fixed in a future major release. For compatibility with future releases, please set only one of `GITHUB_OWNER` and `owner`. diff --git a/templates/resources.md.tmpl b/templates/resources.md.tmpl new file mode 100644 index 0000000000..3bb5a23038 --- /dev/null +++ b/templates/resources.md.tmpl @@ -0,0 +1,26 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.ProviderName}}" +subcategory: "" +description: |- +{{ .Description | plainmarkdown | trimspace | prefixlines " " }} +--- + +# {{.Name}} ({{.Type}}) + +{{ .Description | trimspace }} + +{{ if .HasExample -}} +## Example Usage + +{{tffile .ExampleFile }} +{{- end }} + +{{ .SchemaMarkdown | trimspace }} +{{- if .HasImport }} + +## Import + +Import is supported using the following syntax: + +{{codefile "shell" .ImportFile }} +{{- end }} diff --git a/templates/resources/actions_environment_secret.md.tmpl b/templates/resources/actions_environment_secret.md.tmpl new file mode 100644 index 0000000000..eda57c9fad --- /dev/null +++ b/templates/resources/actions_environment_secret.md.tmpl @@ -0,0 +1,67 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Action Secret within a GitHub repository environment +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions secrets within your GitHub repository environments. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/actions_environment_secret/example_1.tf" }} + +{{ tffile "examples/resources/actions_environment_secret/example_2.tf" }} + +## Example Lifecycle Ignore Changes + +This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. + +{{ tffile "examples/resources/actions_environment_secret/example_3.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) Name of the repository. +- `environment` - (Required) Name of the environment. +- `secret_name` - (Required) Name of the secret. +- `key_id` - (Optional) ID of the public key used to encrypt the secret, required when setting `encrypted_value`. +- `value` - (Optional) Plaintext value of the secret to be encrypted. This conflicts with `value_encrypted`, `encrypted_value` & `plaintext_value`. +- `value_encrypted` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format, `key_id` is required with this value. This conflicts with `value`, `encrypted_value` & `plaintext_value`. +- `encrypted_value` - (**DEPRECATED**)(Optional) Please use `value_encrypted`. +- `plaintext_value` - (**DEPRECATED**)(Optional) Please use `value`. + +~> **Note**: One of either `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` must be specified. + +## Attributes Reference + +- `repository_id` - ID of the repository. +- `created_at` - Date the secret was created. +- `updated_at` - Date the secret was last updated by the provider. +- `remote_updated_at` - Date the secret was last updated in GitHub. + +## Import + +This resource can be imported using an ID made of the repository name, environment name (URL escaped), and secret name all separated by a `:`. + +~> **Note**: When importing secrets, the `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` fields will not be populated in the state. You may need to ignore changes for these as a workaround if you're not planning on updating the secret through Terraform. + +### Import Block + +The following import imports a GitHub actions environment secret named `mysecret` for the repo `myrepo` and environment `myenv` to a `github_actions_environment_secret` resource named `example`. + +{{ tffile "examples/resources/actions_environment_secret/example_4.tf" }} + +### Import Command + +The following command imports a GitHub actions environment secret named `mysecret` for the repo `myrepo` and environment `myenv` to a `github_actions_environment_secret` resource named `example`. + +```shell +terraform import github_actions_environment_secret.example myrepo:myenv:mysecret +``` diff --git a/templates/resources/actions_environment_variable.md.tmpl b/templates/resources/actions_environment_variable.md.tmpl new file mode 100644 index 0000000000..df2da6a8ad --- /dev/null +++ b/templates/resources/actions_environment_variable.md.tmpl @@ -0,0 +1,48 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Action variable within a GitHub repository environment +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions variables within your GitHub repository environments. You must have write access to a repository to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_environment_variable/example_1.tf" }} + +{{ tffile "examples/resources/actions_environment_variable/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) Name of the repository. +- `environment` - (Required) Name of the environment. +- `variable_name` - (Required) Name of the variable. +- `value` - (Required) Value of the variable. + +## Attributes Reference + +- `repository_id` - ID of the repository. +- `created_at` - Date the variable was created. +- `updated_at` - Date the variable was last updated. + +## Import + +This resource can be imported using an ID made of the repository name, environment name (any `:` in the environment name need to be escaped as `??`), and variable name all separated by a `:`. + +### Import Block + +The following import imports a GitHub actions environment variable named `myvariable` for the repo `myrepo` and environment `myenv` to a `github_actions_environment_variable` resource named `example`. + +{{ tffile "examples/resources/actions_environment_variable/example_3.tf" }} + +### Import Command + +The following command imports a GitHub actions environment variable named `myvariable` for the repo `myrepo` and environment `myenv` to a `github_actions_environment_variable` resource named `example`. + +```shell +terraform import github_actions_environment_variable.example myrepo:myenv:myvariable +``` diff --git a/templates/resources/actions_hosted_runner.md.tmpl b/templates/resources/actions_hosted_runner.md.tmpl new file mode 100644 index 0000000000..54ee076fb6 --- /dev/null +++ b/templates/resources/actions_hosted_runner.md.tmpl @@ -0,0 +1,101 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages GitHub-hosted runners within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub-hosted runners within your GitHub organization. You must have admin access to an organization to use this resource. + +GitHub-hosted runners are fully managed virtual machines that run your GitHub Actions workflows. Unlike self-hosted runners, GitHub handles the infrastructure, maintenance, and scaling. + +## Example Usage + +### Basic Usage + +{{ tffile "examples/resources/actions_hosted_runner/example_1.tf" }} + +### Advanced Usage with Optional Parameters + +{{ tffile "examples/resources/actions_hosted_runner/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) Name of the hosted runner. Must be between 1 and 64 characters and may only contain alphanumeric characters, '.', '-', and '_'. +- `image` - (Required) Image configuration for the hosted runner. Cannot be changed after creation. Block supports: + - `id` - (Required) The image ID. For GitHub-owned images, use numeric IDs like "2306" for Ubuntu Latest 24.04. To get available images, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/images/github-owned`. + - `source` - (Optional) The image source. Valid values are "github", "partner", or "custom". Defaults to "github". +- `size` - (Required) Machine size for the hosted runner (e.g., "4-core", "8-core"). Can be updated to scale the runner. To list available sizes, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/machine-sizes`. +- `runner_group_id` - (Required) The ID of the runner group to assign this runner to. +- `maximum_runners` - (Optional) Maximum number of runners to scale up to. Runners will not auto-scale above this number. Use this setting to limit costs. +- `public_ip_enabled` - (Optional) Whether to enable static public IP for the runner. Note there are account limits. To list limits, use the GitHub API: `GET /orgs/{org}/actions/hosted-runners/limits`. Defaults to false. +- `image_version` - (Optional) The version of the runner image to deploy. This is only relevant for runners using custom images. + +## Timeouts + +The `timeouts` block allows you to specify timeouts for certain actions: + +- `delete` - (Defaults to 10 minutes) Used for waiting for the hosted runner deletion to complete. + +Example: + +{{ tffile "examples/resources/actions_hosted_runner/example_3.tf" }} + +## Attributes Reference + +In addition to the arguments above, the following attributes are exported: + +- `id` - The ID of the hosted runner. +- `status` - Current status of the runner (e.g., "Ready", "Provisioning"). +- `platform` - Platform of the runner (e.g., "linux-x64", "win-x64"). +- `image` - In addition to the arguments above, the image block exports: + - `size_gb` - The size of the image in gigabytes. +- `machine_size_details` - Detailed specifications of the machine size: + - `id` - Machine size identifier. + - `cpu_cores` - Number of CPU cores. + - `memory_gb` - Amount of memory in gigabytes. + - `storage_gb` - Amount of storage in gigabytes. +- `public_ips` - List of public IP ranges assigned to this runner (only if `public_ip_enabled` is true): + - `enabled` - Whether this IP range is enabled. + - `prefix` - IP address prefix. + - `length` - Subnet length. +- `last_active_on` - Timestamp (RFC3339) when the runner was last active. + +## Import + +Hosted runners can be imported using the runner ID: + +```shell +terraform import github_actions_hosted_runner.example 123456 +``` + +## Notes + +- This resource is **organization-only*- and cannot be used with individual accounts. +- The `image` field cannot be changed after the runner is created. Changing it will force recreation of the runner. +- The `size` field can be updated to scale the runner up or down as needed. +- Image IDs for GitHub-owned images are numeric strings (e.g., "2306" for Ubuntu Latest 24.04), not names like "ubuntu-latest". +- Deletion of hosted runners is asynchronous. The provider will poll for up to 10 minutes (configurable via timeouts) to confirm deletion. +- Runner creation and updates may take several minutes as GitHub provisions the infrastructure. +- Static public IPs are subject to account limits. Check your organization's limits before enabling. + +## Getting Available Images and Sizes + +To get a list of available images: + +```bash +curl -H "Authorization: Bearer YOUR_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/orgs/YOUR_ORG/actions/hosted-runners/images/github-owned +``` + +To get available machine sizes: + +```bash +curl -H "Authorization: Bearer YOUR_TOKEN" \ + -H "Accept: application/vnd.github+json" \ + https://api.github.com/orgs/YOUR_ORG/actions/hosted-runners/machine-sizes +``` diff --git a/templates/resources/actions_organization_oidc_subject_claim_customization_template.md.tmpl b/templates/resources/actions_organization_oidc_subject_claim_customization_template.md.tmpl new file mode 100644 index 0000000000..0e345eca88 --- /dev/null +++ b/templates/resources/actions_organization_oidc_subject_claim_customization_template.md.tmpl @@ -0,0 +1,29 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an OpenID Connect subject claim customization template for an organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage an OpenID Connect subject claim customization template within a GitHub organization. + +More information on integrating GitHub with cloud providers using OpenID Connect and a list of available claims is available in the [Actions documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). + +## Example Usage + +{{ tffile "examples/resources/actions_organization_oidc_subject_claim_customization_template/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `include_claim_keys` - (Required) A list of OpenID Connect claims. + +## Import + +This resource can be imported using the organization's name. + +```shell +terraform import github_actions_organization_oidc_subject_claim_customization_template.test example_organization +``` diff --git a/templates/resources/actions_organization_permissions.md.tmpl b/templates/resources/actions_organization_permissions.md.tmpl new file mode 100644 index 0000000000..d15662e05a --- /dev/null +++ b/templates/resources/actions_organization_permissions.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages Actions permissions within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions permissions within your GitHub enterprise organizations. You must have admin access to an organization to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_permissions/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. +- `enabled_repositories` - (Required) The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. +- `allowed_actions_config` - (Optional) Sets the actions that are allowed in an organization. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details. +- `enabled_repositories_config` - (Optional) Sets the list of selected repositories that are enabled for GitHub Actions in an organization. Only available when `enabled_repositories` = `selected`. See [Enabled Repositories Config](#enabled-repositories-config) below for details. +- `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the organization. + +### Allowed Actions Config + +The `allowed_actions_config` block supports the following: + +- `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the organization. +- `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*." +- `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators. + +### Enabled Repositories Config + +The `enabled_repositories_config` block supports the following: + +- `repository_ids` - (Required) List of repository IDs to enable for GitHub Actions. + +## Import + +This resource can be imported using the name of the GitHub organization: + +```shell +terraform import github_actions_organization_permissions.test github_organization_name +``` diff --git a/templates/resources/actions_organization_secret.md.tmpl b/templates/resources/actions_organization_secret.md.tmpl new file mode 100644 index 0000000000..e8397808c8 --- /dev/null +++ b/templates/resources/actions_organization_secret.md.tmpl @@ -0,0 +1,67 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Action Secret within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions secrets within your GitHub organization. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_secret/example_1.tf" }} + +{{ tffile "examples/resources/actions_organization_secret/example_2.tf" }} + +## Example Lifecycle Ignore Changes + +This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. + +{{ tffile "examples/resources/actions_organization_secret/example_3.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the secret. +- `key_id` - (Optional) ID of the public key used to encrypt the secret, required when setting `encrypted_value`. +- `value` - (Optional) Plaintext value of the secret to be encrypted. This conflicts with `value_encrypted`, `encrypted_value` & `plaintext_value`. +- `value_encrypted` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format, `key_id` is required with this value. This conflicts with `value`, `encrypted_value` & `plaintext_value`. +- `encrypted_value` - (**DEPRECATED**)(Optional) Please use `value_encrypted`. +- `plaintext_value` - (**DEPRECATED**)(Optional) Please use `value`. +- `visibility` - (Required) Configures the access that repositories have to the organization secret; must be one of `all`, `private`, or `selected`. +- `selected_repository_ids` - (Optional) An array of repository IDs that can access the organization variable; this requires `visibility` to be set to `selected`. +- `destroy_on_drift` - (**DEPRECATED**) (Optional) This is ignored as drift detection is built into the resource. + +~> **Note**: One of either `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` must be specified. + +## Attributes Reference + +- `created_at` - Date the secret was created. +- `updated_at` - Date the secret was last updated by the provider. +- `remote_updated_at` - Date the secret was last updated in GitHub. + +## Import + +This resource can be imported using the secret name as the ID. + +~> **Note**: When importing secrets, the `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` fields will not be populated in the state. You may need to ignore changes for these as a workaround if you're not planning on updating the secret through Terraform. + +### Import Block + +The following import imports a GitHub actions organization secret named `mysecret` to a `github_actions_organization_secret` resource named `example`. + +{{ tffile "examples/resources/actions_organization_secret/example_4.tf" }} + +### Import Command + +The following command imports a GitHub actions organization secret named `mysecret` to a `github_actions_organization_secret` resource named `example`. + +```shell +terraform import github_actions_organization_secret.example mysecret +``` diff --git a/templates/resources/actions_organization_secret_repositories.md.tmpl b/templates/resources/actions_organization_secret_repositories.md.tmpl new file mode 100644 index 0000000000..429ba5de1b --- /dev/null +++ b/templates/resources/actions_organization_secret_repositories.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages repository allow list for an Actions Secret within a GitHub organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage the repositories allowed to access an actions secret within your GitHub organization. You must have write access to an organization secret to use this resource. + +This resource is only applicable when `visibility` of the existing organization secret has been set to `selected`. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_secret_repositories/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the actions organization secret. +- `selected_repository_ids` - (Required) List of IDs for the repositories that should be able to access the secret. + +## Import + +This resource can be imported using the secret name as the ID. + +### Import Block + +The following import block imports the repositories able to access the actions organization secret named `mysecret` to a `github_actions_organization_secret_repositories` resource named `example`. + +{{ tffile "examples/resources/actions_organization_secret_repositories/example_2.tf" }} + +### Import Command + +The following command imports the repositories able to access the actions organization secret named `mysecret` to a `github_actions_organization_secret_repositories` resource named `example`. + +```shell +terraform import github_actions_organization_secret_repositories.example mysecret +``` diff --git a/templates/resources/actions_organization_secret_repository.md.tmpl b/templates/resources/actions_organization_secret_repository.md.tmpl new file mode 100644 index 0000000000..377bcabd33 --- /dev/null +++ b/templates/resources/actions_organization_secret_repository.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Add access for a repository to an Actions Secret within a GitHub organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource adds permission for a repository to use an actions secret within your GitHub organization. You must have write access to an organization secret to use this resource. + +This resource is only applicable when `visibility` of the existing organization secret has been set to `selected`. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_secret_repository/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the actions organization secret. +- `repository_id` - (Required) ID of the repository that should be able to access the secret. + +## Import + +This resource can be imported using an ID made of the secret name and repository name separated by a `:`. + +### Import Block + +The following import block imports the access of repository ID `123456` for the actions organization secret named `mysecret` to a `github_actions_organization_secret_repository` resource named `example`. + +{{ tffile "examples/resources/actions_organization_secret_repository/example_2.tf" }} + +### Import Command + +The following command imports the access of repository ID `123456` for the actions organization secret named `mysecret` to a `github_actions_organization_secret_repository` resource named `example`. + +```shell +terraform import github_actions_organization_secret_repository.example mysecret:123456 +``` diff --git a/templates/resources/actions_organization_variable.md.tmpl b/templates/resources/actions_organization_variable.md.tmpl new file mode 100644 index 0000000000..10738e09ca --- /dev/null +++ b/templates/resources/actions_organization_variable.md.tmpl @@ -0,0 +1,47 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Action variable within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions variables within your GitHub organization. You must have write access to a repository to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_variable/example_1.tf" }} + +{{ tffile "examples/resources/actions_organization_variable/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `variable_name` - (Required) Name of the variable. +- `value` - (Required) Value of the variable. +- `visibility` - (Required) Configures the access that repositories have to the organization variable; must be one of `all`, `private`, or `selected`. +- `selected_repository_ids` - (Optional) An array of repository IDs that can access the organization variable; this requires `visibility` to be set to `selected`. + +## Attributes Reference + +- `created_at` - Date the variable was created. +- `updated_at` - Date the variable was last updated. + +## Import + +This resource can be imported using the variable name as the ID. + +### Import Block + +The following import imports a GitHub actions organization variable named `myvariable`to a `github_actions_organization_variable` resource named `example`. + +{{ tffile "examples/resources/actions_organization_variable/example_3.tf" }} + +### Import Command + +The following command imports a GitHub actions organization variable named `myvariable` to a `github_actions_organization_variable` resource named `example`. + +```shell +terraform import github_actions_organization_variable.example myvariable +``` diff --git a/templates/resources/actions_organization_variable_repositories.md.tmpl b/templates/resources/actions_organization_variable_repositories.md.tmpl new file mode 100644 index 0000000000..b31dc9f796 --- /dev/null +++ b/templates/resources/actions_organization_variable_repositories.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages repository allow list for an Actions Variable within a GitHub organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage the repositories allowed to access an actions variable within your GitHub organization. You must have write access to an organization variable to use this resource. + +This resource is only applicable when `visibility` of the existing organization variable has been set to `selected`. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_variable_repositories/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `variable_name` - (Required) Name of the actions organization variable. +- `selected_repository_ids` - (Required) List of IDs for the repositories that should be able to access the variable. + +## Import + +This resource can be imported using the variable name as the ID. + +### Import Block + +The following import block imports the repositories able to access the actions organization variable named `myvariable` to a `github_actions_organization_variable_repositories` resource named `example`. + +{{ tffile "examples/resources/actions_organization_variable_repositories/example_2.tf" }} + +### Import Command + +The following command imports the repositories able to access the actions organization variable named `myvariable` to a `github_actions_organization_variable_repositories` resource named `example`. + +```shell +terraform import github_actions_organization_variable_repositories.example myvariable +``` diff --git a/templates/resources/actions_organization_variable_repository.md.tmpl b/templates/resources/actions_organization_variable_repository.md.tmpl new file mode 100644 index 0000000000..8bac3b079a --- /dev/null +++ b/templates/resources/actions_organization_variable_repository.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Add access for a repository to an Actions Variable within a GitHub organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource adds permission for a repository to use an actions variables within your GitHub organization. You must have write access to an organization variable to use this resource. + +This resource is only applicable when `visibility` of the existing organization variable has been set to `selected`. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_variable_repository/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `variable_name` - (Required) Name of the actions organization variable. +- `repository_id` - (Required) ID of the repository that should be able to access the variable. + +## Import + +This resource can be imported using an ID made of the variable name and repository name separated by a `:`. + +### Import Block + +The following import block imports the access of repository ID `123456` for the actions organization variable named `myvariable` to a `github_actions_organization_variable_repository` resource named `example`. + +{{ tffile "examples/resources/actions_organization_variable_repository/example_2.tf" }} + +### Import Command + +The following command imports the access of repository ID `123456` for the actions organization variable named `myvariable` to a `github_actions_organization_variable_repository` resource named `example`. + +```shell +terraform import github_actions_organization_variable_repository.example myvariable:123456 +``` diff --git a/templates/resources/actions_organization_workflow_permissions.md.tmpl b/templates/resources/actions_organization_workflow_permissions.md.tmpl new file mode 100644 index 0000000000..1c5f9eb974 --- /dev/null +++ b/templates/resources/actions_organization_workflow_permissions.md.tmpl @@ -0,0 +1,48 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages GitHub Actions workflow permissions for a GitHub Organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage GitHub Actions workflow permissions for a GitHub Organization account. This controls the default permissions granted to the GITHUB_TOKEN when running workflows and whether GitHub Actions can approve pull request reviews. + +You must have organization admin access to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_organization_workflow_permissions/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `organization_slug` - (Required) The slug of the organization. + +- `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be `read` or `write`. Defaults to `read`. + +- `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull request reviews. Defaults to `false`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The organization slug. + +## Import + +Organization Actions workflow permissions can be imported using the organization slug: + +```sh +terraform import github_actions_organization_workflow_permissions.example my-organization +``` + +## Notes + +~> **Note:** This resource requires a GitHub Organization account and organization admin permissions. + +When this resource is destroyed, the workflow permissions will be reset to safe defaults: + +- `default_workflow_permissions` = `read` +- `can_approve_pull_request_reviews` = `false` diff --git a/templates/resources/actions_repository_access_level.md.tmpl b/templates/resources/actions_repository_access_level.md.tmpl new file mode 100644 index 0000000000..9f3ab7a8d7 --- /dev/null +++ b/templates/resources/actions_repository_access_level.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages Actions and Reusable Workflow access for a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to set the access level of a non-public repositories actions and reusable workflows for use in other repositories. You must have admin access to a repository to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_repository_access_level/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository +- `access_level` - (Required) Where the actions or reusable workflows of the repository may be used. Possible values are `none`, `user`, `organization`, or `enterprise`. + +## Import + +This resource can be imported using the name of the GitHub repository: + +```hcl +$ terraform import github_actions_repository_access_level.test my-repository +``` diff --git a/templates/resources/actions_repository_oidc_subject_claim_customization_template.md.tmpl b/templates/resources/actions_repository_oidc_subject_claim_customization_template.md.tmpl new file mode 100644 index 0000000000..3064cebd64 --- /dev/null +++ b/templates/resources/actions_repository_oidc_subject_claim_customization_template.md.tmpl @@ -0,0 +1,38 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an OpenID Connect subject claim customization template for a repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage an OpenID Connect subject claim customization template for a GitHub repository. + +More information on integrating GitHub with cloud providers using OpenID Connect and a list of available claims is available in the [Actions documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). + +The following table lists the behaviour of `use_default`: + +| `use_default` | `include_claim_keys` | Template used | +|---------------|----------------------|-----------------------------------------------------------| +| `true` | Unset | GitHub's default | +| `false` | Set | `include_claim_keys` | +| `false` | Unset | Organization's default if set, otherwise GitHub's default | + +## Example Usage + +{{ tffile "examples/resources/actions_repository_oidc_subject_claim_customization_template/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `use_default` - (Required) Whether to use the default template or not. If `true`, `include_claim_keys` must not be set. +- `include_claim_keys` - (Optional) A list of OpenID Connect claims. + +## Import + +This resource can be imported using the repository's name. + +```hcl +$ terraform import github_actions_repository_oidc_subject_claim_customization_template.test example_repository +``` diff --git a/templates/resources/actions_repository_permissions.md.tmpl b/templates/resources/actions_repository_permissions.md.tmpl new file mode 100644 index 0000000000..3ae0b968e5 --- /dev/null +++ b/templates/resources/actions_repository_permissions.md.tmpl @@ -0,0 +1,39 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Enables and manages Actions permissions for a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to enable and manage GitHub Actions permissions for a given repository. You must have admin access to an repository to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_repository_permissions/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository +- `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. +- `enabled` - (Optional) Should GitHub actions be enabled on this repository? +- `allowed_actions_config` - (Optional) Sets the actions that are allowed in an repository. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details. +- `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the repository. + +### Allowed Actions Config + +The `allowed_actions_config` block supports the following: + +- `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the repository. +- `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*." +- `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators. + +## Import + +This resource can be imported using the name of the GitHub repository: + +```hcl +$ terraform import github_actions_repository_permissions.test my-repository +``` diff --git a/templates/resources/actions_runner_group.md.tmpl b/templates/resources/actions_runner_group.md.tmpl new file mode 100644 index 0000000000..5e3cac4c4d --- /dev/null +++ b/templates/resources/actions_runner_group.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Actions Runner Group within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions runner groups within your GitHub enterprise organizations. You must have admin access to an organization to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_runner_group/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) Name of the runner group +- `restricted_to_workflows` - (Optional) If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. +- `selected_repository_ids` - (Optional) IDs of the repositories which should be added to the runner group +- `selected_workflows` - (Optional) List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. +- `visibility` - (Optional) Visibility of a runner group. Whether the runner group can include `all`, `selected`, or `private` repositories. A value of `private` is not currently supported due to limitations in the GitHub API. +- `allows_public_repositories` - (Optional) Whether public repositories can be added to the runner group. Defaults to false. + +## Attributes Reference + +- `allows_public_repositories` - Whether public repositories can be added to the runner group +- `default` - Whether this is the default runner group +- `etag` - An etag representing the runner group object +- `inherited` - Whether the runner group is inherited from the enterprise level +- `runners_url` - The GitHub API URL for the runner group's runners +- `selected_repository_ids` - List of repository IDs that can access the runner group +- `selected_repositories_url` - GitHub API URL for the runner group's repositories +- `visibility` - The visibility of the runner group +- `restricted_to_workflows` - If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. +- `selected_workflows` - List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + +## Import + +This resource can be imported using the ID of the runner group: + +```hcl +$ terraform import github_actions_runner_group.test 7 +``` diff --git a/templates/resources/actions_secret.md.tmpl b/templates/resources/actions_secret.md.tmpl new file mode 100644 index 0000000000..d7c9f93ad6 --- /dev/null +++ b/templates/resources/actions_secret.md.tmpl @@ -0,0 +1,65 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Action Secret within a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions secrets within your GitHub repositories. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/actions_secret/example_1.tf" }} + +## Example Lifecycle Ignore Changes + +This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. + +{{ tffile "examples/resources/actions_secret/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) Name of the repository. +- `secret_name` - (Required) Name of the secret. +- `key_id` - (Optional) ID of the public key used to encrypt the secret, required when setting `encrypted_value`. +- `value` - (Optional) Plaintext value of the secret to be encrypted. This conflicts with `value_encrypted`, `encrypted_value` & `plaintext_value`. +- `value_encrypted` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format, `key_id` is required with this value. This conflicts with `value`, `encrypted_value` & `plaintext_value`. +- `encrypted_value` - (**DEPRECATED**)(Optional) Please use `value_encrypted`. +- `plaintext_value` - (**DEPRECATED**)(Optional) Please use `value`. +- `destroy_on_drift` - (**DEPRECATED**) (Optional) This is ignored as drift detection is built into the resource. + +~> **Note**: One of either `encrypted_value` or `plaintext_value` must be specified. + +## Attributes Reference + +- `repository_id` - ID of the repository. +- `created_at` - Date the secret was created. +- `updated_at` - Date the secret was last updated by the provider. +- `remote_updated_at` - Date the secret was last updated in GitHub. + +## Import + +This resource can be imported using an ID made of the repository name, and secret name separated by a `:`. + +~> **Note**: When importing secrets, the `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` fields will not be populated in the state. You may need to ignore changes for these as a workaround if you're not planning on updating the secret through Terraform. + +### Import Block + +The following import imports a GitHub actions secret named `mysecret` for the repo `myrepo` to a `github_actions_secret` resource named `example`. + +{{ tffile "examples/resources/actions_secret/example_3.tf" }} + +### Import Command + +The following command imports a GitHub actions secret named `mysecret` for the repo `myrepo` to a `github_actions_secret` resource named `example`. + +```shell +terraform import github_actions_secret.example myrepo:mysecret +``` diff --git a/templates/resources/actions_variable.md.tmpl b/templates/resources/actions_variable.md.tmpl new file mode 100644 index 0000000000..8b23571f71 --- /dev/null +++ b/templates/resources/actions_variable.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Action variable within a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions variables within your GitHub repositories. You must have write access to a repository to use this resource. + +## Example Usage + +{{ tffile "examples/resources/actions_variable/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) Name of the repository. +- `variable_name` - (Required) Name of the variable. +- `value` - (Required) Value of the variable. + +## Attributes Reference + +- `repository_id` - ID of the repository. +- `created_at` - Date the variable was created. +- `updated_at` - Date the variable was last updated. + +## Import + +This resource can be imported using an ID made of the repository name, and variable name separated by a `:`. + +### Import Block + +The following import imports a GitHub actions variable named `myvariable` for the repo `myrepo` to a `github_actions_variable` resource named `example`. + +{{ tffile "examples/resources/actions_variable/example_2.tf" }} + +### Import Command + +The following command imports a GitHub actions variable named `myvariable` for the repo `myrepo` to a `github_actions_variable` resource named `example`. + +```shell +terraform import github_actions_variable.example myrepo:myvariable +``` diff --git a/templates/resources/app_installation_repositories.md.tmpl b/templates/resources/app_installation_repositories.md.tmpl new file mode 100644 index 0000000000..f622597608 --- /dev/null +++ b/templates/resources/app_installation_repositories.md.tmpl @@ -0,0 +1,36 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages the associations between app installations and repositories. +--- + +# {{.Name}} ({{.Type}}) + +~> **Note**: This resource is not compatible with the GitHub App Installation authentication method. + +This resource manages relationships between app installations and repositories in your GitHub organization or your user account. + +Creating this resource installs a particular app on multiple repositories. + +The app installation and the repositories must all belong to the same organization or user account on GitHub. Note: you can review your organization's installations by the following the instructions at this [link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps). + +## Example Usage + +{{ tffile "examples/resources/app_installation_repositories/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `installation_id` - (Required) The GitHub app installation id. +- `selected_repositories` - (Required) A list of repository names to install the app on. + +~> **Note**: Due to how GitHub implements app installations, apps cannot be installed with no repositories selected. Therefore deleting this resource will leave one repository with the app installed. Manually uninstall the app or set the installation to all repositories via the GUI as after deleting this resource. + +## Import + +GitHub App Installation Repositories can be imported using an ID made up of `installation_id`, e.g. + +```hcl +$ terraform import github_app_installation_repositories.some_app_repos 1234567 +``` diff --git a/templates/resources/app_installation_repository.md.tmpl b/templates/resources/app_installation_repository.md.tmpl new file mode 100644 index 0000000000..de9dbaa95a --- /dev/null +++ b/templates/resources/app_installation_repository.md.tmpl @@ -0,0 +1,34 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages the associations between app installations and repositories. +--- + +# {{.Name}} ({{.Type}}) + +~> **Note**: This resource is not compatible with the GitHub App Installation authentication method. + +This resource manages relationships between app installations and repositories in your GitHub organization or your user account. + +Creating this resource installs a particular app on a particular repository. + +The app installation and the repository must both belong to the same organization or user account on GitHub. Note: you can review your organization's installations by the following the instructions at this [link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps). + +## Example Usage + +{{ tffile "examples/resources/app_installation_repository/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `installation_id` - (Required) The GitHub app installation id. +- `repository` - (Required) The repository to install the app on. + +## Import + +GitHub App Installation Repository can be imported using an ID made up of `installation_id:repository`, e.g. + +```hcl +$ terraform import github_app_installation_repository.terraform_repo 1234567:terraform +``` diff --git a/templates/resources/branch.md.tmpl b/templates/resources/branch.md.tmpl new file mode 100644 index 0000000000..3d787e683c --- /dev/null +++ b/templates/resources/branch.md.tmpl @@ -0,0 +1,59 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages branches within GitHub repositories. +--- + +# github\_branch + +This resource allows you to create and manage branches within your repository. + +Additional constraints can be applied to ensure your branch is created from another branch or commit. + +## Example Usage + +{{ tffile "examples/resources/branch/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository name. + +- `branch` - (Required) The repository branch to create. + +- `source_branch` - (Optional) The branch name to start from. Defaults to `main`. + +- `source_sha` - (Optional) The commit hash to start from. Defaults to the tip of `source_branch`. If provided, `source_branch` is ignored. + +## Attribute Reference + +The following additional attributes are exported: + +- `source_sha` - A string storing the commit this branch was started from. Not populated when imported. + +- `etag` - An etag representing the Branch object. + +- `ref` - A string representing a branch reference, in the form of `refs/heads/`. + +- `sha` - A string storing the reference's `HEAD` commit's SHA1. + +## Import + +GitHub Branch can be imported using an ID made up of `repository:branch`, e.g. + +```hcl +$ terraform import github_branch.terraform terraform:main +``` + +Importing github branch into an instance object (when using a for each block to manage multiple branches) + +```hcl +$ terraform import github_branch.terraform["terraform"] terraform:main +``` + +Optionally, a source branch may be specified using an ID of `repository:branch:source_branch`. This is useful for importing branches that do not branch directly off main. + +```hcl +$ terraform import github_branch.terraform terraform:feature-branch:dev +``` diff --git a/templates/resources/branch_default.md.tmpl b/templates/resources/branch_default.md.tmpl new file mode 100644 index 0000000000..47d02f0f4f --- /dev/null +++ b/templates/resources/branch_default.md.tmpl @@ -0,0 +1,39 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub branch default for a given repository. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub branch default resource. + +This resource allows you to set the default branch for a given repository. + +Note that use of this resource is incompatible with the `default_branch` option of the `github_repository` resource. Using both will result in plans always showing a diff. + +## Example Usage + +Basic usage: + +{{ tffile "examples/resources/branch_default/example_1.tf" }} + +Renaming to a branch that doesn't exist: + +{{ tffile "examples/resources/branch_default/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository +- `branch` - (Required) The branch (e.g. `main`) +- `rename` - (Optional) Indicate if it should rename the branch rather than use an existing branch. Defaults to `false`. + +## Import + +GitHub Branch Defaults can be imported using an ID made up of `repository`, e.g. + +```hcl +$ terraform import github_branch_default.branch_default my-repo +``` diff --git a/templates/resources/branch_protection.md.tmpl b/templates/resources/branch_protection.md.tmpl new file mode 100644 index 0000000000..9fe011934c --- /dev/null +++ b/templates/resources/branch_protection.md.tmpl @@ -0,0 +1,71 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Protects a GitHub branch. +--- + +# github\_branch\_protection + +Protects a GitHub branch. + +This resource allows you to configure branch protection for repositories in your organization. When applied, the branch will be protected from forced pushes and deletion. Additional constraints, such as required status checks or restrictions on users, teams, and apps, can also be configured. + +Note: for the `push_allowances` a given user or team must have specific write access to the repository. If specific write access not provided, github will reject the given actor, which will be the cause of terraform drift. + +## Example Usage + +{{ tffile "examples/resources/branch_protection/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository_id` - (Required) The name or node ID of the repository associated with this branch protection rule. +- `pattern` - (Required) Identifies the protection rule pattern. +- `enforce_admins` - (Optional) Boolean, setting this to `true` enforces status checks for repository administrators. +- `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG. +- `required_linear_history` - (Optional) Boolean, setting this to `true` enforces a linear commit Git history, which prevents anyone from pushing merge commits to a branch +- `require_conversation_resolution` - (Optional) Boolean, setting this to `true` requires all conversations on code must be resolved before a pull request can be merged. +- `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. +- `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. +- `restrict_pushes` - (Optional) Restrict pushes to matching branches. See [Restrict Pushes](#restrict-pushes) below for details. +- `force_push_bypassers` - (Optional) The list of actor Names/IDs that are allowed to bypass force push restrictions. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. If the list is not empty, `allows_force_pushes` should be set to `false`. +- `allows_deletions` - (Optional) Boolean, setting this to `true` to allow the branch to be deleted. +- `allows_force_pushes` - (Optional) Boolean, setting this to `true` to allow force pushes on the branch to everyone. Set it to `false` if you specify `force_push_bypassers`. +- `lock_branch` - (Optional) Boolean, Setting this to `true` will make the branch read-only and preventing any pushes to it. Defaults to `false` + +### Required Status Checks + +`required_status_checks` supports the following arguments: + +- `strict`: (Optional) Require branches to be up to date before merging. Defaults to `false`. +- `contexts`: (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. + +~> Note: This attribute can contain multiple string patterns. If specified, usual value is the [job name](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname). Otherwise, the [job id](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname) is defaulted to. For workflows that use matrixes, append the matrix name to the value using the following pattern `([, ])`. Matrixes should be specified based on the order of matrix properties in the workflow file. See [GitHub Documentation](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#using-a-matrix-strategy) for more information. For workflows that use reusable workflows, the pattern is ` / `. This can extend multiple levels. + +### Required Pull Request Reviews + +`required_pull_request_reviews` supports the following arguments: + +- `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. +- `restrict_dismissals`: (Optional) Restrict pull request review dismissals. +- `dismissal_restrictions`: (Optional) The list of actor Names/IDs with dismissal access. If not empty, `restrict_dismissals` is ignored. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. +- `pull_request_bypassers`: (Optional) The list of actor Names/IDs that are allowed to bypass pull request requirements. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. +- `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. +- `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6. This requirement matches GitHub's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information. () for more information. +- `require_last_push_approval`: (Optional) Require that The most recent push must be approved by someone other than the last pusher. Defaults to `false` + +### Restrict Pushes + +`restrict_pushes` supports the following arguments: + +- `blocks_creations` - (Optional) Boolean, setting this to `false` allows people, teams, or apps to create new branches matching this rule. Defaults to `true`. +- `push_allowances` - (Optional) A list of actor Names/IDs that may push to the branch. Actor names must either begin with a "/" for users or the organization name followed by a "/" for teams. Organization administrators, repository administrators, and users with the Maintain role on the repository can always push when all other requirements have passed. + +## Import + +GitHub Branch Protection can be imported using an ID made up of `repository:pattern`, e.g. + +```hcl +$ terraform import github_branch_protection.terraform terraform:main +``` diff --git a/templates/resources/branch_protection_v3.md.tmpl b/templates/resources/branch_protection_v3.md.tmpl new file mode 100644 index 0000000000..ab9f6abd9e --- /dev/null +++ b/templates/resources/branch_protection_v3.md.tmpl @@ -0,0 +1,82 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Protects a GitHub branch using the v3 / REST implementation. The `github_branch_protection` resource has moved to the GraphQL API, while this resource will continue to leverage the REST API +--- + +# {{.Name}} ({{.Type}}) + +Protects a GitHub branch. + +The `github_branch_protection` resource has moved to the GraphQL API, while this resource will continue to leverage the REST API. + +This resource allows you to configure branch protection for repositories in your organization. When applied, the branch will be protected from forced pushes and deletion. Additional constraints, such as required status checks or restrictions on users, teams, and apps, can also be configured. + +## Example Usage + +{{ tffile "examples/resources/branch_protection_v3/example_1.tf" }} + +{{ tffile "examples/resources/branch_protection_v3/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository name. +- `branch` - (Required) The Git branch to protect. +- `enforce_admins` - (Optional) Boolean, setting this to `true` enforces status checks for repository administrators. +- `require_signed_commits` - (Optional) Boolean, setting this to `true` requires all commits to be signed with GPG. +- `require_conversation_resolution` - (Optional) Boolean, setting this to `true` requires all conversations on code must be resolved before a pull request can be merged. +- `required_status_checks` - (Optional) Enforce restrictions for required status checks. See [Required Status Checks](#required-status-checks) below for details. +- `required_pull_request_reviews` - (Optional) Enforce restrictions for pull request reviews. See [Required Pull Request Reviews](#required-pull-request-reviews) below for details. +- `restrictions` - (Optional) Enforce restrictions for the users and teams that may push to the branch. See [Restrictions](#restrictions) below for details. + +### Required Status Checks + +`required_status_checks` supports the following arguments: + +- `strict`: (Optional) Require branches to be up to date before merging. Defaults to `false`. +- `contexts`: (**DEPRECATED**) (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. + +~> Note: This attribute can contain multiple string patterns. If specified, usual value is the [job name](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname). Otherwise, the [job id](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idname) is defaulted to. For workflows that use matrixes, append the matrix name to the value using the following pattern `([, ])`. Matrixes should be specified based on the order of matrix properties in the workflow file. See [GitHub Documentation](https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#using-a-matrix-strategy) for more information. For workflows that use reusable workflows, the pattern is ` / `. This can extend multiple levels. + +- `checks`: (Optional) The list of status checks to require in order to merge into this branch. No status checks are required by default. Checks should be strings containing the context and app_id like so "context:app_id". + +### Required Pull Request Reviews + +`required_pull_request_reviews` supports the following arguments: + +- `dismiss_stale_reviews`: (Optional) Dismiss approved reviews automatically when a new commit is pushed. Defaults to `false`. +- `dismissal_users`: (Optional) The list of user logins with dismissal access +- `dismissal_teams`: (Optional) The list of team slugs with dismissal access. Always use `slug` of the team, **not*- its name. Each team already **has*- to have access to the repository. +- `dismissal_apps`: (Optional) The list of app slugs with dismissal access. +- `require_code_owner_reviews`: (Optional) Require an approved review in pull requests including files with a designated code owner. Defaults to `false`. +- `required_approving_review_count`: (Optional) Require x number of approvals to satisfy branch protection requirements. If this is specified it must be a number between 0-6. This requirement matches GitHub's API, see the upstream [documentation](https://developer.github.com/v3/repos/branches/#parameters-1) for more information. +- `bypass_pull_request_allowances`: (Optional) Allow specific users, teams, or apps to bypass pull request requirements. See [Bypass Pull Request Allowances](#bypass-pull-request-allowances) below for details. +- `require_last_push_approval`: (Optional) Require that the most recent push must be approved by someone other than the last pusher. Defaults to `false` + +### Restrictions + +`restrictions` supports the following arguments: + +- `users`: (Optional) The list of user logins with push access. +- `teams`: (Optional) The list of team slugs with push access. Always use `slug` of the team, **not*- its name. Each team already **has*- to have access to the repository. +- `apps`: (Optional) The list of app slugs with push access. + +`restrictions` is only available for organization-owned repositories. + +### Bypass Pull Request Allowances + +`bypass_pull_request_allowances` supports the following arguments: + +- `users`: (Optional) The list of user logins allowed to bypass pull request requirements. +- `teams`: (Optional) The list of team slugs allowed to bypass pull request requirements. +- `apps`: (Optional) The list of app slugs allowed to bypass pull request requirements. + +## Import + +GitHub Branch Protection can be imported using an ID made up of `repository:branch`, e.g. + +```hcl +$ terraform import github_branch_protection_v3.terraform terraform:main +``` diff --git a/templates/resources/codespaces_organization_secret.md.tmpl b/templates/resources/codespaces_organization_secret.md.tmpl new file mode 100644 index 0000000000..d36acd2a94 --- /dev/null +++ b/templates/resources/codespaces_organization_secret.md.tmpl @@ -0,0 +1,44 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Codespaces Secret within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Codespaces secrets within your GitHub organization. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `plaintext_value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `encrypted_value` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/codespaces_organization_secret/example_1.tf" }} + +{{ tffile "examples/resources/codespaces_organization_secret/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the secret +- `encrypted_value` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format. +- `plaintext_value` - (Optional) Plaintext value of the secret to be encrypted +- `visibility` - (Required) Configures the access that repositories have to the organization secret. Must be one of `all`, `private`, `selected`. `selected_repository_ids` is required if set to `selected`. +- `selected_repository_ids` - (Optional) An array of repository ids that can access the organization secret. + +## Attributes Reference + +- `created_at` - Date of codespaces_secret creation. +- `updated_at` - Date of codespaces_secret update. + +## Import + +This resource can be imported using an ID made up of the secret name: + +```hcl +terraform import github_codespaces_organization_secret.test_secret test_secret_name +``` + +NOTE: the implementation is limited in that it won't fetch the value of the `plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. diff --git a/templates/resources/codespaces_organization_secret_repositories.md.tmpl b/templates/resources/codespaces_organization_secret_repositories.md.tmpl new file mode 100644 index 0000000000..e6ab50e31b --- /dev/null +++ b/templates/resources/codespaces_organization_secret_repositories.md.tmpl @@ -0,0 +1,32 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages repository allow list for a Codespaces Secret within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage repository allow list for existing GitHub Codespaces secrets within your GitHub organization. + +You must have write access to an organization secret to use this resource. + +This resource is only applicable when `visibility` of the existing organization secret has been set to `selected`. + +## Example Usage + +{{ tffile "examples/resources/codespaces_organization_secret_repositories/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the existing secret +- `selected_repository_ids` - (Required) An array of repository ids that can access the organization secret. + +## Import + +This resource can be imported using an ID made up of the secret name: + +```hcl +$ terraform import github_codespaces_organization_secret_repositories.org_secret_repos existing_secret_name +``` diff --git a/templates/resources/codespaces_secret.md.tmpl b/templates/resources/codespaces_secret.md.tmpl new file mode 100644 index 0000000000..958fda1c10 --- /dev/null +++ b/templates/resources/codespaces_secret.md.tmpl @@ -0,0 +1,41 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Codespaces Secret within a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Codespaces secrets within your GitHub repositories. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `plaintext_value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `encrypted_value` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/codespaces_secret/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) Name of the repository +- `secret_name` - (Required) Name of the secret +- `encrypted_value` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format. +- `plaintext_value` - (Optional) Plaintext value of the secret to be encrypted + +## Attributes Reference + +- `created_at` - Date of codespaces_secret creation. +- `updated_at` - Date of codespaces_secret update. + +## Import + +This resource can be imported using an ID made up of the `repository` and `secret_name`: + +```hcl +$ terraform import github_codespaces_secret.example_secret example_repository/example_secret_name +``` + +NOTE: the implementation is limited in that it won't fetch the value of the `plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. diff --git a/templates/resources/codespaces_user_secret.md.tmpl b/templates/resources/codespaces_user_secret.md.tmpl new file mode 100644 index 0000000000..c29c019709 --- /dev/null +++ b/templates/resources/codespaces_user_secret.md.tmpl @@ -0,0 +1,41 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Codespaces Secret within a GitHub user +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Codespaces secrets within your GitHub user. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `plaintext_value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `encrypted_value` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/codespaces_user_secret/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the secret +- `encrypted_value` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format. +- `plaintext_value` - (Optional) Plaintext value of the secret to be encrypted +- `selected_repository_ids` - (Optional) An array of repository ids that can access the user secret. + +## Attributes Reference + +- `created_at` - Date of codespaces_secret creation. +- `updated_at` - Date of codespaces_secret update. + +## Import + +This resource can be imported using an ID made up of the secret name: + +```hcl +terraform import github_codespaces_user_secret.test_secret test_secret_name +``` + +NOTE: the implementation is limited in that it won't fetch the value of the `plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. diff --git a/templates/resources/dependabot_organization_secret.md.tmpl b/templates/resources/dependabot_organization_secret.md.tmpl new file mode 100644 index 0000000000..8b36812472 --- /dev/null +++ b/templates/resources/dependabot_organization_secret.md.tmpl @@ -0,0 +1,66 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Dependabot Secret within a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Dependabot secrets within your GitHub organization. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/dependabot_organization_secret/example_1.tf" }} + +{{ tffile "examples/resources/dependabot_organization_secret/example_2.tf" }} + +## Example Lifecycle Ignore Changes + +This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. + +{{ tffile "examples/resources/dependabot_organization_secret/example_3.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the secret. +- `key_id` - (Optional) ID of the public key used to encrypt the secret, required when setting `encrypted_value`. +- `value` - (Optional) Plaintext value of the secret to be encrypted. This conflicts with `value_encrypted`, `encrypted_value` & `plaintext_value`. +- `value_encrypted` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format, `key_id` is required with this value. This conflicts with `value`, `encrypted_value` & `plaintext_value`. +- `encrypted_value` - (**DEPRECATED**)(Optional) Please use `value_encrypted`. +- `plaintext_value` - (**DEPRECATED**)(Optional) Please use `value`. +- `visibility` - (Required) Configures the access that repositories have to the organization secret; must be one of `all`, `private`, or `selected`. +- `selected_repository_ids` - (Optional) An array of repository IDs that can access the organization variable; this requires `visibility` to be set to `selected`. + +~> **Note**: One of either `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` must be specified. + +## Attributes Reference + +- `created_at` - Date the secret was created. +- `updated_at` - Date the secret was last updated by the provider. +- `remote_updated_at` - Date the secret was last updated in GitHub. + +## Import + +This resource can be imported using the secret name as the ID. + +~> **Note**: When importing secrets, the `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` fields will not be populated in the state. You may need to ignore changes for these as a workaround if you're not planning on updating the secret through Terraform. + +### Import Block + +The following import imports a GitHub Dependabot organization secret named `mysecret` to a `github_dependabot_organization_secret` resource named `example`. + +{{ tffile "examples/resources/dependabot_organization_secret/example_4.tf" }} + +### Import Command + +The following command imports a GitHub Dependabot organization secret named `mysecret` to a `github_dependabot_organization_secret` resource named `example`. + +```shell +terraform import github_dependabot_organization_secret.example mysecret +``` diff --git a/templates/resources/dependabot_organization_secret_repositories.md.tmpl b/templates/resources/dependabot_organization_secret_repositories.md.tmpl new file mode 100644 index 0000000000..c6eb817d06 --- /dev/null +++ b/templates/resources/dependabot_organization_secret_repositories.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages repository allow list for an Dependabot Secret within a GitHub organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage the repositories allowed to access a Dependabot secret within your GitHub organization. You must have write access to an organization secret to use this resource. + +This resource is only applicable when `visibility` of the existing organization secret has been set to `selected`. + +## Example Usage + +{{ tffile "examples/resources/dependabot_organization_secret_repositories/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the Dependabot organization secret. +- `selected_repository_ids` - (Required) List of IDs for the repositories that should be able to access the secret. + +## Import + +This resource can be imported using the secret name as the ID. + +### Import Block + +The following import block imports the repositories able to access the Dependabot organization secret named `mysecret` to a `github_dependabot_organization_secret_repositories` resource named `example`. + +{{ tffile "examples/resources/dependabot_organization_secret_repositories/example_2.tf" }} + +### Import Command + +The following command imports the repositories able to access the Dependabot organization secret named `mysecret` to a `github_dependabot_organization_secret_repositories` resource named `example`. + +```shell +terraform import github_dependabot_organization_secret_repositories.example mysecret +``` diff --git a/templates/resources/dependabot_organization_secret_repository.md.tmpl b/templates/resources/dependabot_organization_secret_repository.md.tmpl new file mode 100644 index 0000000000..414be898fd --- /dev/null +++ b/templates/resources/dependabot_organization_secret_repository.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Add access for a repository to a Dependabot Secret within a GitHub organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource adds permission for a repository to use a Dependabot secret within your GitHub organization. You must have write access to an organization secret to use this resource. + +This resource is only applicable when `visibility` of the existing organization secret has been set to `selected`. + +## Example Usage + +{{ tffile "examples/resources/dependabot_organization_secret_repository/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `secret_name` - (Required) Name of the Dependabot organization secret. +- `repository_id` - (Required) ID of the repository that should be able to access the secret. + +## Import + +This resource can be imported using an ID made of the secret name and repository name separated by a `:`. + +### Import Block + +The following import block imports the access of repository ID `123456` for the Dependabot organization secret named `mysecret` to a `github_dependabot_organization_secret_repository` resource named `example`. + +{{ tffile "examples/resources/dependabot_organization_secret_repository/example_2.tf" }} + +### Import Command + +The following command imports the access of repository ID `123456` for the Dependabot organization secret named `mysecret` to a `v` resource named `example`. + +```shell +terraform import github_dependabot_organization_secret_repository.example mysecret:123456 +``` diff --git a/templates/resources/dependabot_secret.md.tmpl b/templates/resources/dependabot_secret.md.tmpl new file mode 100644 index 0000000000..d21eb1dbe9 --- /dev/null +++ b/templates/resources/dependabot_secret.md.tmpl @@ -0,0 +1,64 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Dependabot Secret within a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Dependabot secrets within your GitHub repositories. You must have write access to a repository to use this resource. + +Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. + +For the purposes of security, the contents of the `value` field have been marked as `sensitive` to Terraform, but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. It is also advised that you do not store plaintext values in your code but rather populate the `value_encrypted` using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible in your code. See below for an example of this abstraction. + +## Example Usage + +{{ tffile "examples/resources/dependabot_secret/example_1.tf" }} + +## Example Lifecycle Ignore Changes + +This resource supports using the `lifecycle` `ignore_changes` block on `remote_updated_at` to support use cases where a secret value is created using a placeholder value and then modified after creation outside the scope of Terraform. This approach ensures only the initial placeholder value is referenced in your code and in the resulting state file. + +{{ tffile "examples/resources/dependabot_secret/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) Name of the repository. +- `secret_name` - (Required) Name of the secret. +- `key_id` - (Optional) ID of the public key used to encrypt the secret, required when setting `encrypted_value`. +- `value` - (Optional) Plaintext value of the secret to be encrypted. This conflicts with `value_encrypted`, `encrypted_value` & `plaintext_value`. +- `value_encrypted` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format, `key_id` is required with this value. This conflicts with `value`, `encrypted_value` & `plaintext_value`. +- `encrypted_value` - (**DEPRECATED**)(Optional) Please use `value_encrypted`. +- `plaintext_value` - (**DEPRECATED**)(Optional) Please use `value`. + +~> **Note**: One of either `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` must be specified. + +## Attributes Reference + +- `repository_id` - ID of the repository. +- `created_at` - Date the secret was created. +- `updated_at` - Date the secret was last updated by the provider. +- `remote_updated_at` - Date the secret was last updated in GitHub. + +## Import + +This resource can be imported using an ID made of the repository name, and secret name separated by a `:`. + +~> **Note**: When importing secrets, the `value`, `value_encrypted`, `encrypted_value`, or `plaintext_value` fields will not be populated in the state. You may need to ignore changes for these as a workaround if you're not planning on updating the secret through Terraform. + +### Import Block + +The following import imports a GitHub Dependabot secret named `mysecret` for the repo `myrepo` to a `github_dependabot_secret` resource named `example`. + +{{ tffile "examples/resources/dependabot_secret/example_3.tf" }} + +### Import Command + +The following command imports a GitHub Dependabot secret named `mysecret` for the repo `myrepo` to a `github_dependabot_secret` resource named `example`. + +```shell +terraform import github_dependabot_secret.example myrepo:mysecret +``` diff --git a/templates/resources/emu_group_mapping.md.tmpl b/templates/resources/emu_group_mapping.md.tmpl new file mode 100644 index 0000000000..385bb5b690 --- /dev/null +++ b/templates/resources/emu_group_mapping.md.tmpl @@ -0,0 +1,36 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages mappings between external groups for enterprise managed users. +--- + +# {{.Name}} ({{.Type}}) + +This resource manages mappings between external groups for enterprise managed users and GitHub teams. It wraps the [Teams#ExternalGroups API](https://docs.github.com/en/rest/reference/teams#external-groups). Note that this is a distinct resource from `github_team_sync_group_mapping`. `github_emu_group_mapping` is special to the Enterprise Managed User (EMU) external group feature, whereas `github_team_sync_group_mapping` is specific to Identity Provider Groups. + +## Example Usage + +{{ tffile "examples/resources/emu_group_mapping/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `team_slug` - (Required) Slug of the GitHub team +- `group_id` - (Required) Integer corresponding to the external group ID to be linked + +## Attributes Reference + +The following additional attributes are exported: + +- `team_id` - The ID of the GitHub team +- `group_name` - The name of the external group +- `etag` - An etag representing the external group state + +## Import + +GitHub EMU External Group Mappings can be imported using the external `group_id` and `team_slug` separated by a colon, e.g. + +```sh +terraform import github_emu_group_mapping.example_emu_group_mapping 28836:emu-test-team +``` diff --git a/templates/resources/enterprise_actions_permissions.md.tmpl b/templates/resources/enterprise_actions_permissions.md.tmpl new file mode 100644 index 0000000000..142f48fd1e --- /dev/null +++ b/templates/resources/enterprise_actions_permissions.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages Actions permissions within a GitHub enterprise +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions permissions within your GitHub enterprise. You must have admin access to an enterprise to use this resource. + +## Example Usage + +{{ tffile "examples/resources/enterprise_actions_permissions/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `"my-enterprise"` - (Required) The slug of the enterprise. +- `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. +- `enabled_organizations` - (Required) The policy that controls the organizations in the enterprise that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. +- `allowed_actions_config` - (Optional) Sets the actions that are allowed in an enterprise. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details. +- `enabled_organizations_config` - (Optional) Sets the list of selected organizations that are enabled for GitHub Actions in an enterprise. Only available when `enabled_organizations` = `selected`. See [Enabled Organizations Config](#enabled-organizations-config) below for details. + +### Allowed Actions Config + +The `allowed_actions_config` block supports the following: + +- `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the organization. +- `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*." +- `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators. + +### Enabled Organizations Config + +The `enabled_organizations_config` block supports the following: + +- `organization_ids` - (Required) List of organization IDs to enable for GitHub Actions. + +## Import + +This resource can be imported using the name of the GitHub enterprise: + +```hcl +$ terraform import github_enterprise_actions_permissions.test github_enterprise_name +``` diff --git a/templates/resources/enterprise_actions_runner_group.md.tmpl b/templates/resources/enterprise_actions_runner_group.md.tmpl new file mode 100644 index 0000000000..fbaec84d7b --- /dev/null +++ b/templates/resources/enterprise_actions_runner_group.md.tmpl @@ -0,0 +1,43 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages an Actions Runner Group within a GitHub enterprise. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage GitHub Actions runner groups within your GitHub enterprise. You must have admin access to an enterprise to use this resource. + +## Example Usage + +{{ tffile "examples/resources/enterprise_actions_runner_group/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `enterprise_slug` - (Required) The slug of the enterprise. +- `name` - (Required) Name of the runner group +- `visibility` - (Required) Visibility of a runner group to enterprise organizations. Whether the runner group can include `all` or `selected` +- `selected_organization_ids` - (Optional) IDs of the organizations which should be added to the runner group +- `allows_public_repositories` - (Optional) Whether public repositories can be added to the runner group. Defaults to false. +- `restricted_to_workflows` - (Optional) If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. +- `selected_workflows` - (Optional) List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. + +## Attributes Reference + +The following additional attributes are exported: + +- `id` - The ID of the runner group +- `default` - Whether this is the default runner group +- `etag` - An etag representing the runner group object +- `runners_url` - The GitHub API URL for the runner group's runners +- `selected_organizations_url` - The GitHub API URL for the runner group's selected organizations + +## Import + +This resource can be imported using the enterprise slug and the ID of the runner group: + +```hcl +$ terraform import github_enterprise_actions_runner_group.test enterprise-slug/42 +``` diff --git a/templates/resources/enterprise_actions_workflow_permissions.md.tmpl b/templates/resources/enterprise_actions_workflow_permissions.md.tmpl new file mode 100644 index 0000000000..c9504182cf --- /dev/null +++ b/templates/resources/enterprise_actions_workflow_permissions.md.tmpl @@ -0,0 +1,48 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages GitHub Actions workflow permissions for a GitHub Enterprise. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage GitHub Actions workflow permissions for a GitHub Enterprise account. This controls the default permissions granted to the GITHUB_TOKEN when running workflows and whether GitHub Actions can approve pull request reviews. + +You must have enterprise admin access to use this resource. + +## Example Usage + +{{ tffile "examples/resources/enterprise_actions_workflow_permissions/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `enterprise_slug` - (Required) The slug of the enterprise. + +- `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be `read` or `write`. Defaults to `read`. + +- `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull request reviews. Defaults to `false`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The enterprise slug. + +## Import + +Enterprise Actions workflow permissions can be imported using the enterprise slug: + +```hcl +terraform import github_enterprise_actions_workflow_permissions.example my-enterprise +``` + +## Notes + +~> **Note:** This resource requires a GitHub Enterprise account and enterprise admin permissions. + +When this resource is destroyed, the workflow permissions will be reset to safe defaults: + +- `default_workflow_permissions` = `read` +- `can_approve_pull_request_reviews` = `false` diff --git a/templates/resources/enterprise_ip_allow_list_entry.md.tmpl b/templates/resources/enterprise_ip_allow_list_entry.md.tmpl new file mode 100644 index 0000000000..c56b4d29c2 --- /dev/null +++ b/templates/resources/enterprise_ip_allow_list_entry.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages IP allow list entries within a GitHub Enterprise +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage IP allow list entries for a GitHub Enterprise account. IP allow list entries define IP addresses or ranges that are permitted to access private resources in the enterprise. + +## Example Usage + +{{tffile "examples/resources/enterprise_ip_allow_list_entry/example_1.tf"}} + +## Argument Reference + +The following arguments are supported: + +- `enterprise_slug` - (Required) The slug of the enterprise. +- `ip` - (Required) An IP address or range of IP addresses in CIDR notation. +- `name` - (Optional) A descriptive name for the IP allow list entry. +- `is_active` - (Optional) Whether the entry is currently active. Default: true. + +## Import + +This resource can be imported using the ID of the IP allow list entry: + +```shell +terraform import github_enterprise_ip_allow_list_entry.test IALE_kwHOC1234567890a +``` diff --git a/website/docs/r/enterprise_organization.html.markdown b/templates/resources/enterprise_organization.md.tmpl similarity index 60% rename from website/docs/r/enterprise_organization.html.markdown rename to templates/resources/enterprise_organization.md.tmpl index 94b39e94ee..44fb1c76d8 100644 --- a/website/docs/r/enterprise_organization.html.markdown +++ b/templates/resources/enterprise_organization.md.tmpl @@ -1,17 +1,16 @@ --- -layout: "github" -page_title: "Github: github_enterprise_organization" +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" description: |- Create and manages a GitHub enterprise organization. --- -# github_enterprise_organization +# {{.Name}} ({{.Type}}) This resource allows you to create and manage a GitHub enterprise organization. ## Example Usage -``` +```hcl resource "github_enterprise_organization" "org" { enterprise_id = data.github_enterprise.enterprise.id name = "some-awesome-org" @@ -26,24 +25,24 @@ resource "github_enterprise_organization" "org" { ## Argument Reference -* `enterprise_id` - (Required) The ID of the enterprise. -* `name` - (Required) The name of the organization. -* `description` - (Optional) The description of the organization. -* `display_name` - (Optional) The display name of the organization. -* `billing_email` - (Required) The billing email address. -* `admin_logins` - (Required) List of organization owner usernames. +- `enterprise_id` - (Required) The ID of the enterprise. +- `name` - (Required) The name of the organization. +- `description` - (Optional) The description of the organization. +- `display_name` - (Optional) The display name of the organization. +- `billing_email` - (Required) The billing email address. +- `admin_logins` - (Required) List of organization owner usernames. ## Attributes Reference The following additional attributes are exported: -* `id` - The node ID of the organization for use with the v4 API. -* `database_id` - The ID of the organization. +- `id` - The node ID of the organization for use with the v4 API. +- `database_id` - The ID of the organization. ## Import GitHub Enterprise Organization can be imported using the `slug` of the enterprise, combined with the `orgname` of the organization, separated by a `/` character. -``` +```hcl $ terraform import github_enterprise_organization.org enterp/some-awesome-org ``` diff --git a/templates/resources/enterprise_security_analysis_settings.md.tmpl b/templates/resources/enterprise_security_analysis_settings.md.tmpl new file mode 100644 index 0000000000..750247bcec --- /dev/null +++ b/templates/resources/enterprise_security_analysis_settings.md.tmpl @@ -0,0 +1,64 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages GitHub Enterprise security analysis settings. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage code security and analysis settings for a GitHub Enterprise account. This controls Advanced Security, Secret Scanning, and related security features that are automatically enabled for new repositories in the enterprise. + +You must have enterprise admin access to use this resource. + +## Example Usage + +{{ tffile "examples/resources/enterprise_security_analysis_settings/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `enterprise_slug` - (Required) The slug of the enterprise. + +- `advanced_security_enabled_for_new_repositories` - (Optional) Whether GitHub Advanced Security is automatically enabled for new repositories. Defaults to `false`. Requires Advanced Security license. + +- `secret_scanning_enabled_for_new_repositories` - (Optional) Whether secret scanning is automatically enabled for new repositories. Defaults to `false`. + +- `secret_scanning_push_protection_enabled_for_new_repositories` - (Optional) Whether secret scanning push protection is automatically enabled for new repositories. Defaults to `false`. + +- `secret_scanning_push_protection_custom_link` - (Optional) Custom URL for secret scanning push protection bypass instructions. + +- `secret_scanning_validity_checks_enabled` - (Optional) Whether secret scanning validity checks are enabled. Defaults to `false`. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `id` - The enterprise slug. + +## Import + +Enterprise security analysis settings can be imported using the enterprise slug: + +```hcl +terraform import github_enterprise_security_analysis_settings.example my-enterprise +``` + +## Notes + +~> **Note:** This resource requires a GitHub Enterprise account and enterprise admin permissions. + +~> **Note:** Advanced Security features require a GitHub Advanced Security license. + +When this resource is destroyed, all security analysis settings will be reset to disabled defaults for security reasons. + +## Dependencies + +This resource manages the following security features: + +- **Advanced Security**: Code scanning, secret scanning, and dependency review +- **Secret Scanning**: Automatic detection of secrets in code +- **Push Protection**: Prevents secrets from being committed to repositories +- **Validity Checks**: Verifies that detected secrets are actually valid + +These settings only apply to **new repositories*- created after the settings are enabled. Existing repositories are not affected and must be configured individually. diff --git a/templates/resources/issue.md.tmpl b/templates/resources/issue.md.tmpl new file mode 100644 index 0000000000..fa085d4e8c --- /dev/null +++ b/templates/resources/issue.md.tmpl @@ -0,0 +1,49 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub issue resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub issue resource. + +This resource allows you to create and manage issue within your GitHub repository. + +## Example Usage + +{{ tffile "examples/resources/issue/example_1.tf" }} + +## Example Usage with milestone and project assignment + +{{ tffile "examples/resources/issue/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository name + +- `title` - (Required) Title of the issue + +- `body` - (Optional) Body of the issue + +- `labels` - (Optional) List of labels to attach to the issue + +- `assignees` - (Optional) List of Logins to assign the to the issue + +- `milestone_number` - (Optional) Milestone number to assign to the issue + +## Attributes Reference + +- `number` - (Computed) - The issue number + +- `issue_id` - (Computed) - The issue id + +## Import + +GitHub Issues can be imported using an ID made up of `repository:number`, e.g. + +```hcl +$ terraform import github_issue.issue_15 myrepo:15 +``` diff --git a/templates/resources/issue_label.md.tmpl b/templates/resources/issue_label.md.tmpl new file mode 100644 index 0000000000..5398ac8ee0 --- /dev/null +++ b/templates/resources/issue_label.md.tmpl @@ -0,0 +1,43 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub issue label resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub issue label resource. + +This resource allows you to create and manage issue labels within your GitHub organization. + +Issue labels are keyed off of their "name", so pre-existing issue labels result in a 422 HTTP error if they exist outside of Terraform. Normally this would not be an issue, except new repositories are created with a "default" set of labels, and those labels easily conflict with custom ones. + +This resource will first check if the label exists, and then issue an update, otherwise it will create. + +~> **Note:** When a repository is archived, Terraform will skip deletion of issue labels to avoid API errors, as archived repositories are read-only. The labels will be removed from Terraform state without attempting to delete them from GitHub. + +## Example Usage + +{{ tffile "examples/resources/issue_label/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository + +- `name` - (Required) The name of the label. + +- `color` - (Required) A 6 character hex code, **without the leading #**, identifying the color of the label. + +- `description` - (Optional) A short description of the label. + +- `url` - (Computed) The URL to the issue label + +## Import + +GitHub Issue Labels can be imported using an ID made up of `repository:name`, e.g. + +```hcl +$ terraform import github_issue_label.panic_label terraform:panic +``` diff --git a/templates/resources/issue_labels.md.tmpl b/templates/resources/issue_labels.md.tmpl new file mode 100644 index 0000000000..2f7ce4db12 --- /dev/null +++ b/templates/resources/issue_labels.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides GitHub issue labels resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides GitHub issue labels resource. + +This resource allows you to create and manage issue labels within your GitHub organization. + +~> Note: github_issue_labels cannot be used in conjunction with github_issue_label or they will fight over what your policy should be. + +This resource is authoritative. For adding a label to a repo in a non-authoritative manner, use github_issue_label instead. + +If you change the case of a label's name, its' color, or description, this resource will edit the existing label to match the new values. However, if you change the name of a label, this resource will create a new label with the new name and delete the old label. Beware that this will remove the label from any issues it was previously attached to. + +~> **Note:** When a repository is archived, Terraform will skip deletion of issue labels to avoid API errors, as archived repositories are read-only. The labels will be removed from Terraform state without attempting to delete them from GitHub. + +## Example Usage + +{{ tffile "examples/resources/issue_labels/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository + +- `name` - (Required) The name of the label. + +- `color` - (Required) A 6 character hex code, **without the leading #**, identifying the color of the label. + +- `description` - (Optional) A short description of the label. + +- `url` - (Computed) The URL to the issue label + +## Import + +GitHub Issue Labels can be imported using the repository `name`, e.g. + +```hcl +$ terraform import github_issue_labels.test_repo test_repo +``` diff --git a/templates/resources/membership.md.tmpl b/templates/resources/membership.md.tmpl new file mode 100644 index 0000000000..e3bff578b4 --- /dev/null +++ b/templates/resources/membership.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub membership resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub membership resource. + +This resource allows you to add/remove users from your organization. When applied, an invitation will be sent to the user to become part of the organization. When destroyed, either the invitation will be cancelled or the user will be removed. + +## Example Usage + +{{ tffile "examples/resources/membership/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `username` - (Required) The user to add to the organization. +- `role` - (Optional) The role of the user within the organization. Must be one of `member` or `admin`. Defaults to `member`. `admin` role represents the `owner` role available via GitHub UI. +- `downgrade_on_destroy` - (Optional) Defaults to `false`. If set to true, when this resource is destroyed, the member will not be removed from the organization. Instead, the member's role will be downgraded to 'member'. + +## Import + +GitHub Membership can be imported using an ID made up of `organization:username`, e.g. + +```hcl +$ terraform import github_membership.member hashicorp:someuser +``` diff --git a/templates/resources/organization_block.md.tmpl b/templates/resources/organization_block.md.tmpl new file mode 100644 index 0000000000..da415671ab --- /dev/null +++ b/templates/resources/organization_block.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages blocks for GitHub organizations +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage blocks for GitHub organizations. + +## Example Usage + +{{ tffile "examples/resources/organization_block/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `username` - (Required) The name of the user to block. + +## Import + +GitHub organization block can be imported using a username, e.g. + +```hcl +$ terraform import github_github_organization_block.example someuser +``` diff --git a/templates/resources/organization_custom_properties.md.tmpl b/templates/resources/organization_custom_properties.md.tmpl new file mode 100644 index 0000000000..a65ecca029 --- /dev/null +++ b/templates/resources/organization_custom_properties.md.tmpl @@ -0,0 +1,61 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages custom properties for a GitHub organization +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage custom properties for a GitHub organization. + +Custom properties enable you to add metadata to repositories within your organization. You can use custom properties to add context about repositories, such as who owns them, when they expire, or compliance requirements. + +## Example Usage + +{{ tffile "examples/resources/organization_custom_properties/example_1.tf" }} + +## Example Usage - Allow Repository Actors to Edit + +This example shows how to allow repository administrators to edit the property values: + +{{ tffile "examples/resources/organization_custom_properties/example_2.tf" }} + +## Example Usage - Text Property + +{{ tffile "examples/resources/organization_custom_properties/example_3.tf" }} + +## Example Usage - Boolean Property + +{{ tffile "examples/resources/organization_custom_properties/example_4.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `property_name` - (Required) The name of the custom property. + +- `value_type` - (Optional) The type of the custom property. Can be one of `string`, `single_select`, `multi_select`, or `true_false`. Defaults to `string`. + +- `required` - (Optional) Whether the custom property is required. Defaults to `false`. + +- `description` - (Optional) The description of the custom property. + +- `default_value` - (Optional) The default value of the custom property. + +- `allowed_values` - (Optional) List of allowed values for the custom property. Only applicable when `value_type` is `single_select` or `multi_select`. + +- `values_editable_by` - (Optional) Who can edit the values of the custom property. Can be one of `org_actors` or `org_and_repo_actors`. When set to `org_actors` (the default), only organization owners can edit the property values on repositories. When set to `org_and_repo_actors`, both organization owners and repository administrators with the custom properties permission can edit the values. + +## Attributes Reference + +In addition to all arguments above, the following attributes are exported: + +- `property_name` - The name of the custom property. + +## Import + +Organization custom properties can be imported using the property name: + +```hcl +terraform import github_organization_custom_properties.environment environment +``` diff --git a/templates/resources/organization_custom_role.md.tmpl b/templates/resources/organization_custom_role.md.tmpl new file mode 100644 index 0000000000..9e613ad160 --- /dev/null +++ b/templates/resources/organization_custom_role.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages a custom role in a GitHub Organization for use in repositories. +--- + +# github\_organization\_custom\_role + +~> **Note:** This resource is deprecated, please use the `github_organization_repository_role` resource instead. + +This resource allows you to create and manage custom roles in a GitHub Organization for use in repositories. + +~> Note: Custom roles are currently only available in GitHub Enterprise Cloud. + +## Example Usage + +{{ tffile "examples/resources/organization_custom_role/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the custom role. +- `description` - (Optional) The description for the custom role. +- `base_role` - (Required) The system role from which the role inherits permissions. Can be one of: `read`, `triage`, `write`, or `maintain`. +- `permissions` - (Required) A list of additional permissions included in this role. Must have a minimum of 1 additional permission. The list of available permissions can be found using the [list repository fine-grained permissions for an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles?apiVersion=2022-11-28#list-repository-fine-grained-permissions-for-an-organization) API. + +## Attributes Reference + +The following additional attributes are exported: + +- `id` - The ID of the custom role. + +## Import + +Custom roles can be imported using the `id` of the role. The `id` of the custom role can be found using the [list custom roles in an organization](https://docs.github.com/en/enterprise-cloud@latest/rest/orgs/custom-roles#list-custom-repository-roles-in-an-organization) API. + +```hcl +$ terraform import github_organization_custom_role.example 1234 +``` diff --git a/templates/resources/organization_project.md.tmpl b/templates/resources/organization_project.md.tmpl new file mode 100644 index 0000000000..8a5aa68cf5 --- /dev/null +++ b/templates/resources/organization_project.md.tmpl @@ -0,0 +1,29 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages projects for GitHub organizations +--- + +# {{.Name}} ({{.Type}}) + +!> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. + +This resource allows you to create and manage projects for GitHub organization. + +## Example Usage + +{{ tffile "examples/resources/organization_project/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the project. + +- `body` - (Optional) The body of the project. + +## Attributes Reference + +The following additional attributes are exported: + +- `url` - URL of the project diff --git a/templates/resources/organization_repository_role.md.tmpl b/templates/resources/organization_repository_role.md.tmpl new file mode 100644 index 0000000000..79b7c84e92 --- /dev/null +++ b/templates/resources/organization_repository_role.md.tmpl @@ -0,0 +1,39 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manage a custom organization repository role. +--- + +# {{.Name}} ({{.Type}}) + +Manage a custom organization repository role. + +~> **Note**: Custom organization repository roles are currently only available in GitHub Enterprise Cloud. + +## Example Usage + +{{ tffile "examples/resources/organization_repository_role/example_1.tf" }} + +## Schema + +### Required + +- `name` (String) The name of the organization repository role. +- `base_role` (String) The system role from which this role inherits permissions. +- `permissions` (Set of String, Min: 1) The permissions included in this role. + +### Optional + +- `description` (String) The description of the organization repository role. + +### Read-Only + +- `role_id` (Number) The ID of the organization repository role. + +## Import + +A custom organization repository role can be imported using its ID. + +```shell +terraform import github_organization_repository_role.example 1234 +``` diff --git a/templates/resources/organization_role.md.tmpl b/templates/resources/organization_role.md.tmpl new file mode 100644 index 0000000000..7e7d4c126d --- /dev/null +++ b/templates/resources/organization_role.md.tmpl @@ -0,0 +1,39 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manage a custom organization role. +--- + +# {{.Name}} ({{.Type}}) + +Manage a custom organization role. + +~> **Note**: Custom organization roles are currently only available in GitHub Enterprise Cloud. + +## Example Usage + +{{ tffile "examples/resources/organization_role/example_1.tf" }} + +## Schema + +### Required + +- `name` (String) The name of the organization role. +- `permissions` (Set of String) The permissions included in this role. Only organization permissions can be set if the `base_role` isn't set or is set to `none`. + +### Optional + +- `description` (String) The description of the organization role. +- `base_role` (String) The system role from which this role inherits permissions; one of `none`, `read`, `triage`, `write`, `maintain`, or `admin`. Defaults to `none`. + +### Read-Only + +- `role_id` (Number) The ID of the organization role. + +## Import + +A custom organization role can be imported using its ID. + +```shell +terraform import github_organization_role.example 1234 +``` diff --git a/templates/resources/organization_role_team.md.tmpl b/templates/resources/organization_role_team.md.tmpl new file mode 100644 index 0000000000..d82da57142 --- /dev/null +++ b/templates/resources/organization_role_team.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manage an association between an organization role and a team. +--- + +# {{.Name}} ({{.Type}}) + +Manage an association between an organization role and a team. + +## Example Usage + +{{ tffile "examples/resources/organization_role_team/example_1.tf" }} + +## Schema + +### Required + +- `role_id` (Number) The ID of the organization role. +- `team_slug` (String) The slug of the team name. + +## Import + +An organization role team association can be imported using the role ID and the team slug separated by a `:`. + +```shell +terraform import github_organization_role_team.example "1234:example-team" +``` diff --git a/templates/resources/organization_role_team_assignment.md.tmpl b/templates/resources/organization_role_team_assignment.md.tmpl new file mode 100644 index 0000000000..77e811e595 --- /dev/null +++ b/templates/resources/organization_role_team_assignment.md.tmpl @@ -0,0 +1,34 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages the associations between teams and organization roles. +--- + +# {{.Name}} ({{.Type}}) + +~> **Note:** This resource is deprecated, please use the `github_organization_role_team` resource instead. + +This resource manages relationships between teams and organization roles in your GitHub organization. This works on predefined roles, and custom roles, where the latter is an Enterprise feature. + +Creating this resource assigns the role to a team. + +The organization role and team must both belong to the same organization on GitHub. + +## Example Usage + +{{ tffile "examples/resources/organization_role_team_assignment/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `team_slug` - (Required) The GitHub team slug +- `role_id` - (Required) The GitHub organization role id + +## Import + +GitHub Team Organization Role Assignment can be imported using an ID made up of `team_slug:role_id` + +```hcl +$ terraform import github_organization_role_team_assignment.role_assignment test-team:8132 +``` diff --git a/templates/resources/organization_role_user.md.tmpl b/templates/resources/organization_role_user.md.tmpl new file mode 100644 index 0000000000..f8685b83e9 --- /dev/null +++ b/templates/resources/organization_role_user.md.tmpl @@ -0,0 +1,28 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manage an association between an organization role and a user. +--- + +# {{.Name}} ({{.Type}}) + +Manage an association between an organization role and a user. + +## Example Usage + +{{ tffile "examples/resources/organization_role_user/example_1.tf" }} + +## Schema + +### Required + +- `role_id` (Number) The ID of the organization role. +- `login` (String) The login for the GitHub user account. + +## Import + +An organization role user association can be imported using the role ID and the user login separated by a `:`. + +```shell +terraform import github_organization_role_team.example "1234:example-user" +``` diff --git a/templates/resources/organization_ruleset.md.tmpl b/templates/resources/organization_ruleset.md.tmpl new file mode 100644 index 0000000000..a723b07eff --- /dev/null +++ b/templates/resources/organization_ruleset.md.tmpl @@ -0,0 +1,290 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates a GitHub organization ruleset. +--- + +# {{.Name}} ({{.Type}}) + +Creates a GitHub organization ruleset. + +This resource allows you to create and manage rulesets on the organization level. When applied, a new ruleset will be created. When destroyed, that ruleset will be removed. + +## Example Usage + +{{ tffile "examples/resources/organization_ruleset/example_1.tf" }} + +## Argument Reference + +- `enforcement` - (Required) (String) Possible values for Enforcement are `disabled`, `active`, `evaluate`. Note: `evaluate` is currently only supported for owners of type `organization`. + +- `name` - (Required) (String) The name of the ruleset. + +- `rules` - (Required) (Block List, Min: 1, Max: 1) Rules within the ruleset. (see [below for nested schema](#rules)) + +- `target` - (Required) (String) Possible values are `branch`, `tag` and `push`. + +- `bypass_actors` - (Optional) (Block List) The actors that can bypass the rules in this ruleset. (see [below for nested schema](#bypass_actors)) + +- `conditions` - (Optional) (Block List, Max: 1) Parameters for an organization ruleset condition. For `branch` and `tag` targets, `ref_name` is required alongside one of `repository_name` or `repository_id`. For `push` targets, `ref_name` must NOT be set - only `repository_name` or `repository_id` should be used. (see [below for nested schema](#conditions)) + +### Rules + +The `rules` block supports the following: + +~> **Note:** Rules are target-specific. `branch` and `tag` targets support rules like `creation`, `deletion`, `pull_request`, `required_status_checks`, etc. `push` targets only support `file_path_restriction`, `max_file_size`, `max_file_path_length`, and `file_extension_restriction`. Using the wrong rules for a target will result in a validation error. + +- `branch_name_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the branch_name_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. Conflicts with `tag_name_pattern` as it only applies to rulesets with target `branch`. (see [below for nested schema](#rulesbranch_name_pattern)) + +- `commit_author_email_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the commit_author_email_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. (see [below for nested schema](#rulescommit_author_email_pattern)) + +- `commit_message_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the commit_message_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. (see [below for nested schema](#rulescommit_message_pattern)) + +- `committer_email_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the committer_email_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. (see [below for nested schema](#rulescommitter_email_pattern)) + +- `creation` - (Optional) (Boolean) Only allow users with bypass permission to create matching refs. + +- `deletion` - (Optional) (Boolean) Only allow users with bypass permissions to delete matching refs. + +- `non_fast_forward` - (Optional) (Boolean) Prevent users with push access from force pushing to branches. + +- `pull_request` - (Optional) (Block List, Max: 1) Require all commits be made to a non-target branch and submitted via a pull request before they can be merged. (see [below for nested schema](#rulespull_request)) + +- `copilot_code_review` - (Optional) (Block List, Max: 1) Automatically request Copilot code review for new pull requests if the author has access to Copilot code review and their premium requests quota has not reached the limit. (see [below for nested schema](#rulescopilot_code_review)) + +- `required_linear_history` - (Optional) (Boolean) Prevent merge commits from being pushed to matching branches. + +- `required_signatures` - (Optional) (Boolean) Commits pushed to matching branches must have verified signatures. + +- `required_status_checks` - (Optional) (Block List, Max: 1) Choose which status checks must pass before branches can be merged into a branch that matches this rule. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. (see [below for nested schema](#rulesrequired_status_checks)) + +- `required_workflows` - (Optional) (Block List, Max: 1) Define which Actions workflows must pass before changes can be merged into a branch matching the rule. Multiple workflows can be specified. (see [below for nested schema](#rulesrequired_workflows)) + +- `required_code_scanning` - (Optional) (Block List, Max: 1) Define which tools must provide code scanning results before the reference is updated. When configured, code scanning must be enabled and have results for both the commit and the reference being updated. Multiple code scanning tools can be specified. (see [below for nested schema](#rulesrequired_code_scanning)) + +- `tag_name_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the tag_name_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. Conflicts with `branch_name_pattern` as it only applies to rulesets with target `tag`. (see [below for nested schema](#rulestag_name_pattern)) + +- `file_path_restriction` - (Optional) (Block List, Max: 1) Prevent commits that include changes to specified file paths from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesfile_path_restriction)) + +- `max_file_size` - (Optional) (Block List, Max: 1) Prevent commits that include files with a specified file size from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesmax_file_size)) + +- `max_file_path_length` - (Optional) (Block List, Max: 1) Prevent commits that include file paths that exceed a specified character limit from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesmax_file_path_length)) + +- `file_extension_restriction` - (Optional) (Block List, Max: 1) Prevent commits that include files with specified file extensions from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesfile_extension_restriction)) + +- `update` - (Optional) (Boolean) Only allow users with bypass permission to update matching refs. + +#### rules.branch_name_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.commit_author_email_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.commit_message_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.committer_email_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.pull_request + +- `allowed_merge_methods` - (Optional) (List of String, Min: 1) Array of merge methods to be allowed. Allowed values include `merge`, `squash`, and `rebase`. At least one must be enabled. + +- `dismiss_stale_reviews_on_push` - (Optional) (Boolean) New, reviewable commits pushed will dismiss previous pull request review approvals. Defaults to `false`. + +- `require_code_owner_review` - (Optional) (Boolean) Require an approving review in pull requests that modify files that have a designated code owner. Defaults to `false`. + +- `require_last_push_approval` - (Optional) (Boolean) Whether the most recent reviewable push must be approved by someone other than the person who pushed it. Defaults to `false`. + +- `required_approving_review_count` - (Optional) (Number) The number of approving reviews that are required before a pull request can be merged. Defaults to `0`. + +- `required_review_thread_resolution` - (Optional) (Boolean) All conversations on code must be resolved before a pull request can be merged. Defaults to `false`. + +#### rules.copilot_code_review + +- `review_on_push` - (Optional) (Boolean) Copilot automatically reviews each new push to the pull request. Defaults to `false`. + +- `review_draft_pull_requests` - (Optional) (Boolean) Copilot automatically reviews draft pull requests before they are marked as ready for review. Defaults to `false`. + +- `allowed_merge_methods` - (Required) (List of String, Min: 1) Array of merge methods to be allowed. Allowed values include `merge`, `squash`, and `rebase`. At least one must be enabled. + +- `required_reviewers` - (Optional) (Block List) Require specific reviewers to approve pull requests. Note: This feature is in beta. (see [below for nested schema](#rulespull_requestrequired_reviewers)) + +#### rules.pull_request.required_reviewers + +- `reviewer` - (Required) (Block List, Max: 1) The reviewer that must review matching files. (see [below for nested schema](#rulespull_requestrequired_reviewersreviewer)) + +- `file_patterns` - (Required) (List of String) File patterns (fnmatch syntax) that this reviewer must approve. + +- `minimum_approvals` - (Required) (Number) Minimum number of approvals required from this reviewer. Set to 0 to make approval optional. + +#### rules.pull_request.required_reviewers.reviewer + +- `id` - (Required) (Number) The ID of the reviewer (Team ID). + +- `type` - (Required) (String) The type of reviewer. Currently only `Team` is supported. + +#### rules.required_status_checks + +- `required_check` - (Required) (Block Set, Min: 1) Status checks that are required. Several can be defined. (see [below for nested schema](#rulesrequired_status_checksrequired_check)) + +- `strict_required_status_checks_policy` - (Optional) (Boolean) Whether pull requests targeting a matching branch must be tested with the latest code. This setting will not take effect unless at least one status check is enabled. Defaults to `false`. + +- `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. + +#### rules.required_status_checks.required_check + +- `context` - (Required) (String) The status check context name that must be present on the commit. + +- `integration_id` - (Optional) (Number) The optional integration ID that this status check must originate from. + +- `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. + +#### rules.required_workflows + +- `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. + +- `required_workflow` - (Required) (Block Set, Min: 1) Actions workflows that are required. Multiple can be defined. (see [below for nested schema](#rulesrequired_workflowsrequired_workflow)) + +#### rules.required_workflows.required_workflow + +- `repository_id` - (Required) (Number) The ID of the repository. Names, full names and repository URLs are not supported. + +- `path` - (Required) (String) The path to the YAML definition file of the workflow. + +- `ref` - (Optional) (String) The optional ref from which to fetch the workflow. Defaults to `master`. + +#### rules.required_code_scanning + +- `required_code_scanning_tool` - (Required) (Block Set, Min: 1) Actions code scanning tools that are required. Multiple can be defined. (see [below for nested schema](#rulesrequired_code_scanningrequired_code_scanning_tool)) + +#### rules.required_code_scanning.required_code_scanning_tool + +- `alerts_threshold` - (Required) (String) The severity level at which code scanning results that raise alerts block a reference update. Can be one of: `none`, `errors`, `errors_and_warnings`, `all`. + +- `security_alerts_threshold` - (Required) (String) The severity level at which code scanning results that raise security alerts block a reference update. Can be one of: `none`, `critical`, `high_or_higher`, `medium_or_higher`, `all`. + +- `tool` - (Required) (String) The name of a code scanning tool. + +#### rules.tag_name_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.file_path_restriction + +- `restricted_file_paths` - (Required) (Block Set, Min: 1) The file paths that are restricted from being pushed to the commit graph. + +#### rules.max_file_size + +- `max_file_size` - (Required) (Integer) The maximum allowed size, in megabytes (MB), of a file. Valid range is 1-100 MB. + +#### rules.max_file_path_length + +- `max_file_path_length` - (Required) (Integer) The maximum number of characters allowed in file paths. + +#### rules.file_extension_restriction + +- `restricted_file_extensions` - (Required) (Block Set, Min: 1) The file extensions that are restricted from being pushed to the commit graph. + +#### bypass_actors + +- `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. Some actor types such as `DeployKey` do not have an ID. + +- `actor_type` (String) The type of actor that can bypass a ruleset. Can be one of: `RepositoryRole`, `Team`, `Integration`, `OrganizationAdmin`. + +- `bypass_mode` - (Optional) (String) When the specified actor can bypass the ruleset. pull_request means that an actor can only bypass rules on pull requests. Can be one of: `always`, `pull_request`, `exempt`. + +~>Note: at the time of writing this, the following actor types correspond to the following actor IDs: + +- `OrganizationAdmin` -> `1` +- `RepositoryRole` (This is the actor type, the following are the base repository roles and their associated IDs.) + - `maintain` -> `2` + - `write` -> `4` + - `admin` -> `5` + +#### conditions + +- `ref_name` - (Optional) (Block List, Max: 1) Required for `branch` and `tag` targets. Must NOT be set for `push` targets. (see [below for nested schema](#conditionsref_name)) +- `repository_id` (Optional) (List of Number) The repository IDs that the ruleset applies to. One of these IDs must match for the condition to pass. +- `repository_name` (Optional) (Block List, Max: 1) Targets repositories that match the specified name patterns. (see [below for nested schema](#conditionsrepository_name)) +- `repository_property` (Optional) (Block List, Max: 1) Targets repositories by custom or system properties. (see [below for nested schema](#conditionsrepository_property)) + +Exactly one of `repository_id`, `repository_name`, or `repository_property` must be set for the rule to target repositories. + +~> **Note:** For `push` targets, do not include `ref_name` in conditions. Push rulesets operate on file content, not on refs. + +#### conditions.ref_name + +- `exclude` - (Required) (List of String) Array of ref names or patterns to exclude. The condition will not pass if any of these patterns match. + +- `include` - (Required) (List of String) Array of ref names or patterns to include. One of these patterns must match for the condition to pass. Also accepts `~DEFAULT_BRANCH` to include the default branch or `~ALL` to include all branches. + +#### conditions.repository_name + +- `exclude` - (Required) (List of String) Array of repository names or patterns to exclude. The condition will not pass if any of these patterns match. +- `include` - (Required) (List of String) Array of repository names or patterns to include. One of these patterns must match for the condition to pass. Also accepts `~ALL` to include all repositories. +- `protected` - (Optional) (Boolean) Whether renaming of target repositories is prevented. Defaults to `false`. + +#### conditions.repository_property + +- `include` - (Optional) (List of Repository Properties) The repository properties and values to include. All of these properties must match for the condition to pass. (see [below for nested schema](#conditionsrepository_propertyproperties)) + +- `exclude` - (Optional) (List of Repository Properties) The repository properties and values to exclude. The condition will not pass if any of these properties match. (see [below for nested schema](#conditionsrepository_propertyproperties)) + +#### conditions.repository_property.properties + +- `name` (Required) (String) The name of the repository property to target. + +- `property_values` (Required) (Array of String) The values to match for the repository property. + +- `source` (String) The source of the repository property. Defaults to 'custom' if not specified. Can be one of: `custom`, `system` + +## Attributes Reference + +The following additional attributes are exported: + +- `etag` (String) + +- `node_id` (String) GraphQL global node id for use with v4 API. + +- `ruleset_id` (Number) GitHub ID for the ruleset. + +## Import + +GitHub Organization Rulesets can be imported using the GitHub ruleset ID e.g. + +`$ terraform import github_organization_ruleset.example 12345` diff --git a/templates/resources/organization_security_manager.md.tmpl b/templates/resources/organization_security_manager.md.tmpl new file mode 100644 index 0000000000..684d10caa1 --- /dev/null +++ b/templates/resources/organization_security_manager.md.tmpl @@ -0,0 +1,27 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages the Security manager teams for a GitHub Organization. +--- + +# {{.Name}} ({{.Type}}) + +~> **Note:** This resource is deprecated, please use the `github_organization_role_team` resource instead. + +## Example Usage + +{{ tffile "examples/resources/organization_security_manager/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `team_slug` - (Required) The slug of the team to manage. + +## Import + +GitHub Security Manager Teams can be imported using the GitHub team ID e.g. + +```hcl +$ terraform import github_organization_security_manager.core 1234567 +``` diff --git a/templates/resources/organization_settings.md.tmpl b/templates/resources/organization_settings.md.tmpl new file mode 100644 index 0000000000..5eb1affafd --- /dev/null +++ b/templates/resources/organization_settings.md.tmpl @@ -0,0 +1,58 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages settings for a GitHub Organization. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage settings for a GitHub Organization. + +## Example Usage + +{{ tffile "examples/resources/organization_settings/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `billing_email` - (Required) The billing email address for the organization. +- `company` - (Optional) The company name for the organization. +- `blog` - (Optional) The blog URL for the organization. +- `email` - (Optional) The email address for the organization. +- `twitter_username` - (Optional) The Twitter username for the organization. +- `location` - (Optional) The location for the organization. +- `name` - (Optional) The name for the organization. +- `description` - (Optional) The description for the organization. +- `has_organization_projects` - (Optional) Whether or not organization projects are enabled for the organization. +- `has_repository_projects` - (Optional) Whether or not repository projects are enabled for the organization. +- `default_repository_permission` - (Optional) The default permission for organization members to create new repositories. Can be one of `read`, `write`, `admin`, or `none`. Defaults to `read`. +- `members_can_create_repositories` - (Optional) Whether or not organization members can create new repositories. Defaults to `true`. +- `members_can_create_public_repositories` - (Optional) Whether or not organization members can create new public repositories. Defaults to `true`. +- `members_can_create_private_repositories` - (Optional) Whether or not organization members can create new private repositories. Defaults to `true`. +- `members_can_create_internal_repositories` - (Optional) Whether or not organization members can create new internal repositories. For Enterprise Organizations only. +- `members_can_create_pages` - (Optional) Whether or not organization members can create new pages. Defaults to `true`. +- `members_can_create_public_pages` - (Optional) Whether or not organization members can create new public pages. Defaults to `true`. +- `members_can_create_private_pages` - (Optional) Whether or not organization members can create new private pages. Defaults to `true`. +- `members_can_fork_private_repositories` - (Optional) Whether or not organization members can fork private repositories. Defaults to `false`. +- `web_commit_signoff_required` - (Optional) Whether or not commit signatures are required for commits to the organization. Defaults to `false`. +- `advanced_security_enabled_for_new_repositories` - (Optional) Whether or not advanced security is enabled for new repositories. Defaults to `false`. +- `dependabot_alerts_enabled_for_new_repositories` - (Optional) Whether or not dependabot alerts are enabled for new repositories. Defaults to `false`. +- `dependabot_security_updates_enabled_for_new_repositories` - (Optional) Whether or not dependabot security updates are enabled for new repositories. Defaults to `false`. +- `dependency_graph_enabled_for_new_repositories` - (Optional) Whether or not dependency graph is enabled for new repositories. Defaults to `false`. +- `secret_scanning_enabled_for_new_repositories` - (Optional) Whether or not secret scanning is enabled for new repositories. Defaults to `false`. +- `secret_scanning_push_protection_enabled_for_new_repositories` - (Optional) Whether or not secret scanning push protection is enabled for new repositories. Defaults to `false`. + +## Attributes Reference + +The following additional attributes are exported: + +- `id` - The ID of the organization settings. + +## Import + +Organization settings can be imported using the `id` of the organization. The `id` of the organization can be found using the [get an organization](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) API. + +```hcl +$ terraform import github_organization_settings.test 123456789 +``` diff --git a/templates/resources/organization_webhook.md.tmpl b/templates/resources/organization_webhook.md.tmpl new file mode 100644 index 0000000000..c065e98fd0 --- /dev/null +++ b/templates/resources/organization_webhook.md.tmpl @@ -0,0 +1,41 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages webhooks for GitHub organizations +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage webhooks for GitHub organization. + +## Example Usage + +{{ tffile "examples/resources/organization_webhook/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/) + +- `configuration` - (Required) key/value pair of configuration for this webhook. Available keys are `url`, `content_type`, `secret` and `insecure_ssl`. + +- `active` - (Optional) Indicate of the webhook should receive events. Defaults to `true`. + +- `name` - (Optional) The type of the webhook. `web` is the default and the only option. + +## Attributes Reference + +The following additional attributes are exported: + +- `url` - URL of the webhook + +## Import + +Organization webhooks can be imported using the `id` of the webhook. The `id` of the webhook can be found in the URL of the webhook. For example, `"https://github.com/organizations/foo-org/settings/hooks/123456789"`. + +```hcl +$ terraform import github_organization_webhook.terraform 123456789 +``` + +If secret is populated in the webhook's configuration, the value will be imported as "********". diff --git a/templates/resources/project_card.md.tmpl b/templates/resources/project_card.md.tmpl new file mode 100644 index 0000000000..6dcad41687 --- /dev/null +++ b/templates/resources/project_card.md.tmpl @@ -0,0 +1,41 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages project cards for GitHub projects +--- + +# {{.Name}} ({{.Type}}) + +!> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. + +This resource allows you to create and manage cards for GitHub projects. + +## Example Usage + +{{ tffile "examples/resources/project_card/example_1.tf" }} + +## Example Usage adding an Issue to a Project + +{{ tffile "examples/resources/project_card/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `column_id` - (Required) The ID of the card. + +- `note` - (Optional) The note contents of the card. Markdown supported. + +- `content_id` - (Optional) `github_issue.issue_id`. + +- `content_type` - (Optional) Must be either `Issue` or `PullRequest` + +**Remarks:** You must either set the `note` attribute or both `content_id` and `content_type`. See [note example](#example-usage) or [issue example](#example-usage-adding-an-issue-to-a-project) for more information. + +## Import + +A GitHub Project Card can be imported using its [Card ID](https://developer.github.com/v3/projects/cards/#get-a-project-card): + +```hcl +$ terraform import github_project_card.card 01234567 +``` diff --git a/templates/resources/project_column.md.tmpl b/templates/resources/project_column.md.tmpl new file mode 100644 index 0000000000..5369b6deec --- /dev/null +++ b/templates/resources/project_column.md.tmpl @@ -0,0 +1,23 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages project columns for GitHub projects +--- + +# {{.Name}} ({{.Type}}) + +!> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. + +This resource allows you to create and manage columns for GitHub projects. + +## Example Usage + +{{ tffile "examples/resources/project_column/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `project_id` - (Required) The ID of an existing project that the column will be created in. + +- `name` - (Required) The name of the column. diff --git a/templates/resources/release.md.tmpl b/templates/resources/release.md.tmpl new file mode 100644 index 0000000000..eede9749d4 --- /dev/null +++ b/templates/resources/release.md.tmpl @@ -0,0 +1,71 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages releases within a single GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage a release in a specific GitHub repository. + +## Example Usage + +{{ tffile "examples/resources/release/example_1.tf" }} + +## Example Usage on Non-Default Branch + +{{ tffile "examples/resources/release/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The name of the repository. + +- `tag_name` - (Required) The name of the tag. + +- `target_commitish` - (Optional) The branch name or commit SHA the tag is created from. Defaults to the default branch of the repository. + +- `name` - (Optional) The name of the release. + +- `body` - (Optional) Text describing the contents of the tag. + +- `draft` - (Optional) Set to `false` to create a published release. + +- `prerelease` - (Optional) Set to `false` to identify the release as a full release. + +- `generate_release_notes` - (Optional) Set to `true` to automatically generate the name and body for this release. If `name` is specified, the specified `name` will be used; otherwise, a name will be automatically generated. If `body` is specified, the `body` will be pre-pended to the automatically generated notes. + +- `discussion_category_name` - (Optional) If specified, a discussion of the specified category is created and linked to the release. The value must be a category that already exists in the repository. For more information, see [Managing categories for discussions in your repository](https://docs.github.com/discussions/managing-discussions-for-your-community/managing-categories-for-discussions-in-your-repository). + +## Attributes Reference + +The following additional attributes are exported: + +- `release_id` - The ID of the release. + +- `created_at` - This is the date of the commit used for the release, and not the date when the release was drafted or published. + +- `published_at` - This is the date when the release was published. This will be empty if the release is a draft. + +- `html_url` - URL of the release in GitHub. + +- `url` - URL that can be provided to API calls that reference this release. + +- `assets_url` - URL that can be provided to API calls displaying the attached assets to this release. + +- `upload_url` - URL that can be provided to API calls to upload assets. + +- `zipball_url` - URL that can be provided to API calls to fetch the release ZIP archive. + +- `tarball_url` - URL that can be provided to API calls to fetch the release TAR archive. + +- `node_id` - GraphQL global node id for use with v4 API + +## Import + +This resource can be imported using the `name` of the repository, combined with the `id` of the release, and a `:` character for separating components, e.g. + +```sh +terraform import github_release.example repo:12345678 +``` diff --git a/templates/resources/repository.md.tmpl b/templates/resources/repository.md.tmpl new file mode 100644 index 0000000000..5b2cd371f2 --- /dev/null +++ b/templates/resources/repository.md.tmpl @@ -0,0 +1,206 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages repositories within GitHub organizations or personal accounts +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage repositories within your GitHub organization or personal account. + +~> **Note** When used with GitHub App authentication, even GET requests must have the `contents:write` permission. Without it, the following arguments will be ignored, leading to unexpected behavior and confusing diffs: `allow_merge_commit`, `allow_squash_merge`, `allow_rebase_merge`, `merge_commit_title`, `merge_commit_message`, `squash_merge_commit_title` and `squash_merge_commit_message`. + +## Example Usage + +{{ tffile "examples/resources/repository/example_1.tf" }} + +## Example Usage with Repository Forking + +{{ tffile "examples/resources/repository/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the repository. + +- `description` - (Optional) A description of the repository. + +- `homepage_url` - (Optional) URL of a page describing the project. + +- `fork` - (Optional) Set to `true` to create a fork of an existing repository. When set to `true`, both `source_owner` and `source_repo` must also be specified. + +- `source_owner` - (Optional) The GitHub username or organization that owns the repository being forked. Required when `fork` is `true`. + +- `source_repo` - (Optional) The name of the repository to fork. Required when `fork` is `true`. + +- `private` - (Optional) Set to `true` to create a private repository. Repositories are created as public (e.g. open source) by default. + +- `visibility` - (Optional) Can be `public` or `private`. If your organization is associated with an enterprise account using GitHub Enterprise Cloud or GitHub Enterprise Server 2.20+, visibility can also be `internal`. The `visibility` parameter overrides the `private` parameter. + +- `has_issues` - (Optional) Set to `true` to enable the GitHub Issues features on the repository. + +- `has_discussions` - (Optional) Set to `true` to enable GitHub Discussions on the repository. Defaults to `false`. + +- `has_projects` - (Optional) Set to `true` to enable the GitHub Projects features on the repository. Per the GitHub [documentation](https://developer.github.com/v3/repos/#create) when in an organization that has disabled repository projects it will default to `false` and will otherwise default to `true`. If you specify `true` when it has been disabled it will return an error. + +- `has_wiki` - (Optional) Set to `true` to enable the GitHub Wiki features on the repository. + +- `is_template` - (Optional) Set to `true` to tell GitHub that this is a template repository. + +- `allow_merge_commit` - (Optional) Set to `false` to disable merge commits on the repository. + +- `allow_squash_merge` - (Optional) Set to `false` to disable squash merges on the repository. + +- `allow_rebase_merge` - (Optional) Set to `false` to disable rebase merges on the repository. + +- `allow_auto_merge` - (Optional) Set to `true` to allow auto-merging pull requests on the repository. + +- `allow_forking` - (Optional) Configure private forking for organization owned private and internal repositories; set to `true` to enable, `false` to disable, and leave unset for the default behaviour. Configuring this requires that private forking is not being explicitly configured at the organization level. + +- `squash_merge_commit_title` - (Optional) Can be `PR_TITLE` or `COMMIT_OR_PR_TITLE` for a default squash merge commit title. Applicable only if `allow_squash_merge` is `true`. + +- `squash_merge_commit_message` - (Optional) Can be `PR_BODY`, `COMMIT_MESSAGES`, or `BLANK` for a default squash merge commit message. Applicable only if `allow_squash_merge` is `true`. + +- `merge_commit_title` - Can be `PR_TITLE` or `MERGE_MESSAGE` for a default merge commit title. Applicable only if `allow_merge_commit` is `true`. + +- `merge_commit_message` - Can be `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message. Applicable only if `allow_merge_commit` is `true`. + +- `delete_branch_on_merge` - (Optional) Automatically delete head branch after a pull request is merged. Defaults to `false`. + +- `web_commit_signoff_required` - (Optional) Require contributors to sign off on web-based commits. See more in the [GitHub documentation](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/managing-repository-settings/managing-the-commit-signoff-policy-for-your-repository). + +- `has_downloads` - (**DEPRECATED**) (Optional) Set to `true` to enable the (deprecated) downloads features on the repository. This attribute is no longer in use, but it hasn't been removed yet. It will be removed in a future version. See [this discussion](https://github.com/orgs/community/discussions/102145#discussioncomment-8351756). + +- `auto_init` - (Optional) Set to `true` to produce an initial commit in the repository. + +- `gitignore_template` - (Optional) Use the [name of the template](https://github.com/github/gitignore) without the extension. For example, "Haskell". + +- `license_template` - (Optional) Use the [name of the template](https://github.com/github/choosealicense.com/tree/gh-pages/_licenses) without the extension. For example, "mit" or "mpl-2.0". + +- `default_branch` - (Optional) (Deprecated: Use `github_branch_default` resource instead) The name of the default branch of the repository. **NOTE:** This can only be set after a repository has already been created, and after a correct reference has been created for the target branch inside the repository. This means a user will have to omit this parameter from the initial repository creation and create the target branch inside of the repository prior to setting this attribute. + +- `archived` - (Optional) Specifies if the repository should be archived. Defaults to `false`. **NOTE** Currently, the API does not support unarchiving. + +- `archive_on_destroy` - (Optional) Set to `true` to archive the repository instead of deleting on destroy. + +- `pages` - (Optional) (**DEPRECATED**) The repository's GitHub Pages configuration. Use the `github_repository_pages` resource instead. This field will be removed in a future version. See [GitHub Pages Configuration](#github-pages-configuration) below for details. + +- `security_and_analysis` - (Optional) The repository's [security and analysis](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/managing-security-and-analysis-settings-for-your-repository) configuration. See [Security and Analysis Configuration](#security-and-analysis-configuration) below for details. + +- `topics` - (Optional) The list of topics of the repository. + +~> Note: This attribute is not compatible with the `github_repository_topics` resource. Use one of them. `github_repository_topics` is only meant to be used if the repository itself is not handled via terraform, for example if it's only read as a datasource (see [issue #1845](https://github.com/integrations/terraform-provider-github/issues/1845)). + +- `template` - (Optional) Use a template repository to create this resource. See [Template Repositories](#template-repositories) below for details. + +- `vulnerability_alerts` - (Optional) (**DEPRECATED**) Configure [Dependabot security alerts](https://help.github.com/en/github/managing-security-vulnerabilities/about-security-alerts-for-vulnerable-dependencies) for vulnerable dependencies; set to `true` to enable, set to `false` to disable, and leave unset for the default behavior. Configuring this requires that alerts are not being explicitly configured at the organization level. This field will be removed in a future version. Use the `github_repository_vulnerability_alerts` resource instead. + +- `ignore_vulnerability_alerts_during_read` (**DEPRECATED**) (Optional) - This is ignored as the provider now handles lack of permissions automatically. This field will be removed in a future version. + +- `allow_update_branch` (Optional) - Set to `true` to always suggest updating pull request branches. + +### GitHub Pages Configuration + +The `pages` block supports the following: + +- `source` - (Optional) The source branch and directory for the rendered Pages site. See [GitHub Pages Source](#github-pages-source) below for details. + +- `build_type` - (Optional) The type of GitHub Pages site to build. Can be `legacy` or `workflow`. If you use `legacy` as build type you need to set the option `source`. + +- `cname` - (Optional) The custom domain for the repository. This can only be set after the repository has been created. + +#### GitHub Pages Source + +The `source` block supports the following: + +- `branch` - (Required) The repository branch used to publish the site's source files. (i.e. `main` or `gh-pages`. + +- `path` - (Optional) The repository directory from which the site publishes (Default: `/`). + +### Security and Analysis Configuration + +The `security_and_analysis` block supports the following: + +- `advanced_security` - (Optional) The advanced security configuration for the repository. See [Advanced Security Configuration](#advanced-security-configuration) below for details. If a repository's visibility is `public`, advanced security is always enabled and cannot be changed, so this setting cannot be supplied. + +- `code_security` - (Optional) The code security configuration for the repository. See [Code Security](#code-security-configuration) below for details. + +- `secret_scanning` - (Optional) The secret scanning configuration for the repository. See [Secret Scanning Configuration](#secret-scanning-configuration) below for details. + +- `secret_scanning_push_protection` - (Optional) The secret scanning push protection configuration for the repository. See [Secret Scanning Push Protection Configuration](#secret-scanning-push-protection-configuration) below for details. + +- `secret_scanning_ai_detection` - (Optional) The secret scanning ai detection configuration for the repository. See [Secret Scanning AI Detection Configuration](#secret-scanning-ai-detection) below for details. + +- `secret_scanning_non_provider_patterns` - (Optional) The secret scanning non-provider patterns configuration for this repository. See [Secret Scanning Non-Provider Patterns Configuration](#secret-scanning-non-provider-patterns) below for more details. + +#### Advanced Security Configuration + +The `advanced_security` block supports the following: + +- `status` - (Required) Set to `enabled` to enable advanced security features on the repository. Can be `enabled` or `disabled`. + +#### Code Security Configuration + +- `status` - (Required) Set to `enabled` to enable GitHub Code Security on the repository. Can be `enabled` or `disabled`. If set to `enabled`, the repository's visibility must be `public`, `security_and_analysis[0].advanced_security[0].status` must also be set to `enabled`, or your Organization must have split licensing for Advanced security. + +#### Secret Scanning Configuration + +- `status` - (Required) Set to `enabled` to enable secret scanning on the repository. Can be `enabled` or `disabled`. If set to `enabled`, the repository's visibility must be `public`, `security_and_analysis[0].advanced_security[0].status` must also be set to `enabled`, or your Organization must have split licensing for Advanced security. + +#### Secret Scanning Push Protection Configuration + +- `status` - (Required) Set to `enabled` to enable secret scanning push protection on the repository. Can be `enabled` or `disabled`. If set to `enabled`, the repository's visibility must be `public`, `security_and_analysis[0].advanced_security[0].status` must also be set to `enabled`, or your Organization must have split licensing for Advanced security. + +#### Secret Scanning AI Detection + +- `status` - (Required) Set to `enabled` to enable secret scanning AI detection on the repository. Can be `enabled` or `disabled`. If set to `enabled`, the repository's visibility must be `public`, `security_and_analysis[0].advanced_security[0].status` must also be set to `enabled`, or your Organization must have split licensing for Advanced security. + +#### Secret Scanning Non-Provider Patterns + +- `status` - (Required) Set to `enabled` to enable secret scanning non-provider patterns on the repository. Can be `enabled` or `disabled`. If set to `enabled`, the repository's visibility must be `public`, `security_and_analysis[0].advanced_security[0].status` must also be set to `enabled`, or your Organization must have split licensing for Advanced security. + +### Template Repositories + +`template` supports the following arguments: + +- `owner`: The GitHub organization or user the template repository is owned by. +- `repository`: The name of the template repository. +- `include_all_branches`: Whether the new repository should include all the branches from the template repository (defaults to false, which includes only the default branch from the template). + +~> **Note on `internal` visibility with templates**: When creating a repository from a template with `visibility = "internal"`, the provider uses a two-step process due to GitHub API limitations. The template creation API only supports a `private` boolean parameter. Therefore, repositories with `visibility = "internal"` are initially created as private and then immediately updated to internal visibility. This ensures internal repositories are never exposed publicly during creation. + +## Attributes Reference + +The following additional attributes are exported: + +- `full_name` - A string of the form "orgname/reponame". + +- `html_url` - URL to the repository on the web. + +- `ssh_clone_url` - URL that can be provided to `git clone` to clone the repository via SSH. + +- `http_clone_url` - URL that can be provided to `git clone` to clone the repository via HTTPS. + +- `git_clone_url` - URL that can be provided to `git clone` to clone the repository anonymously via the git protocol. + +- `svn_url` - URL that can be provided to `svn checkout` to check out the repository via GitHub's Subversion protocol emulation. + +- `node_id` - GraphQL global node id for use with v4 API + +- `repo_id` - GitHub ID for the repository + +- `primary_language` - The primary language used in the repository. + +- `pages` - The block consisting of the repository's GitHub Pages configuration. + - `custom_404` - Whether the rendered GitHub Pages site has a custom 404 page. + - `html_url` - The absolute URL (including scheme) of the rendered GitHub Pages site e.g. `https://username.github.io`. + - `status` - The GitHub Pages site's build status e.g. `building` or `built`. + +## Import + +Repositories can be imported using the `name`, e.g. + +```shell +terraform import github_repository.terraform myrepo +``` diff --git a/templates/resources/repository_autolink_reference.md.tmpl b/templates/resources/repository_autolink_reference.md.tmpl new file mode 100644 index 0000000000..8be8a60e05 --- /dev/null +++ b/templates/resources/repository_autolink_reference.md.tmpl @@ -0,0 +1,49 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages autolink references for a single repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage an autolink reference for a single repository. + +## Example Usage + +{{ tffile "examples/resources/repository_autolink_reference/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository of the autolink reference. + +- `key_prefix` - (Required) This prefix appended by a number will generate a link any time it is found in an issue, pull request, or commit. + +- `target_url_template` - (Required) The template of the target URL used for the links; must be a valid URL and contain `` for the reference number + +- `is_alphanumeric` - (Optional) Whether this autolink reference matches alphanumeric characters. If false, this autolink reference only matches numeric characters. Default is true. + +## Attributes Reference + +The following additional attributes are exported: + +- `etag` - An etag representing the autolink reference object. + +## Import + +Autolink references can be imported using the `name` of the repository, combined with the `id` or `key prefix` of the autolink reference and a `/` character for separating components, e.g. + +### Import by ID + +```sh +terraform import github_repository_autolink_reference.auto my-repo/123 +``` + +See the GitHub documentation for how to [list all autolinks of a repository](https://docs.github.com/en/rest/repos/autolinks#list-all-autolinks-of-a-repository) to learn the autolink ids to use with the import command. + +### Import by key prefix + +```sh +terraform import github_repository_autolink_reference.auto oof/OOF- +``` diff --git a/templates/resources/repository_collaborator.md.tmpl b/templates/resources/repository_collaborator.md.tmpl new file mode 100644 index 0000000000..73a6227f66 --- /dev/null +++ b/templates/resources/repository_collaborator.md.tmpl @@ -0,0 +1,55 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub repository collaborator resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub repository collaborator resource. + +~> Note: github_repository_collaborator cannot be used in conjunction with github_repository_collaborators or they will fight over what your policy should be. + +This resource allows you to add/remove collaborators from repositories in your organization or personal account. For organization repositories, collaborators can have explicit (and differing levels of) read, write, or administrator access to specific repositories, without giving the user full organization membership. For personal repositories, collaborators can only be granted write (implicitly includes read) permission. + +When applied, an invitation will be sent to the user to become a collaborator on a repository. When destroyed, either the invitation will be cancelled or the collaborator will be removed from the repository. + +~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing collaborator modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. + +This resource is non-authoritative, for managing ALL collaborators of a repo, use github_repository_collaborators instead. + +Further documentation on GitHub collaborators: + +- [Adding outside collaborators to your personal repositories](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories) +- [Adding outside collaborators to repositories in your organization](https://help.github.com/articles/adding-outside-collaborators-to-repositories-in-your-organization/) +- [Converting an organization member to an outside collaborator](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/) + +## Example Usage + +{{ tffile "examples/resources/repository_collaborator/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository + +~> Note: The owner of the repository can be passed as part of the repository name e.g. `owner-org-name/repo-name`. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variable `GITHUB_OWNER`. + +- `username` - (Required) The user to add to the repository as a collaborator. +- `permission` - (Optional) The permission of the outside collaborator for the repository. Must be one of `pull`, `push`, `maintain`, `triage` or `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organization for organization-owned repositories. Must be `push` for personal repositories. Defaults to `push`. +- `permission_diff_suppression` - (Optional) Suppress plan diffs for `triage` and `maintain`. Defaults to `false`. + +## Attribute Reference + +In addition to the above arguments, the following attributes are exported: + +- `invitation_id` - ID of the invitation to be used in `github_user_invitation_accepter`. + +## Import + +GitHub Repository Collaborators can be imported using an ID made up of `repository:username`, e.g. + +```hcl +$ terraform import github_repository_collaborator.collaborator terraform:someuser +``` diff --git a/templates/resources/repository_collaborators.md.tmpl b/templates/resources/repository_collaborators.md.tmpl new file mode 100644 index 0000000000..8b3e6d4a16 --- /dev/null +++ b/templates/resources/repository_collaborators.md.tmpl @@ -0,0 +1,66 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub repository collaborators resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub repository collaborators resource. + +~> Note: github_repository_collaborators cannot be used in conjunction with github_repository_collaborator and github_team_repository or they will fight over what your policy should be. + +This resource allows you to manage all collaborators for repositories in your organization or personal account. For organization repositories, collaborators can have explicit (and differing levels of) read, write, or administrator access to specific repositories, without giving the user full organization membership. For personal repositories, collaborators can only be granted write (implicitly includes read) permission. + +When applied, an invitation will be sent to the user to become a collaborators on a repository. When destroyed, either the invitation will be cancelled or the collaborators will be removed from the repository. + +~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing collaborator modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. + +This resource is authoritative. For adding a collaborator to a repo in a non-authoritative manner, use github_repository_collaborator instead. + +Further documentation on GitHub collaborators: + +- [Adding outside collaborators to your personal repositories](https://help.github.com/en/github/setting-up-and-managing-your-github-user-account/managing-access-to-your-personal-repositories) +- [Adding outside collaborators to repositories in your organization](https://help.github.com/articles/adding-outside-collaborators-to-repositories-in-your-organization/) +- [Converting an organization member to an outside collaborators](https://help.github.com/articles/converting-an-organization-member-to-an-outside-collaborator/) + +## Example Usage + +{{ tffile "examples/resources/repository_collaborators/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository. +- `user` - (Optional) List of users to grant access to the repository. +- `team` - (Optional) List of teams to grant access to the repository. +- `ignore_team` - (Optional) List of teams to ignore when checking for repository access. This supports ignoring teams granted access at an organizational level. + +The `user` block supports: + +- `username` - (Required) The user to add to the repository as a collaborator. +- `permission` - (Optional) The permission of the outside collaborators for the repository. Must be one of `pull`, `push`, `maintain`, `triage` or `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organization for organization-owned repositories. Must be `push` for personal repositories. Defaults to `push`. + +The `team` block supports: + +- `team_id` - (Required) The GitHub team id or the GitHub team slug. +- `permission` - (Optional) The permission of the outside collaborators for the repository. Must be one of `pull`, `triage`, `push`, `maintain`, `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organisation. Defaults to `pull`. Must be `push` for personal repositories. Defaults to `push`. + +The `ignore_team` block supports: + +- `team_id` - (Required) The GitHub team id or the GitHub team slug. + +## Attribute Reference + +In addition to the above arguments, the following attributes are exported: + +- `invitation_ids` - Map of usernames to invitation ID for any users added as part of creation of this resource to be used in `github_user_invitation_accepter`. + +## Import + +GitHub Repository Collaborators can be imported using the name `name`, e.g. + +```hcl +$ terraform import github_repository_collaborators.collaborators terraform +``` diff --git a/templates/resources/repository_custom_property.md.tmpl b/templates/resources/repository_custom_property.md.tmpl new file mode 100644 index 0000000000..c411d703e6 --- /dev/null +++ b/templates/resources/repository_custom_property.md.tmpl @@ -0,0 +1,35 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and a specific custom property for a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage a specific custom property for a GitHub repository. + +## Example Usage + +> Note that this assumes there already is a custom property defined on the org level called `my-cool-property` of type `string` + +{{ tffile "examples/resources/repository_custom_property/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository of the environment. + +- `property_type` - (Required) Type of the custom property. Can be one of `single_select`, `multi_select`, `string`, or `true_false` + +- `property_name` - (Required) Name of the custom property. Note that a pre-requisiste for this resource is that a custom property of this name has already been defined on the organization level + +- `property_value` - (Required) Value of the custom property in the form of an array. Properties of type `single_select`, `string`, and `true_false` are represented as a string array of length 1 + +## Import + +GitHub Repository Custom Property can be imported using an ID made up of a combination of the names of the organization, repository, custom property separated by a `:` character, e.g. + +```hcl +$ terraform import github_repository_custom_property.example organization-name:repo-name:custom-property-name +``` diff --git a/templates/resources/repository_dependabot_security_updates.md.tmpl b/templates/resources/repository_dependabot_security_updates.md.tmpl new file mode 100644 index 0000000000..f34ff80ab6 --- /dev/null +++ b/templates/resources/repository_dependabot_security_updates.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages automated security fixes for a single repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage dependabot automated security fixes for a single repository. See the [documentation](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates) for details of usage and how this will impact your repository + +## Example Usage + +{{ tffile "examples/resources/repository_dependabot_security_updates/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The name of the GitHub repository. + +- `enabled` - (Required) The state of the automated security fixes. + +## Import + +Automated security references can be imported using the `name` of the repository + +### Import by name + +```sh +terraform import github_repository_dependabot_security_updates.example my-repo +``` diff --git a/templates/resources/repository_deploy_key.md.tmpl b/templates/resources/repository_deploy_key.md.tmpl new file mode 100644 index 0000000000..bbe4b340e4 --- /dev/null +++ b/templates/resources/repository_deploy_key.md.tmpl @@ -0,0 +1,42 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub repository deploy key resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub repository deploy key resource. + +A deploy key is an SSH key that is stored on your server and grants access to a single GitHub repository. This key is attached directly to the repository instead of to a personal user account. + +This resource allows you to add/remove repository deploy keys. + +~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing deploy key modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. + +Further documentation on GitHub repository deploy keys: + +- [About deploy keys](https://developer.github.com/guides/managing-deploy-keys/#deploy-keys) + +## Example Usage + +{{ tffile "examples/resources/repository_deploy_key/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `key` - (Required) A SSH key. +- `read_only` - (Required) A boolean qualifying the key to be either read only or read/write. +- `repository` - (Required) Name of the GitHub repository. +- `title` - (Required) A title. + +Changing any of the fields forces re-creating the resource. + +## Import + +Repository deploy keys can be imported using a colon-separated pair of repository name and GitHub's key id. The latter can be obtained by GitHub's SDKs and API. + +```hcl +$ terraform import github_repository_deploy_key.foo test-repo:23824728 +``` diff --git a/templates/resources/repository_deployment_branch_policy.md.tmpl b/templates/resources/repository_deployment_branch_policy.md.tmpl new file mode 100644 index 0000000000..d143e96ba5 --- /dev/null +++ b/templates/resources/repository_deployment_branch_policy.md.tmpl @@ -0,0 +1,37 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages deployment branch policies +--- + +# {{.Name}} ({{.Type}}) + +~> **Note:** This resource is deprecated, please use the `github_repository_environment_deployment_policy` resource instead. + +This resource allows you to create and manage deployment branch policies. + +## Example Usage + +{{ tffile "examples/resources/repository_deployment_branch_policy/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository to create the policy in. + +- `environment_name` - (Required) The name of the environment. This environment must have `deployment_branch_policy.custom_branch_policies` set to true or a 404 error will be thrown. + +- `name` - (Required) The name pattern that branches must match in order to deploy to the environment. + +## Attributes Reference + +The following additional attributes are exported: + +- `id` - The ID of the deployment branch policy. + +## Import + +```hcl +$ terraform import github_repository_deployment_branch_policy.foo repo:env:id +``` diff --git a/templates/resources/repository_environment.md.tmpl b/templates/resources/repository_environment.md.tmpl new file mode 100644 index 0000000000..5fc2057184 --- /dev/null +++ b/templates/resources/repository_environment.md.tmpl @@ -0,0 +1,65 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages environments for GitHub repositories +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage environments for a GitHub repository. + +## Example Usage + +{{ tffile "examples/resources/repository_environment/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `environment` - (Required) The name of the environment. + +- `repository` - (Required) The repository of the environment. + +- `wait_timer` - (Optional) Amount of time to delay a job after the job is initially triggered. + +- `can_admins_bypass` - (Optional) Can repository admins bypass the environment protections. Defaults to `true`. + +- `prevent_self_review` - (Optional) Whether or not a user who created the job is prevented from approving their own job. Defaults to `false`. + +### Reviewers + +The `reviewers` block supports the following: + +- `teams` - (Optional) Up to 6 IDs for teams who may review jobs that reference the environment. Reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed. + +- `users` - (Optional) Up to 6 IDs for users who may review jobs that reference the environment. Reviewers must have at least read access to the repository. Only one of the required reviewers needs to approve the job for it to proceed. + +#### Deployment Branch Policy + +The `deployment_branch_policy` block supports the following: + +- `protected_branches` - (Required) Whether only branches with branch protection rules can deploy to this environment. + +- `custom_branch_policies` - (Required) Whether only branches that match the specified name patterns can deploy to this environment. + +## Attributes Reference + +- `repository_id` - The ID of the repository. + +## Import + +This resource can be imported using an ID made of the repository name and environment name (any `:` in the environment name need to be escaped as `??`) separated by a `:`. + +### Import Block + +The following import block imports an environment called `myenv` for the repo `myrepo` to a `github_repository_environment` resource named `example`. + +{{tffile "examples/resources/repository_environment/example_2.tf"}} + +### Import Command + +The following command imports an environment called `myenv` for the repo `myrepo` to a `github_repository_environment` resource named `example`. + +```shell +terraform import github_repository_environment.example myrepo:myenv +``` diff --git a/templates/resources/repository_environment_deployment_policy.md.tmpl b/templates/resources/repository_environment_deployment_policy.md.tmpl new file mode 100644 index 0000000000..267ee02dbb --- /dev/null +++ b/templates/resources/repository_environment_deployment_policy.md.tmpl @@ -0,0 +1,54 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages environment deployment branch policies for GitHub repositories +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage environment deployment branch policies for a GitHub repository. + +## Example Usage + +Create a branch-based deployment policy: + +{{ tffile "examples/resources/repository_environment_deployment_policy/example_1.tf" }} + +Create a tag-based deployment policy: + +{{ tffile "examples/resources/repository_environment_deployment_policy/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `environment` - (Required) The name of the environment. + +- `repository` - (Required) The repository of the environment. + +- `branch_pattern` - (Optional) The name pattern that branches must match in order to deploy to the environment. If not specified, `tag_pattern` must be specified. + +- `tag_pattern` - (Optional) The name pattern that tags must match in order to deploy to the environment. If not specified, `branch_pattern` must be specified. + +## Attributes Reference + +- `repository_id` - The ID of the repository. +- `policy_id` - The ID of the deployment policy. + +## Import + +This resource can be imported using an ID made of the repository name, environment name (any `:` in the environment name need to be escaped as `??`), and deployment policy ID name all separated by a `:`. + +### Import Block + +The following import block imports a deployment policy with the ID `123456` for the repo `myrepo` and environment `myenv` to a `github_repository_environment_deployment_policy` resource named `example`. + +{{tffile "examples/resources/repository_environment_deployment_policy/example_3.tf"}} + +### Import Command + +The following command imports a deployment policy with the ID `123456` for the repo `myrepo` and environment `myenv` to a `github_repository_environment_deployment_policy` resource named `example`. + +```shell +terraform import github_repository_environment_deployment_policy.example myrepo:myenv:123456 +``` diff --git a/templates/resources/repository_file.md.tmpl b/templates/resources/repository_file.md.tmpl new file mode 100644 index 0000000000..25b9d6c198 --- /dev/null +++ b/templates/resources/repository_file.md.tmpl @@ -0,0 +1,73 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages files within a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage files within a GitHub repository. + +~> **Note:** When a repository is archived, Terraform will skip deletion of repository files to avoid API errors, as archived repositories are read-only. The files will be removed from Terraform state without attempting to delete them from GitHub. + +## Example Usage + +### Existing Branch + +{{ tffile "examples/resources/repository_file/example_1.tf" }} + +### Auto Created Branch + +{{ tffile "examples/resources/repository_file/example_2.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository to create the file in. + +- `file` - (Required) The path of the file to manage. + +- `content` - (Required) The file content. + +- `branch` - (Optional) Git branch (defaults to the repository's default branch). The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true. + +- `commit_author` - (Optional) Committer author name to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This maybe useful when a branch protection rule requires signed commits. + +- `commit_email` - (Optional) Committer email address to use. **NOTE:** GitHub app users may omit author and email information so GitHub can verify commits as the GitHub App. This may be useful when a branch protection rule requires signed commits. + +- `commit_message` - (Optional) The commit message when creating, updating or deleting the managed file. + +- `overwrite_on_create` - (Optional) Enable overwriting existing files. If set to `true` it will overwrite an existing file with the same name. If set to `false` it will fail if there is an existing file with the same name. + +- `autocreate_branch` - (Optional) **Deprecated** Automatically create the branch if it could not be found. Defaults to false. Subsequent reads if the branch is deleted will occur from 'autocreate_branch_source_branch'. Use the `github_branch` resource instead. + +- `autocreate_branch_source_branch` - (Optional) **Deprecated** The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'. Use the `github_branch` resource instead. + +- `autocreate_branch_source_sha` - (Optional) **Deprecated** The commit hash to start from, if 'autocreate_branch' is set. Defaults to the tip of 'autocreate_branch_source_branch'. If provided, 'autocreate_branch_source_branch' is ignored. Use the `github_branch` resource instead. + +## Attributes Reference + +The following additional attributes are exported: + +- `commit_sha` - The SHA of the commit that modified the file. + +- `repository_id` - The ID of the repository. + +- `sha` - The SHA blob of the file. + +- `ref` - The name of the commit/branch/tag. + +## Import + +Repository files can be imported using a combination of the `repo`, `file` and `branch` or empty branch for the default branch, e.g. + +```sh +terraform import github_repository_file.gitignore example:.gitignore:feature-branch +``` + +and using default branch: + +```sh +terraform import github_repository_file.gitignore example:.gitignore: +``` diff --git a/templates/resources/repository_milestone.md.tmpl b/templates/resources/repository_milestone.md.tmpl new file mode 100644 index 0000000000..bb1b16e1a3 --- /dev/null +++ b/templates/resources/repository_milestone.md.tmpl @@ -0,0 +1,45 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub repository milestone resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub repository milestone resource. + +This resource allows you to create and manage milestones for a GitHub Repository within an organization or user account. + +## Example Usage + +{{ tffile "examples/resources/repository_milestone/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `owner` - (Required) The owner of the GitHub Repository. + +- `repository` - (Required) The name of the GitHub Repository. + +- `title` - (Required) The title of the milestone. + +- `description` - (Optional) A description of the milestone. + +- `due_date` - (Optional) The milestone due date. In `yyyy-mm-dd` format. + +- `state` - (Optional) The state of the milestone. Either `open` or `closed`. Default: `open` + +## Attributes Reference + +The following additional attributes are exported: + +- `number` - The number of the milestone. + +## Import + +A GitHub Repository Milestone can be imported using an ID made up of `owner/repository/number`, e.g. + +```hcl +$ terraform import github_repository_milestone.example example-owner/example-repository/1 +``` diff --git a/templates/resources/repository_pages.md.tmpl b/templates/resources/repository_pages.md.tmpl new file mode 100644 index 0000000000..2a84ad69a1 --- /dev/null +++ b/templates/resources/repository_pages.md.tmpl @@ -0,0 +1,71 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages GitHub Pages for a repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage GitHub Pages for a repository. See the [documentation](https://docs.github.com/en/pages/getting-started-with-github-pages/about-github-pages) for details on GitHub Pages. + +The authenticated user must be a repository administrator, maintainer, or have the 'manage GitHub Pages settings' permission. OAuth app tokens and personal access tokens (classic) need the repo scope to use this resource. + +## Example Usage + +### Legacy Build Type + +{{tffile "examples/resources/repository_pages/example_1.tf"}} + +### Workflow Build Type (GitHub Actions) + +{{tffile "examples/resources/repository_pages/example_2.tf"}} + +### With Custom Domain + +{{tffile "examples/resources/repository_pages/example_3.tf"}} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository name to configure GitHub Pages for. + +- `build_type` - (Optional) The type of GitHub Pages site to build. Can be `legacy` or `workflow`. Defaults to `legacy`. + +- `source` - (Optional) The source branch and directory for the rendered Pages site. Required when `build_type` is `legacy`. See [Source](#source) below for details. + +- `cname` - (Optional) The custom domain for the repository. + +- `public` - (Optional) Whether the GitHub Pages site is public. + +- `https_enforced` - (Optional) Whether HTTPS is enforced for the GitHub Pages site. GitHub Pages sites serve over HTTPS by default; this setting only applies when a custom domain (`cname`) is configured. Requires `cname` to be set. + +### Source + +The `source` block supports the following: + +- `branch` - (Required) The repository branch used to publish the site's source files (e.g., `main` or `gh-pages`). + +- `path` - (Optional) The repository directory from which the site publishes. Defaults to `/`. Can be `/` or `/docs`. + +## Attribute Reference + +In addition to the above arguments, the following attributes are exported: + +- `repository_id` - The ID of the repository. + +- `custom_404` - Whether the rendered GitHub Pages site has a custom 404 page. + +- `html_url` - The absolute URL (with scheme) to the rendered GitHub Pages site. + +- `build_status` - The GitHub Pages site's build status (e.g., `building` or `built`). + +- `api_url` - The API URL of the GitHub Pages resource. + +## Import + +GitHub repository pages can be imported using the `repository-slug`, e.g. + +```sh +terraform import github_repository_pages.example my-repo +``` diff --git a/templates/resources/repository_project.md.tmpl b/templates/resources/repository_project.md.tmpl new file mode 100644 index 0000000000..422203bc29 --- /dev/null +++ b/templates/resources/repository_project.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages projects for GitHub repositories +--- + +# {{.Name}} ({{.Type}}) + +!> **Warning:** This resource no longer works as the [Projects (classic) REST API](https://docs.github.com/en/rest/projects/projects?apiVersion=2022-11-28) has been [removed](https://github.blog/changelog/2024-05-23-sunset-notice-projects-classic/) and as such has been deprecated. It will be removed in a future release. + +This resource allows you to create and manage projects for GitHub repository. + +## Example Usage + +{{ tffile "examples/resources/repository_project/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the project. + +- `repository` - (Required) The repository of the project. + +- `body` - (Optional) The body of the project. + +## Attributes Reference + +The following additional attributes are exported: + +- `url` - URL of the project diff --git a/templates/resources/repository_pull_request.md.tmpl b/templates/resources/repository_pull_request.md.tmpl new file mode 100644 index 0000000000..8e2fae63de --- /dev/null +++ b/templates/resources/repository_pull_request.md.tmpl @@ -0,0 +1,49 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Get information on a single GitHub Pull Request. +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage PullRequests for repositories within your GitHub organization or personal account. + +## Example Usage + +{{ tffile "examples/resources/repository_pull_request/example_1.tf" }} + +## Argument Reference + +- `base_repository` - (Required) Name of the base repository to retrieve the Pull Requests from. + +- `base_ref` - (Required) Name of the branch serving as the base of the Pull Request. + +- `head_ref` - (Required) Name of the branch serving as the head of the Pull Request. + +- `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. + +- `title` - (Optional) The title of the Pull Request. + +- `body` - (Optional) Body of the Pull Request. + +- `maintainer_can_modify` - Controls whether the base repository maintainers can modify the Pull Request. Default: false. + +## Attributes Reference + +- `base_sha` - Head commit SHA of the Pull Request base. + +- `draft` - Indicates Whether this Pull Request is a draft. + +- `head_sha` - Head commit SHA of the Pull Request head. + +- `labels` - List of label names set on the Pull Request. + +- `number` - The number of the Pull Request within the repository. + +- `opened_at` - Unix timestamp indicating the Pull Request creation time. + +- `opened_by` - GitHub login of the user who opened the Pull Request. + +- `state` - the current Pull Request state - can be "open", "closed" or "merged". + +- `updated_at` - The timestamp of the last Pull Request update. diff --git a/templates/resources/repository_ruleset.md.tmpl b/templates/resources/repository_ruleset.md.tmpl new file mode 100644 index 0000000000..d40b5262bb --- /dev/null +++ b/templates/resources/repository_ruleset.md.tmpl @@ -0,0 +1,268 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates a GitHub repository ruleset. +--- + +# {{.Name}} ({{.Type}}) + +Creates a GitHub repository ruleset. + +This resource allows you to create and manage rulesets on the repository level. When applied, a new ruleset will be created. When destroyed, that ruleset will be removed. + +## Example Usage + +{{ tffile "examples/resources/repository_ruleset/example_1.tf" }} + +## Argument Reference + +- `enforcement` - (Required) (String) Possible values for Enforcement are `disabled`, `active`, `evaluate`. Note: `evaluate` is currently only supported for owners of type `organization`. + +- `name` - (Required) (String) The name of the ruleset. + +- `rules` - (Required) (Block List, Min: 1, Max: 1) Rules within the ruleset. (see [below for nested schema](#rules)) + +- `target` - (Required) (String) Possible values are `branch`, `tag` and `push`. + +- `bypass_actors` - (Optional) (Block List) The actors that can bypass the rules in this ruleset. (see [below for nested schema](#bypass_actors)) + +- `conditions` - (Optional) (Block List, Max: 1) Parameters for a repository ruleset condition. For `branch` and `tag` targets, `ref_name` is required. For `push` targets, `ref_name` must NOT be set - conditions are optional for push targets. (see [below for nested schema](#conditions)) + +- `repository` - (Required) (String) Name of the repository to apply ruleset to. + +### Rules + +The `rules` block supports the following: + +~> **Note:** Rules are target-specific. `branch` and `tag` targets support rules like `creation`, `deletion`, `pull_request`, `required_status_checks`, etc. `push` targets only support `file_path_restriction`, `max_file_size`, `max_file_path_length`, and `file_extension_restriction`. Using the wrong rules for a target will result in a validation error. + +- `branch_name_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the branch_name_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. Conflicts with `tag_name_pattern` as it only applied to rulesets with target `branch`. (see [below for nested schema](#rulesbranch_name_pattern)) + +- `commit_author_email_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the commit_author_email_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. (see [below for nested schema](#rulescommit_author_email_pattern)) + +- `commit_message_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the commit_message_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. (see [below for nested schema](#rulescommit_message_pattern)) + +- `committer_email_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the committer_email_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. (see [below for nested schema](#rulescommitter_email_pattern)) + +- `creation` - (Optional) (Boolean) Only allow users with bypass permission to create matching refs. + +- `deletion` - (Optional) (Boolean) Only allow users with bypass permissions to delete matching refs. + +- `non_fast_forward` - (Optional) (Boolean) Prevent users with push access from force pushing to branches. + +- `merge_queue` - (Optional) (Block List, Max: 1) Merges must be performed via a merge queue. (see [below for nested schema](#rulesmerge_queue)) + +- `pull_request` - (Optional) (Block List, Max: 1) Require all commits be made to a non-target branch and submitted via a pull request before they can be merged. (see [below for nested schema](#rulespull_request)) + +- `copilot_code_review` - (Optional) (Block List, Max: 1) Automatically request Copilot code review for new pull requests if the author has access to Copilot code review and their premium requests quota has not reached the limit. (see [below for nested schema](#rulescopilot_code_review)) + +- `required_deployments` - (Optional) (Block List, Max: 1) Choose which environments must be successfully deployed to before branches can be merged into a branch that matches this rule. (see [below for nested schema](#rulesrequired_deployments)) + +- `required_linear_history` - (Optional) (Boolean) Prevent merge commits from being pushed to matching branches. + +- `required_reviewers` - (Optional) (Block List) Require specific reviewers to approve pull requests. Note: This feature is in beta. (see [below for nested schema](#rulespull_requestrequired_reviewers)) + +- `required_signatures` - (Optional) (Boolean) Commits pushed to matching branches must have verified signatures. + +- `required_status_checks` - (Optional) (Block List, Max: 1) Choose which status checks must pass before branches can be merged into a branch that matches this rule. When enabled, commits must first be pushed to another branch, then merged or pushed directly to a branch that matches this rule after status checks have passed. (see [below for nested schema](#rulesrequired_status_checks)) + +- `tag_name_pattern` - (Optional) (Block List, Max: 1) Parameters to be used for the tag_name_pattern rule. This rule only applies to repositories within an enterprise, it cannot be applied to repositories owned by individuals or regular organizations. Conflicts with `branch_name_pattern` as it only applied to rulesets with target `tag`. (see [below for nested schema](#rulestag_name_pattern)) + +- `required_code_scanning` - (Optional) (Block List, Max: 1) Define which tools must provide code scanning results before the reference is updated. When configured, code scanning must be enabled and have results for both the commit and the reference being updated. Multiple code scanning tools can be specified. (see [below for nested schema](#rulesrequired_code_scanning)) + +- `file_path_restriction` - (Optional) (Block List, Max 1) Parameters to be used for the file_path_restriction rule. When enabled restricts access to files within the repository. (See [below for nested schema](#rulesfile_path_restriction)) + +- `max_file_size` - (Optional) (Block List, Max 1) Parameters to be used for the max_file_size rule. When enabled restricts the maximum size of a file that can be pushed to the repository. (See [below for nested schema](#rulesmax_file_size)) + +- `max_file_path_length` - (Optional) (Block List, Max: 1) Prevent commits that include file paths that exceed a specified character limit from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesmax_file_path_length)) + +- `file_extension_restriction` - (Optional) (Block List, Max: 1) Prevent commits that include files with specified file extensions from being pushed to the commit graph. This rule only applies to rulesets with target `push`. (see [below for nested schema](#rulesfile_extension_restriction)) + +- `update` - (Optional) (Boolean) Only allow users with bypass permission to update matching refs. + +- `update_allows_fetch_and_merge` - (Optional) (Boolean) Branch can pull changes from its upstream repository. This is only applicable to forked repositories. Requires `update` to be set to `true`. Note: behaviour is affected by a known bug on the GitHub side which may cause issues when using this parameter. + +#### rules.branch_name_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.commit_author_email_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.commit_message_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.committer_email_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.merge_queue + +- `check_response_timeout_minutes` - (Optional) (Number) Maximum time for a required status check to report a conclusion. After this much time has elapsed, checks that have not reported a conclusion will be assumed to have failed. Defaults to `60`. + +- `grouping_strategy` - (Optional) (String) When set to `ALLGREEN`, the merge commit created by merge queue for each PR in the group must pass all required checks to merge. When set to `HEADGREEN`, only the commit at the head of the merge group, i.e. the commit containing changes from all of the PRs in the group, must pass its required checks to merge. Can be one of: `ALLGREEN`, `HEADGREEN`. Defaults to `ALLGREEN`. + +- `max_entries_to_build` - (Optional) (Number) Limit the number of queued pull requests requesting checks and workflow runs at the same time. Defaults to `5`. + +- `max_entries_to_merge` - (Optional) (Number) Limit the number of queued pull requests that will be merged together in a group. Defaults to `5`. + +- `merge_method` - (Optional) (String) Method to use when merging changes from queued pull requests. Can be one of: `MERGE`, `SQUASH`, `REBASE`. Defaults to `MERGE`. + +- `min_entries_to_merge` - (Optional) (Number) The minimum number of PRs that will be merged together in a group. Defaults to `1`. + +- `min_entries_to_merge_wait_minutes` - (Optional) (Number) The time merge queue should wait after the first PR is added to the queue for the minimum group size to be met. After this time has elapsed, the minimum group size will be ignored and a smaller group will be merged. Defaults to `5`. + +#### rules.pull_request + +- `allowed_merge_methods` - (Optional) (List of String, Min: 1) Array of merge methods to be allowed. Allowed values include `merge`, `squash`, and `rebase`. At least one must be enabled. +- `dismiss_stale_reviews_on_push` - (Optional) (Boolean) New, reviewable commits pushed will dismiss previous pull request review approvals. Defaults to `false`. +- `require_code_owner_review` - (Optional) (Boolean) Require an approving review in pull requests that modify files that have a designated code owner. Defaults to `false`. +- `require_last_push_approval` - (Optional) (Boolean) Whether the most recent reviewable push must be approved by someone other than the person who pushed it. Defaults to `false`. +- `required_approving_review_count` - (Optional) (Number) The number of approving reviews that are required before a pull request can be merged. Defaults to `0`. +- `required_review_thread_resolution` - (Optional) (Boolean) All conversations on code must be resolved before a pull request can be merged. Defaults to `false`. + +#### rules.copilot_code_review + +- `review_on_push` - (Optional) (Boolean) Copilot automatically reviews each new push to the pull request. Defaults to `false`. + +- `review_draft_pull_requests` - (Optional) (Boolean) Copilot automatically reviews draft pull requests before they are marked as ready for review. Defaults to `false`. + +#### rules.pull_request.required_reviewers + +- `reviewer` - (Required) (Block List, Max: 1) The reviewer that must review matching files. (see [below for nested schema](#rulespull_requestrequired_reviewersreviewer)) + +- `file_patterns` - (Required) (List of String) File patterns (fnmatch syntax) that this reviewer must approve. + +- `minimum_approvals` - (Required) (Number) Minimum number of approvals required from this reviewer. Set to 0 to make approval optional. + +#### rules.pull_request.required_reviewers.reviewer + +- `id` - (Required) (Number) The ID of the reviewer (Team ID). + +- `type` - (Required) (String) The type of reviewer. Currently only `Team` is supported. + +#### rules.required_deployments + +- `required_deployment_environments` - (Required) (List of String) The environments that must be successfully deployed to before branches can be merged. + +#### rules.required_status_checks + +- `required_check` - (Required) (Block Set, Min: 1) Status checks that are required. Several can be defined. (see [below for nested schema](#rulesrequired_status_checksrequired_check)) + +- `strict_required_status_checks_policy` - (Optional) (Boolean) Whether pull requests targeting a matching branch must be tested with the latest code. This setting will not take effect unless at least one status check is enabled. Defaults to `false`. + +- `do_not_enforce_on_create` - (Optional) (Boolean) Allow repositories and branches to be created if a check would otherwise prohibit it. Defaults to `false`. + +#### rules.required_status_checks.required_check + +- `context` - (Required) (String) The status check context name that must be present on the commit. + +- `integration_id` - (Optional) (Number) The optional integration ID that this status check must originate from. It's a GitHub App ID, which can be obtained by following instructions from the [Get an App API docs](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-app). + +#### rules.tag_name_pattern + +- `operator` - (Required) (String) The operator to use for matching. Can be one of: `starts_with`, `ends_with`, `contains`, `regex`. + +- `pattern` - (Required) (String) The pattern to match with. + +- `name` - (Optional) (String) How this rule will appear to users. + +- `negate` - (Optional) (Boolean) If true, the rule will fail if the pattern matches. + +#### rules.required_code_scanning + +- `required_code_scanning_tool` - (Required) (Block Set, Min: 1) Actions code scanning tools that are required. Multiple can be defined. (see [below for nested schema](#rulesrequired_code_scanningrequired_code_scanning_tool)) + +#### rules.required_code_scanning.required_code_scanning_tool + +- `alerts_threshold` - (Required) (String) The severity level at which code scanning results that raise alerts block a reference update. Can be one of: `none`, `errors`, `errors_and_warnings`, `all`. + +- `security_alerts_threshold` - (Required) (String) The severity level at which code scanning results that raise security alerts block a reference update. Can be one of: `none`, `critical`, `high_or_higher`, `medium_or_higher`, `all`. + +- `tool` - (Required) (String) The name of a code scanning tool. + +#### rules.file_path_restriction + +- `restricted_file_paths` - (Required) (Block Set, Min: 1) The file paths that are restricted from being pushed to the commit graph. + +#### rules.max_file_size + +- `max_file_size` - (Required) (Integer) The maximum allowed size, in megabytes (MB), of a file. Valid range is 1-100 MB. + +#### rules.max_file_path_length + +- `max_file_path_length` - (Required) (Integer) The maximum number of characters allowed in file paths. + +#### rules.file_extension_restriction + +- `restricted_file_extensions` - (Required) (Block Set, Min: 1) The file extensions that are restricted from being pushed to the commit graph. + +#### bypass_actors + +- `actor_id` - (Optional) (Number) The ID of the actor that can bypass a ruleset. If `actor_type` is `Integration`, `actor_id` is a GitHub App ID. App ID can be obtained by following instructions from the [Get an App API docs](https://docs.github.com/en/rest/apps/apps?apiVersion=2022-11-28#get-an-app). Some actor types such as `DeployKey` do not have an ID. + +- `actor_type` (String) The type of actor that can bypass a ruleset. Can be one of: `RepositoryRole`, `Team`, `Integration`, `OrganizationAdmin`, `DeployKey`. + +- `bypass_mode` - (Optional) (String) When the specified actor can bypass the ruleset. pull_request means that an actor can only bypass rules on pull requests. Can be one of: `always`, `pull_request`, `exempt`. + +~> Note: at the time of writing this, the following actor types correspond to the following actor IDs: + +- `OrganizationAdmin` -> `1` +- `RepositoryRole` (This is the actor type, the following are the base repository roles and their associated IDs.) + - `maintain` -> `2` + - `write` -> `4` + - `admin` -> `5` + +#### conditions + +- `ref_name` - (Optional) (Block List, Max: 1) Required for `branch` and `tag` targets. Must NOT be set for `push` targets. (see [below for nested schema](#conditionsref_name)) + +~> **Note:** For `push` targets, do not include `ref_name` in conditions. Push rulesets operate on file content, not on refs. The `conditions` block is optional for push targets. + +#### conditions.ref_name + +- `exclude` - (Required) (List of String) Array of ref names or patterns to exclude. The condition will not pass if any of these patterns match. + +- `include` - (Required) (List of String) Array of ref names or patterns to include. One of these patterns must match for the condition to pass. Also accepts `~DEFAULT_BRANCH` to include the default branch or `~ALL` to include all branches. + +## Attributes Reference + +The following additional attributes are exported: + +- `etag` (String) + +- `node_id` (String) GraphQL global node id for use with v4 API. + +- `ruleset_id` (Number) GitHub ID for the ruleset. + +## Import + +GitHub Repository Rulesets can be imported using the GitHub repository name and ruleset ID e.g. + +`$ terraform import github_repository_ruleset.example example:12345` diff --git a/templates/resources/repository_topics.md.tmpl b/templates/resources/repository_topics.md.tmpl new file mode 100644 index 0000000000..0e8a8f6650 --- /dev/null +++ b/templates/resources/repository_topics.md.tmpl @@ -0,0 +1,31 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages the topics on a repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage topics for repositories within your GitHub organization or personal account. + +~> Note: This resource is not compatible with the `topic` attribute of the `github_repository` Use either `github_repository_topics` or `topic` in `github_repository`. `github_repository_topics` is only meant to be used if the repository itself is not handled via terraform, for example if it's only read as a datasource (see [issue #1845](https://github.com/integrations/terraform-provider-github/issues/1845)). + +## Example Usage + +{{ tffile "examples/resources/repository_topics/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository name. + +- `topics` - (Required) A list of topics to add to the repository. + +## Import + +Repository topics can be imported using the `name` of the repository. + +```hcl +$ terraform import github_repository_topics.terraform terraform +``` diff --git a/templates/resources/repository_vulnerability_alerts.md.tmpl b/templates/resources/repository_vulnerability_alerts.md.tmpl new file mode 100644 index 0000000000..3195d8f09b --- /dev/null +++ b/templates/resources/repository_vulnerability_alerts.md.tmpl @@ -0,0 +1,35 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages vulnerability alerts for a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage vulnerability alerts for a GitHub repository. See the [documentation](https://docs.github.com/en/code-security/dependabot/dependabot-alerts/about-dependabot-alerts) for details of usage and how this will impact your repository. + +## Example Usage + +{{tffile "examples/resources/repository_vulnerability_alerts/example_1.tf"}} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The name of the repository to configure vulnerability alerts for. + +- `enabled` - (Optional) Whether vulnerability alerts are enabled for the repository. Defaults to `true`. + +## Attribute Reference + +In addition to the above arguments, the following attributes are exported: + +- `repository_id` - The ID of the repository. + +## Import + +Repository vulnerability alerts can be imported using the `repository_name`: + +```sh +terraform import github_repository_vulnerability_alerts.example my-repo +``` diff --git a/templates/resources/repository_webhook.md.tmpl b/templates/resources/repository_webhook.md.tmpl new file mode 100644 index 0000000000..0e1ecb5fc5 --- /dev/null +++ b/templates/resources/repository_webhook.md.tmpl @@ -0,0 +1,55 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages repository webhooks within GitHub organizations or personal accounts +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage webhooks for repositories within your GitHub organization or personal account. + +~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing webhook modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. + +## Example Usage + +{{ tffile "examples/resources/repository_webhook/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The repository of the webhook. + +- `events` - (Required) A list of events which should trigger the webhook. See a list of [available events](https://developer.github.com/v3/activity/events/types/). + +- `configuration` - (Required) Configuration block for the webhook. [Detailed below.](#configuration) + +- `active` - (Optional) Indicate if the webhook should receive events. Defaults to `true`. + +### configuration + +- `url` - (Required) The URL of the webhook. + +- `content_type` - (Required) The content type for the payload. Valid values are either `form` or `json`. + +- `secret` - (Optional) The shared secret for the webhook. [See API documentation](https://developer.github.com/v3/repos/hooks/#create-a-hook). + +- `insecure_ssl` - (Optional) Insecure SSL boolean toggle. Defaults to `false`. + +## Attributes Reference + +The following additional attributes are exported: + +- `url` - URL of the webhook. This is a sensitive attribute because it may include basic auth credentials. + +## Import + +Repository webhooks can be imported using the `name` of the repository, combined with the `id` of the webhook, separated by a `/` character. The `id` of the webhook can be found in the URL of the webhook. For example: `"https://github.com/foo-org/foo-repo/settings/hooks/14711452"`. + +Importing uses the name of the repository, as well as the ID of the webhook, e.g. + +```hcl +$ terraform import github_repository_webhook.terraform terraform/11235813 +``` + +If secret is populated in the webhook's configuration, the value will be imported as "********". diff --git a/templates/resources/team.md.tmpl b/templates/resources/team.md.tmpl new file mode 100644 index 0000000000..c0305b43c8 --- /dev/null +++ b/templates/resources/team.md.tmpl @@ -0,0 +1,44 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub team resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub team resource. + +This resource allows you to add/remove teams from your organization. When applied, a new team will be created. When destroyed, that team will be removed. + +## Example Usage + +{{ tffile "examples/resources/team/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `name` - (Required) The name of the team. +- `description` - (Optional) A description of the team. +- `privacy` - (Optional) The level of privacy for the team. Must be one of `secret` *(default)- or `closed`. +- `notification_setting` - (Optional) The notification setting for the team. Must be one of `notifications_enabled` *(default)- or `notifications_disabled`. +- `parent_team_id` - (Optional) The ID or slug of the parent team, if this is a nested team. +- `ldap_dn` - (Optional) The LDAP Distinguished Name of the group where membership will be synchronized. Only available in GitHub Enterprise Server. +- `create_default_maintainer` - (**DEPRECATED**) (Optional) Adds a default maintainer to the team. Defaults to `false` and adds the creating user to the team when `true`. + +## Attributes Reference + +The following attributes are exported: + +- `id` - The ID of the created team. +- `node_id` - The Node ID of the created team. +- `slug` - The slug of the created team, which may or may not differ from `name`, depending on whether `name` contains "URL-unsafe" characters. + +## Import + +GitHub Teams can be imported using the GitHub team ID or name e.g. + +```shell +terraform import github_team.core 1234567 +terraform import github_team.core Administrators +``` diff --git a/templates/resources/team_members.md.tmpl b/templates/resources/team_members.md.tmpl new file mode 100644 index 0000000000..f87f4bb093 --- /dev/null +++ b/templates/resources/team_members.md.tmpl @@ -0,0 +1,53 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides an authoritative GitHub team members resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub team members resource. + +This resource allows you to manage members of teams in your organization. It sets the requested team members for the team and removes all users not managed by Terraform. + +When applied, if the user hasn't accepted their invitation to the organization, they won't be part of the team until they do. + +When destroyed, all users will be removed from the team. + +~> **Note** This resource is not compatible with `github_team_membership`. Use either `github_team_members` or `github_team_membership`. + +~> **Note** You can accidentally lock yourself out of your team using this resource. Deleting a `github_team_members` resource removes access from anyone without organization-level access to the team. Proceed with caution. It should generally only be used with teams fully managed by Terraform. + +~> **Note** Attempting to set a user who is an organization owner to "member" will result in the user being granted "maintainer" instead; this can result in a perpetual `terraform plan` diff that changes their status back to "member". + +## Example Usage + +{{ tffile "examples/resources/team_members/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `team_id` - (Required) The team id or the team slug + +~> **Note** Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will cause the team members associations to the team to be destroyed and recreated if the team name is updated. + +- `members` - (Required) List of team members. See [Members](#members) below for details. + +### Members + +`members` supports the following arguments: + +- `username` - (Required) The user to add to the team. +- `role` - (Optional) The role of the user within the team. Must be one of `member` or `maintainer`. Defaults to `member`. + +## Import + +~> **Note** Although the team id or team slug can be used it is recommended to use the team id. Using the team slug will result in terraform doing conversions between the team slug and team id. This will cause team members associations to the team to be destroyed and recreated on import. + +GitHub Team Membership can be imported using the team ID team id or team slug, e.g. + +```hcl +$ terraform import github_team_members.some_team 1234567 +$ terraform import github_team_members.some_team Administrators +``` diff --git a/templates/resources/team_membership.md.tmpl b/templates/resources/team_membership.md.tmpl new file mode 100644 index 0000000000..4e0dc9fd96 --- /dev/null +++ b/templates/resources/team_membership.md.tmpl @@ -0,0 +1,36 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub team membership resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub team membership resource. + +This resource allows you to add/remove users from teams in your organization. When applied, the user will be added to the team. If the user hasn't accepted their invitation to the organization, they won't be part of the team until they do. When destroyed, the user will be removed from the team. + +~> **Note** This resource is not compatible with `github_team_members`. Use either `github_team_members` or `github_team_membership`. + +~> **Note** Organization owners may not be set as "members" of a team; they may only be set as "maintainers". Attempting to set an organization owner as a "member" of a team may result in a `terraform plan` diff that changes their status back to "maintainer". + +## Example Usage + +{{ tffile "examples/resources/team_membership/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `team_id` - (Required) The GitHub team id or the GitHub team slug +- `username` - (Required) The user to add to the team. +- `role` - (Optional) The role of the user within the team. Must be one of `member` or `maintainer`. Defaults to `member`. + +## Import + +GitHub Team Membership can be imported using an ID made up of `teamid:username` or `teamname:username`, e.g. + +```hcl +$ terraform import github_team_membership.member 1234567:someuser +$ terraform import github_team_membership.member Administrators:someuser +``` diff --git a/templates/resources/team_repository.md.tmpl b/templates/resources/team_repository.md.tmpl new file mode 100644 index 0000000000..333f5d6ca0 --- /dev/null +++ b/templates/resources/team_repository.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages the associations between teams and repositories. +--- + +# {{.Name}} ({{.Type}}) + +~> Note: github_team_repository cannot be used in conjunction with github_repository_collaborators or they will fight over what your policy should be. + +This resource manages relationships between teams and repositories in your GitHub organization. + +Creating this resource grants a particular team permissions on a particular repository. + +The repository and the team must both belong to the same organization on GitHub. This resource does not actually *create* any repositories. + +~> **Note on Archived Repositories**: When a repository is archived, GitHub makes it read-only, preventing team permission modifications. If you attempt to destroy resources associated with archived repositories, the provider will gracefully handle the operation by logging an informational message and removing the resource from Terraform state without attempting to modify the archived repository. + +This resource is non-authoritative, for managing ALL collaborators of a repo, use github_repository_collaborators instead. + +## Example Usage + +{{ tffile "examples/resources/team_repository/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `team_id` - (Required) The GitHub team id or the GitHub team slug +- `repository` - (Required) The repository to add to the team. +- `permission` - (Optional) The permissions of team members regarding the repository. Must be one of `pull`, `triage`, `push`, `maintain`, `admin` or the name of an existing [custom repository role](https://docs.github.com/en/enterprise-cloud@latest/organizations/managing-peoples-access-to-your-organization-with-roles/managing-custom-repository-roles-for-an-organization) within the organisation. Defaults to `pull`. + +## Import + +GitHub Team Repository can be imported using an ID made up of `team_id:repository` or `team_name:repository`, e.g. + +```hcl +$ terraform import github_team_repository.terraform_repo 1234567:terraform +$ terraform import github_team_repository.terraform_repo Administrators:terraform +``` diff --git a/templates/resources/team_settings.md.tmpl b/templates/resources/team_settings.md.tmpl new file mode 100644 index 0000000000..8fe1e85e82 --- /dev/null +++ b/templates/resources/team_settings.md.tmpl @@ -0,0 +1,62 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Manages the team settings (in particular the request review delegation settings) +--- + +# {{.Name}} ({{.Type}}) + +This resource manages the team settings (in particular the request review delegation settings) within the organization + +Creating this resource will alter the team Code Review settings. + +The team must both belong to the same organization configured in the provider on GitHub. + +~> **Note**: This resource relies on the v4 GraphQl GitHub API. If this API is not available, or the Stone Crop schema preview is not available, then this resource will not work as intended. + +## Example Usage + +### Notify without delegation + +{{tffile "examples/resources/team_settings/example_1.tf"}} + +### Notify with delegation + +{{tffile "examples/resources/team_settings/example_2.tf"}} + +## Argument Reference + +The following arguments are supported: + +- `team_id` - (Required) The GitHub team id or the GitHub team slug +- `notify` - (Optional) Whether to notify the entire team when at least one member is also assigned to the pull request. Can be set independently of `review_request_delegation`. Default value is `false`. +- `review_request_delegation` - (Optional) The settings for delegating code reviews to individuals on behalf of the team. If this block is present, even without any fields, then review request delegation will be enabled for the team. See [GitHub Review Request Delegation](#github-review-request-delegation-configuration) below for details. See [GitHub's documentation](https://docs.github.com/en/organizations/organizing-members-into-teams/managing-code-review-settings-for-your-team#configuring-team-notifications) for more configuration details. + +### GitHub Review Request Delegation Configuration + +The following arguments are supported: + +- `algorithm` - (Optional) The algorithm to use when assigning pull requests to team members. Supported values are `ROUND_ROBIN` and `LOAD_BALANCE`. Default value is `ROUND_ROBIN` +- `member_count` - (Optional) The number of team members to assign to a pull request. Default value is `1`. +- `notify` - (Optional, **Deprecated**: Use the top-level `notify` attribute instead.) Whether to notify the entire team when at least one member is also assigned to the pull request. Conflicts with the top-level `notify` attribute. + +## Attributes Reference + +The following additional attributes are exported: + +- `team_slug` - The slug of the Team. +- `team_uid` - The unique node ID of the Team on GitHub. Corresponds to the ID of the `github_team_settings` resource. + +## Import + +GitHub Teams can be imported using the GitHub team ID, or the team slug e.g. + +```hcl +terraform import github_team_settings.code_review_settings 1234567 +``` + +or, + +```hcl +terraform import github_team_settings.code_review_settings SomeTeam +``` diff --git a/templates/resources/team_sync_group_mapping.md.tmpl b/templates/resources/team_sync_group_mapping.md.tmpl new file mode 100644 index 0000000000..f31dbf1c74 --- /dev/null +++ b/templates/resources/team_sync_group_mapping.md.tmpl @@ -0,0 +1,40 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Creates and manages the connections between a team and its IdP group(s). +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to create and manage Identity Provider (IdP) group connections within your GitHub teams. You must have team synchronization enabled for organizations owned by enterprise accounts. + +To learn more about team synchronization between IdPs and GitHub, please refer to: + +## Example Usage + +{{ tffile "examples/resources/team_sync_group_mapping/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `team_slug` - (Required) Slug of the team +- `group` - (Required) An Array of GitHub Identity Provider Groups (or empty []). Each `group` block consists of the fields documented below. + +--- + +The `group` block consists of: + +- `group_id` - The ID of the IdP group. + +- `group_name` - The name of the IdP group. + +- `group_description` - The description of the IdP group. + +## Import + +GitHub Team Sync Group Mappings can be imported using the GitHub team `slug` e.g. + +```hcl +$ terraform import github_team_sync_group_mapping.example some_team +``` diff --git a/templates/resources/user_gpg_key.md.tmpl b/templates/resources/user_gpg_key.md.tmpl new file mode 100644 index 0000000000..07829cde6b --- /dev/null +++ b/templates/resources/user_gpg_key.md.tmpl @@ -0,0 +1,32 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub user's GPG key resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub user's GPG key resource. + +This resource allows you to add/remove GPG keys from your user account. + +## Example Usage + +{{ tffile "examples/resources/user_gpg_key/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `armored_public_key` - (Required) Your public GPG key, generated in ASCII-armored format. See [Generating a new GPG key](https://help.github.com/articles/generating-a-new-gpg-key/) for help on creating a GPG key. + +## Attributes Reference + +The following attributes are exported: + +- `id` - The GitHub ID of the GPG key, e.g. `401586` +- `key_id` - The key ID of the GPG key, e.g. `3262EFF25BA0D270` + +## Import + +GPG keys are not importable due to the fact that [API](https://developer.github.com/v3/users/gpg_keys/#gpg-keys) does not return previously uploaded GPG key. diff --git a/templates/resources/user_invitation_accepter.md.tmpl b/templates/resources/user_invitation_accepter.md.tmpl new file mode 100644 index 0000000000..1f21d70ca1 --- /dev/null +++ b/templates/resources/user_invitation_accepter.md.tmpl @@ -0,0 +1,30 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a resource to manage GitHub repository collaborator invitations. +--- + +# {{.Name}} ({{.Type}}) + +Provides a resource to manage GitHub repository collaborator invitations. + +## Example Usage + +{{ tffile "examples/resources/user_invitation_accepter/example_1.tf" }} + +## Allowing empty invitation IDs + +Set `allow_empty_id` when using `for_each` over a list of `github_repository_collaborator.invitation_id`'s. + +This allows applying a module again when a new `github_repository_collaborator` resource is added to the `for_each` loop. This is needed as the `github_repository_collaborator.invitation_id` will be empty after a state refresh when the invitation has been accepted. + +Note that when an invitation is accepted manually or by another tool between a state refresh and a `terraform apply` using that refreshed state, the plan will contain the invitation ID, but the apply will receive an HTTP 404 from the API since the invitation has already been accepted. + +This is tracked in [#1157](https://github.com/integrations/terraform-provider-github/issues/1157). + +## Argument Reference + +The following arguments are supported: + +- `invitation_id` - (Optional) ID of the invitation to accept. Must be set when `allow_empty_id` is `false`. +- `allow_empty_id` - (Optional) Allow the ID to be unset. This will result in the resource being skipped when the ID is not set instead of returning an error. diff --git a/templates/resources/user_ssh_key.md.tmpl b/templates/resources/user_ssh_key.md.tmpl new file mode 100644 index 0000000000..7a073a4051 --- /dev/null +++ b/templates/resources/user_ssh_key.md.tmpl @@ -0,0 +1,37 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Provides a GitHub user's SSH key resource. +--- + +# {{.Name}} ({{.Type}}) + +Provides a GitHub user's SSH key resource. + +This resource allows you to add/remove SSH keys from your user account. + +## Example Usage + +{{ tffile "examples/resources/user_ssh_key/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `title` - (Required) A descriptive name for the new key. e.g. `Personal MacBook Air` +- `key` - (Required) The public SSH key to add to your GitHub account. + +## Attributes Reference + +The following attributes are exported: + +- `id` - The ID of the SSH key +- `url` - The URL of the SSH key + +## Import + +SSH keys can be imported using their ID e.g. + +```hcl +$ terraform import github_user_ssh_key.example 1234567 +``` diff --git a/templates/resources/workflow_repository_permissions.md.tmpl b/templates/resources/workflow_repository_permissions.md.tmpl new file mode 100644 index 0000000000..d1e06c53f4 --- /dev/null +++ b/templates/resources/workflow_repository_permissions.md.tmpl @@ -0,0 +1,29 @@ +--- +page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}" +description: |- + Enables and manages Workflow permissions for a GitHub repository +--- + +# {{.Name}} ({{.Type}}) + +This resource allows you to manage GitHub Workflow permissions for a given repository. You must have admin access to a repository to use this resource. + +## Example Usage + +{{ tffile "examples/resources/workflow_repository_permissions/example_1.tf" }} + +## Argument Reference + +The following arguments are supported: + +- `repository` - (Required) The GitHub repository +- `default_workflow_permissions` - (Optional) The default workflow permissions granted to the GITHUB_TOKEN when running workflows. Can be one of: `read` or `write`. +- `can_approve_pull_request_reviews` - (Optional) Whether GitHub Actions can approve pull requests. Enabling this can be a security risk. + +## Import + +This resource can be imported using the name of the GitHub repository: + +```hcl +$ terraform import github_workflow_repository_permissions.test my-repository +``` diff --git a/tools/go.mod b/tools/go.mod new file mode 100644 index 0000000000..fade1440c2 --- /dev/null +++ b/tools/go.mod @@ -0,0 +1,53 @@ +module tools + +go 1.26 + +require github.com/hashicorp/terraform-plugin-docs v0.25.0 + +require ( + github.com/BurntSushi/toml v1.2.1 // indirect + github.com/Kunde21/markdownfmt/v3 v3.1.0 // indirect + github.com/Masterminds/goutils v1.1.1 // indirect + github.com/Masterminds/semver/v3 v3.2.0 // indirect + github.com/Masterminds/sprig/v3 v3.2.3 // indirect + github.com/ProtonMail/go-crypto v1.4.1 // indirect + github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect + github.com/armon/go-radix v1.0.0 // indirect + github.com/bgentry/speakeasy v0.1.0 // indirect + github.com/bmatcuk/doublestar/v4 v4.10.0 // indirect + github.com/cloudflare/circl v1.6.3 // indirect + github.com/fatih/color v1.16.0 // indirect + github.com/google/uuid v1.3.0 // indirect + github.com/hashicorp/cli v1.1.7 // indirect + github.com/hashicorp/errwrap v1.1.0 // indirect + github.com/hashicorp/go-checkpoint v0.5.0 // indirect + github.com/hashicorp/go-cleanhttp v0.5.2 // indirect + github.com/hashicorp/go-multierror v1.1.1 // indirect + github.com/hashicorp/go-retryablehttp v0.7.8 // indirect + github.com/hashicorp/go-uuid v1.0.3 // indirect + github.com/hashicorp/go-version v1.9.0 // indirect + github.com/hashicorp/hc-install v0.9.4 // indirect + github.com/hashicorp/terraform-exec v0.25.0 // indirect + github.com/hashicorp/terraform-json v0.27.3-0.20260213134036-298b8f6b673a // indirect + github.com/huandu/xstrings v1.3.3 // indirect + github.com/imdario/mergo v0.3.15 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mitchellh/copystructure v1.2.0 // indirect + github.com/mitchellh/reflectwalk v1.0.2 // indirect + github.com/posener/complete v1.2.3 // indirect + github.com/shopspring/decimal v1.3.1 // indirect + github.com/spf13/cast v1.5.0 // indirect + github.com/yuin/goldmark v1.7.7 // indirect + github.com/yuin/goldmark-meta v1.1.0 // indirect + github.com/zclconf/go-cty v1.18.1 // indirect + go.abhg.dev/goldmark/frontmatter v0.2.0 // indirect + golang.org/x/crypto v0.45.0 // indirect + golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df // indirect + golang.org/x/mod v0.35.0 // indirect + golang.org/x/sys v0.42.0 // indirect + golang.org/x/text v0.36.0 // indirect + gopkg.in/yaml.v2 v2.3.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/tools/go.sum b/tools/go.sum new file mode 100644 index 0000000000..ab05df24fd --- /dev/null +++ b/tools/go.sum @@ -0,0 +1,191 @@ +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak= +github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= +github.com/Kunde21/markdownfmt/v3 v3.1.0 h1:KiZu9LKs+wFFBQKhrZJrFZwtLnCCWJahL+S+E/3VnM0= +github.com/Kunde21/markdownfmt/v3 v3.1.0/go.mod h1:tPXN1RTyOzJwhfHoon9wUr4HGYmWgVxSQN6VBJDkrVc= +github.com/Masterminds/goutils v1.1.1 h1:5nUrii3FMTL5diU80unEVvNevw1nH4+ZV4DSLVJLSYI= +github.com/Masterminds/goutils v1.1.1/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU= +github.com/Masterminds/semver/v3 v3.2.0 h1:3MEsd0SM6jqZojhjLWWeBY+Kcjy9i6MQAeY7YgDP83g= +github.com/Masterminds/semver/v3 v3.2.0/go.mod h1:qvl/7zhW3nngYb5+80sSMF+FG2BjYrf8m9wsX0PNOMQ= +github.com/Masterminds/sprig/v3 v3.2.3 h1:eL2fZNezLomi0uOLqjQoN6BfsDD+fyLtgbJMAj9n6YA= +github.com/Masterminds/sprig/v3 v3.2.3/go.mod h1:rXcFaZ2zZbLRJv/xSysmlgIM1u11eBaRMhvYXJNkGuM= +github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= +github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= +github.com/ProtonMail/go-crypto v1.4.1 h1:9RfcZHqEQUvP8RzecWEUafnZVtEvrBVL9BiF67IQOfM= +github.com/ProtonMail/go-crypto v1.4.1/go.mod h1:e1OaTyu5SYVrO9gKOEhTc+5UcXtTUa+P3uLudwcgPqo= +github.com/apparentlymart/go-textseg/v15 v15.0.0 h1:uYvfpb3DyLSCGWnctWKGj857c6ew1u1fNQOlOtuGxQY= +github.com/apparentlymart/go-textseg/v15 v15.0.0/go.mod h1:K8XmNZdhEBkdlyDdvbmmsvpAG721bKi0joRfFdHIWJ4= +github.com/armon/go-radix v1.0.0 h1:F4z6KzEeeQIMeLFa97iZU6vupzoecKdU5TX24SNppXI= +github.com/armon/go-radix v1.0.0/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY= +github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= +github.com/bmatcuk/doublestar/v4 v4.10.0 h1:zU9WiOla1YA122oLM6i4EXvGW62DvKZVxIe6TYWexEs= +github.com/bmatcuk/doublestar/v4 v4.10.0/go.mod h1:xBQ8jztBU6kakFMg+8WGxn0c6z1fTSPVIjEY1Wr7jzc= +github.com/cloudflare/circl v1.6.3 h1:9GPOhQGF9MCYUeXyMYlqTR6a5gTrgR/fBLXvUgtVcg8= +github.com/cloudflare/circl v1.6.3/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4= +github.com/cyphar/filepath-securejoin v0.4.1 h1:JyxxyPEaktOD+GAnqIqTf9A8tHyAG22rowi7HkoSU1s= +github.com/cyphar/filepath-securejoin v0.4.1/go.mod h1:Sdj7gXlvMcPZsbhwhQ33GguGLDGQL7h7bg04C/+u9jI= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= +github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE= +github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.8.0 h1:I8hjc3LbBlXTtVuFNJuwYuMiHvQJDq1AT6u4DwDzZG0= +github.com/go-git/go-billy/v5 v5.8.0/go.mod h1:RpvI/rw4Vr5QA+Z60c6d6LXH0rYJo0uD5SqfmrrheCY= +github.com/go-git/go-git/v5 v5.18.0 h1:O831KI+0PR51hM2kep6T8k+w0/LIAD490gvqMCvL5hM= +github.com/go-git/go-git/v5 v5.18.0/go.mod h1:pW/VmeqkanRFqR6AljLcs7EA7FbZaN5MQqO7oZADXpo= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 h1:f+oWsMOmNPc8JmEHVZIycC7hBoQxHH9pNKQORJNozsQ= +github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8/go.mod h1:wcDNUvekVysuuOpQKo3191zZyTpiI6se1N1ULghS0sw= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/hashicorp/cli v1.1.7 h1:/fZJ+hNdwfTSfsxMBa9WWMlfjUZbX8/LnUxgAd7lCVU= +github.com/hashicorp/cli v1.1.7/go.mod h1:e6Mfpga9OCT1vqzFuoGZiiF/KaG9CbUfO5s3ghU3YgU= +github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= +github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= +github.com/hashicorp/go-checkpoint v0.5.0 h1:MFYpPZCnQqQTE18jFwSII6eUQrD/oxMFp3mlgcqk5mU= +github.com/hashicorp/go-checkpoint v0.5.0/go.mod h1:7nfLNL10NsxqO4iWuW6tWW0HjZuDrwkBuEQsVcpCOgg= +github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= +github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= +github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= +github.com/hashicorp/go-hclog v1.6.3 h1:Qr2kF+eVWjTiYmU7Y31tYlP1h0q/X3Nl3tPGdaB11/k= +github.com/hashicorp/go-hclog v1.6.3/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= +github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo= +github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= +github.com/hashicorp/go-retryablehttp v0.7.8 h1:ylXZWnqa7Lhqpk0L1P1LzDtGcCR0rPVUrx/c8Unxc48= +github.com/hashicorp/go-retryablehttp v0.7.8/go.mod h1:rjiScheydd+CxvumBsIrFKlx3iS0jrZ7LvzFGFmuKbw= +github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.3 h1:2gKiV6YVmrJ1i2CKKa9obLvRieoRGviZFL26PcT/Co8= +github.com/hashicorp/go-uuid v1.0.3/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-version v1.9.0 h1:CeOIz6k+LoN3qX9Z0tyQrPtiB1DFYRPfCIBtaXPSCnA= +github.com/hashicorp/go-version v1.9.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= +github.com/hashicorp/hc-install v0.9.4 h1:KKWOpUG0EqIV63Qk2GGFrZ0s275NVs5lKf9N5vjBNoc= +github.com/hashicorp/hc-install v0.9.4/go.mod h1:4LRYeEN2bMIFfIv57ldMWt9awfuZhvpbRt0vWmv51WU= +github.com/hashicorp/terraform-exec v0.25.0 h1:Bkt6m3VkJqYh+laFMrWIpy9KHYFITpOyzRMNI35rNaY= +github.com/hashicorp/terraform-exec v0.25.0/go.mod h1:dl9IwsCfklDU6I4wq9/StFDp7dNbH/h5AnfS1RmiUl8= +github.com/hashicorp/terraform-json v0.27.3-0.20260213134036-298b8f6b673a h1:T7AMR21kjrbeEpN+KhGlyd31XXHsSZF5zg+ivfeYte4= +github.com/hashicorp/terraform-json v0.27.3-0.20260213134036-298b8f6b673a/go.mod h1:yjb5C2W07l8lmAzdyVgOLji0/D2IoHkR3rusBzUO4O0= +github.com/hashicorp/terraform-plugin-docs v0.25.0 h1:qHs1V257NxVe8tv6HS4UQfNqjaPP5eUlLeDf7jYk85U= +github.com/hashicorp/terraform-plugin-docs v0.25.0/go.mod h1:MQggCmY8zgP7R7E/cC0b0cmTvA9hSj3ZKyrrsDjRbLo= +github.com/huandu/xstrings v1.3.3 h1:/Gcsuc1x8JVbJ9/rlye4xZnVAbEkGauT8lbebqcQws4= +github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= +github.com/imdario/mergo v0.3.15 h1:M8XP7IuFNsqUx6VPK2P9OSmsYsI/YFaGil0uD21V3dM= +github.com/imdario/mergo v0.3.15/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE= +github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= +github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= +github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= +github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mitchellh/copystructure v1.0.0/go.mod h1:SNtv71yrdKgLRyLFxmLdkAbkKEFWgYaq1OVrnRcwhnw= +github.com/mitchellh/copystructure v1.2.0 h1:vpKXTN4ewci03Vljg/q9QvCGUDttBOGBIa15WveJJGw= +github.com/mitchellh/copystructure v1.2.0/go.mod h1:qLl+cE2AmVv+CoeAwDPye/v+N2HKCj9FbZEVFJRxO9s= +github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/mitchellh/reflectwalk v1.0.2 h1:G2LzWKi524PWgd3mLHV8Y5k7s6XUvT0Gef6zxSIeXaQ= +github.com/mitchellh/reflectwalk v1.0.2/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= +github.com/pjbgf/sha1cd v0.3.2 h1:a9wb0bp1oC2TGwStyn0Umc/IGKQnEgF0vVaZ8QF8eo4= +github.com/pjbgf/sha1cd v0.3.2/go.mod h1:zQWigSxVmsHEZow5qaLtPYxpcKMMQpa09ixqBxuCS6A= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/posener/complete v1.2.3 h1:NP0eAhjcjImqslEwo/1hq7gpajME0fTLTezBKDqfXqo= +github.com/posener/complete v1.2.3/go.mod h1:WZIdtGGp+qx0sLrYKtIRAruyNpv6hFCicSgv7Sy7s/s= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/shopspring/decimal v1.2.0/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= +github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= +github.com/skeema/knownhosts v1.3.1 h1:X2osQ+RAjK76shCbvhHHHVl3ZlgDm8apHEHFqRjnBY8= +github.com/skeema/knownhosts v1.3.1/go.mod h1:r7KTdC8l4uxWRyK2TpQZ/1o5HaSzh06ePQNxPwTcfiY= +github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w= +github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +github.com/yuin/goldmark v1.7.7 h1:5m9rrB1sW3JUMToKFQfb+FGt1U7r57IHu5GrYrG2nqU= +github.com/yuin/goldmark v1.7.7/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= +github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= +github.com/zclconf/go-cty v1.18.1 h1:yEGE8M4iIZlyKQURZNb2SnEyZlZHUcBCnx6KF81KuwM= +github.com/zclconf/go-cty v1.18.1/go.mod h1:qpnV6EDNgC1sns/AleL1fvatHw72j+S+nS+MJ+T2CSg= +go.abhg.dev/goldmark/frontmatter v0.2.0 h1:P8kPG0YkL12+aYk2yU3xHv4tcXzeVnN+gU0tJ5JnxRw= +go.abhg.dev/goldmark/frontmatter v0.2.0/go.mod h1:XqrEkZuM57djk7zrlRUB02x8I5J0px76YjkOzhB4YlU= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= +golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df h1:UA2aFVmmsIlefxMk29Dp2juaUSth8Pyn3Tq5Y5mJGME= +golang.org/x/exp v0.0.0-20230626212559-97b1e661b5df/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.35.0 h1:Ww1D637e6Pg+Zb2KrWfHQUnH2dQRLBQyAtpr/haaJeM= +golang.org/x/mod v0.35.0/go.mod h1:+GwiRhIInF8wPm+4AoT6L0FA1QWAad3OMdTRx4tFYlU= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= +golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.43.0 h1:12BdW9CeB3Z+J/I/wj34VMl8X+fEXBxVR90JeMX5E7s= +golang.org/x/tools v0.43.0/go.mod h1:uHkMso649BX2cZK6+RpuIPXS3ho2hZo4FVwfoy1vIk0= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/tools/tools.go b/tools/tools.go new file mode 100644 index 0000000000..9ea387d8d2 --- /dev/null +++ b/tools/tools.go @@ -0,0 +1,13 @@ +//go:build generate + +package tools + +import ( + _ "github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs" +) + +// Format Terraform code for use in documentation. +//go:generate terraform fmt -recursive ../examples/ + +// Generate documentation. +//go:generate go run github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs generate --provider-dir .. --rendered-provider-name GitHub diff --git a/website/docs/d/actions_environment_public_key.html.markdown b/website/docs/d/actions_environment_public_key.html.markdown deleted file mode 100644 index c7d6ae0ae6..0000000000 --- a/website/docs/d/actions_environment_public_key.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_environment_public_key" -description: |- - Get information on a GitHub Actions Environment Public Key. ---- - -# github_actions_environment_public_key - -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 - -```hcl -data "github_actions_environment_public_key" "example" { - repository = "example_repo" - environment = "example_environment" -} -``` - -## Argument Reference - - * `repository` - (Required) Name of the repository to get public key from. - * `environment` - (Required) Name of the environment to get public key from. - -## Attributes Reference - - * `key_id` - ID of the key that has been retrieved. - * `key` - Actual key retrieved. diff --git a/website/docs/d/actions_environment_secrets.html.markdown b/website/docs/d/actions_environment_secrets.html.markdown deleted file mode 100644 index bc5a09990e..0000000000 --- a/website/docs/d/actions_environment_secrets.html.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_environment_secrets" -description: |- - Get Actions secrets of the repository environment ---- - -# github\_actions\_environment\_secrets - -Use this data source to retrieve the list of secrets of the repository environment. - -## Example Usage - -```hcl -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 diff --git a/website/docs/d/actions_environment_variables.html.markdown b/website/docs/d/actions_environment_variables.html.markdown deleted file mode 100644 index f68df5b3c4..0000000000 --- a/website/docs/d/actions_environment_variables.html.markdown +++ /dev/null @@ -1,29 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_environment_variables" -description: |- - Get Actions variables of the repository environment ---- - -# github\_actions\_environment\_variables - -Use this data source to retrieve the list of variables of the repository environment. - -## Example Usage - -```hcl -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 \ No newline at end of file diff --git a/website/docs/d/actions_organization_public_key.html.markdown b/website/docs/d/actions_organization_public_key.html.markdown deleted file mode 100644 index 624a8c58b8..0000000000 --- a/website/docs/d/actions_organization_public_key.html.markdown +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_organization_public_key" -description: |- - Get information on a GitHub Actions Organization Public Key. ---- - -# github_actions_organization_public_key - -Use this data source to retrieve information about a GitHub Actions Organization public key. This data source is required to be used with other GitHub secrets interactions. -Note that the provider `token` must have admin rights to an organization to retrieve it's action public key. - -## Example Usage - -```hcl -data "github_actions_organization_public_key" "example" {} -``` - -## Attributes Reference - - * `key_id` - ID of the key that has been retrieved. - * `key` - Actual key retrieved. diff --git a/website/docs/d/actions_organization_variables.html.markdown b/website/docs/d/actions_organization_variables.html.markdown deleted file mode 100644 index c04d51cec4..0000000000 --- a/website/docs/d/actions_organization_variables.html.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_organization_variables" -description: |- - Get Actions variables of the organization ---- - -# github\_actions\_organization\_variables - -Use this data source to retrieve the list of variables of the organization. - -## Example Usage - -```hcl -data "github_actions_organization_variables" "example" { -} -``` - -## Argument Reference - -## Attributes Reference - - * `variables` - list of variables for the repository - * `name` - Name of the variable - * `value` - Value of the variable - * `visibility` - Visibility of the variable - * `created_at` - Timestamp of the variable creation - * `updated_at` - Timestamp of the variable last update \ No newline at end of file diff --git a/website/docs/d/actions_public_key.html.markdown b/website/docs/d/actions_public_key.html.markdown deleted file mode 100644 index 8fae079e53..0000000000 --- a/website/docs/d/actions_public_key.html.markdown +++ /dev/null @@ -1,29 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_public_key" -description: |- - Get information on a GitHub Actions Public Key. ---- - -# github_actions_public_key - -Use this data source to retrieve information about a GitHub Actions public key. 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 it's action public key. - -## Example Usage - -```hcl -data "github_actions_public_key" "example" { - repository = "example_repo" -} -``` - -## Argument Reference - - * `repository` - (Required) Name of the repository to get public key from. - -## Attributes Reference - - * `key_id` - ID of the key that has been retrieved. - * `key` - Actual key retrieved. - diff --git a/website/docs/d/actions_secrets.html.markdown b/website/docs/d/actions_secrets.html.markdown deleted file mode 100644 index fbb83a1dae..0000000000 --- a/website/docs/d/actions_secrets.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_secrets" -description: |- - Get actions secrets for a repository ---- - -# github\_actions\_secrets - -Use this data source to retrieve the list of secrets for a GitHub repository. - -## Example Usage - -```hcl -data "github_actions_secrets" "example" { - name = "example" -} -``` - -## Argument Reference - - * `name` - (Optional) The name of the repository. - * `full_name` - (Optional) Full name of the repository (in `org/name` format). - -## Attributes Reference - - * `secrets` - list of secrets for the repository - * `name` - Secret name - * `created_at` - Timestamp of the secret creation - * `updated_at` - Timestamp of the secret last update - diff --git a/website/docs/d/actions_variables.html.markdown b/website/docs/d/actions_variables.html.markdown deleted file mode 100644 index c638c60d01..0000000000 --- a/website/docs/d/actions_variables.html.markdown +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_variables" -description: |- - Get Actions variables for a repository ---- - -# github\_actions\_variables - -Use this data source to retrieve the list of variables for a GitHub repository. - -## Example Usage - -```hcl -data "github_actions_variables" "example" { - name = "example" -} -``` - -## Argument Reference - - * `name` - (Optional) The name of the repository. - * `full_name` - (Optional) Full name of the repository (in `org/name` format). - -## Attributes Reference - - * `variables` - list of variables for the repository - * `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 - diff --git a/website/docs/d/codespaces_organization_public_key.html.markdown b/website/docs/d/codespaces_organization_public_key.html.markdown deleted file mode 100644 index 2cc891ddc3..0000000000 --- a/website/docs/d/codespaces_organization_public_key.html.markdown +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_codespaces_organization_public_key" -description: |- - Get information on a GitHub Codespaces Organization Public Key. ---- - -# github_codespaces_organization_public_key - -Use this data source to retrieve information about a GitHub Codespaces Organization public key. This data source is required to be used with other GitHub secrets interactions. -Note that the provider `token` must have admin rights to an organization to retrieve it's Codespaces public key. - -## Example Usage - -```hcl -data "github_codespaces_organization_public_key" "example" {} -``` - -## Attributes Reference - -* `key_id` - ID of the key that has been retrieved. -* `key` - Actual key retrieved. diff --git a/website/docs/d/codespaces_public_key.html.markdown b/website/docs/d/codespaces_public_key.html.markdown deleted file mode 100644 index 69bf492d94..0000000000 --- a/website/docs/d/codespaces_public_key.html.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_codespaces_public_key" -description: |- - Get information on a GitHub Codespaces Public Key. ---- - -# github_codespaces_public_key - -Use this data source to retrieve information about a GitHub Codespaces public key. 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 it's Codespaces public key. - -## Example Usage - -```hcl -data "github_codespaces_public_key" "example" { - repository = "example_repo" -} -``` - -## Argument Reference - -* `repository` - (Required) Name of the repository to get public key from. - -## Attributes Reference - -* `key_id` - ID of the key that has been retrieved. -* `key` - Actual key retrieved. diff --git a/website/docs/d/codespaces_user_public_key.html.markdown b/website/docs/d/codespaces_user_public_key.html.markdown deleted file mode 100644 index e3f757ad51..0000000000 --- a/website/docs/d/codespaces_user_public_key.html.markdown +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_codespaces_user_public_key" -description: |- - Get information on a GitHub Codespaces User Public Key. ---- - -# github_codespaces_user_public_key - -Use this data source to retrieve information about a GitHub Codespaces User public key. This data source is required to be used with other GitHub secrets interactions. -Note that the provider `token` must have admin rights to an user to retrieve it's Codespaces public key. - -## Example Usage - -```hcl -data "github_codespaces_user_public_key" "example" {} -``` - -## Attributes Reference - -* `key_id` - ID of the key that has been retrieved. -* `key` - Actual key retrieved. diff --git a/website/docs/d/codespaces_user_secrets.html.markdown b/website/docs/d/codespaces_user_secrets.html.markdown deleted file mode 100644 index fbce1d1415..0000000000 --- a/website/docs/d/codespaces_user_secrets.html.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_codespaces_user_secrets" -description: |- - Get codespaces secrets of the user ---- - -# github\_codespaces\_user\_secrets - -Use this data source to retrieve the list of codespaces secrets of the user. - -## Example Usage - -```hcl -data "github_codespaces_user_secrets" "example" { -} -``` - -## Argument Reference - -## Attributes Reference - - * `secrets` - list of secrets for the repository - * `name` - Secret name - * `visibility` - Secret visibility - * `created_at` - Timestamp of the secret creation - * `updated_at` - Timestamp of the secret last update - diff --git a/website/docs/d/collaborators.html.markdown b/website/docs/d/collaborators.html.markdown deleted file mode 100644 index ce8b47ef5c..0000000000 --- a/website/docs/d/collaborators.html.markdown +++ /dev/null @@ -1,69 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_collaborators" -description: |- - Get the collaborators for a given repository. ---- - -# github_collaborators - -Use this data source to retrieve the collaborators for a given repository. - -## Example Usage - -```hcl -data "github_collaborators" "test" { - owner = "example_owner" - repository = "example_repository" -} -``` - -## Arguments Reference - - * `owner` - (Required) The organization that owns the repository. - - * `repository` - (Required) The name of the repository. - - * `affiliation` - (Optional) Filter collaborators returned by their affiliation. Can be one of: `outside`, `direct`, `all`. Defaults to `all`. - - * `permission` - (Optional) Filter collaborators returned by their permission. Can be one of: `pull`, `triage`, `push`, `maintain`, `admin`. Defaults to not doing any filtering on permission. - -## Attributes Reference - - * `collaborator` - An Array of GitHub collaborators. Each `collaborator` block consists of the fields documented below. - -___ - -The `collaborator` block consists of: - -* `login` - The collaborator's login. - -* `id` - The ID of the collaborator. - -* `url` - The GitHub API URL for the collaborator. - -* `html_url` - The GitHub HTML URL for the collaborator. - -* `followers_url` - The GitHub API URL for the collaborator's followers. - -* `following_url` - The GitHub API URL for those following the collaborator. - -* `gists_url` - The GitHub API URL for the collaborator's gists. - -* `starred_url` - The GitHub API URL for the collaborator's starred repositories. - -* `subscriptions_url` - The GitHub API URL for the collaborator's subscribed repositories. - -* `organizations_url` - The GitHub API URL for the collaborator's organizations. - -* `repos_url` - The GitHub API URL for the collaborator's repositories. - -* `events_url` - The GitHub API URL for the collaborator's events. - -* `received_events_url` - The GitHub API URL for the collaborator's received events. - -* `type` - The type of the collaborator (ex. `user`). - -* `site_admin` - Whether the user is a GitHub admin. - -* `permission` - The permission of the collaborator. diff --git a/website/docs/d/dependabot_organization_public_key.html.markdown b/website/docs/d/dependabot_organization_public_key.html.markdown deleted file mode 100644 index b4a78b91c0..0000000000 --- a/website/docs/d/dependabot_organization_public_key.html.markdown +++ /dev/null @@ -1,22 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_dependabot_organization_public_key" -description: |- - Get information on a GitHub Dependabot Organization Public Key. ---- - -# github_dependabot_organization_public_key - -Use this data source to retrieve information about a GitHub Dependabot Organization public key. This data source is required to be used with other GitHub secrets interactions. -Note that the provider `token` must have admin rights to an organization to retrieve it's Dependabot public key. - -## Example Usage - -```hcl -data "github_dependabot_organization_public_key" "example" {} -``` - -## Attributes Reference - -* `key_id` - ID of the key that has been retrieved. -* `key` - Actual key retrieved. diff --git a/website/docs/d/dependabot_public_key.html.markdown b/website/docs/d/dependabot_public_key.html.markdown deleted file mode 100644 index 80163172d7..0000000000 --- a/website/docs/d/dependabot_public_key.html.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_dependabot_public_key" -description: |- - Get information on a GitHub Dependabot Public Key. ---- - -# github_dependabot_public_key - -Use this data source to retrieve information about a GitHub Dependabot public key. 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 it's Dependabot public key. - -## Example Usage - -```hcl -data "github_dependabot_public_key" "example" { - repository = "example_repo" -} -``` - -## Argument Reference - -* `repository` - (Required) Name of the repository to get public key from. - -## Attributes Reference - -* `key_id` - ID of the key that has been retrieved. -* `key` - Actual key retrieved. diff --git a/website/docs/d/dependabot_secrets.html.markdown b/website/docs/d/dependabot_secrets.html.markdown deleted file mode 100644 index 7ce26e2227..0000000000 --- a/website/docs/d/dependabot_secrets.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_dependabot_secrets" -description: |- - Get dependabot secrets for a repository ---- - -# github\_dependabot\_secrets - -Use this data source to retrieve the list of dependabot secrets for a GitHub repository. - -## Example Usage - -```hcl -data "github_dependabot_secrets" "example" { - name = "example" -} -``` - -## Argument Reference - - * `name` - (Optional) The name of the repository. - * `full_name` - (Optional) Full name of the repository (in `org/name` format). - -## Attributes Reference - - * `secrets` - list of dependabot secrets for the repository - * `name` - Secret name - * `created_at` - Timestamp of the secret creation - * `updated_at` - Timestamp of the secret last update - diff --git a/website/docs/d/enterprise.html.markdown b/website/docs/d/enterprise.html.markdown deleted file mode 100644 index 251e0ee951..0000000000 --- a/website/docs/d/enterprise.html.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: "github" -page_title: "Github: github_enterprise" -description: |- - Get an enterprise. ---- - -# github_enterprise - -Use this data source to retrieve basic information about a GitHub enterprise. - -## Example Usage - -``` -data "github_enterprise" "example" { - slug = "example-co" -} -``` - -## Attributes Reference - -* `id` - The ID of the enterprise. -* `database_id` - The database ID of the enterprise. -* `slug` - The URL slug identifying the enterprise. -* `name` - The name of the enterprise. -* `description` - The description of the enterprise. -* `created_at` - The time the enterprise was created. -* `url` - The url for the enterprise. diff --git a/website/docs/d/issue_labels.html.markdown b/website/docs/d/issue_labels.html.markdown deleted file mode 100644 index de43a01ba9..0000000000 --- a/website/docs/d/issue_labels.html.markdown +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_issue_labels" -description: |- - Get the labels for a given repository. ---- - -# github_labels - -Use this data source to retrieve the labels for a given repository. - -## Example Usage - -```hcl -data "github_labels" "test" { - repository = "example_repository" -} -``` - -## Arguments Reference - -* `repository` - (Required) The name of the repository. - -## Attributes Reference - -* `labels` - The list of this repository's labels. Each element of `labels` has the following attributes: - * `name` - The name of the label. - * `color` - The hexadecimal color code for the label, without the leading #. - * `description` - A short description of the label. - * `url` - The URL of the label. diff --git a/website/docs/d/membership.html.markdown b/website/docs/d/membership.html.markdown deleted file mode 100644 index 6f6e735d15..0000000000 --- a/website/docs/d/membership.html.markdown +++ /dev/null @@ -1,34 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_membership" -description: |- - Get information on user membership in an organization. ---- - -# github_membership - -Use this data source to find out if a user is a member of your organization, as well -as what role they have within it. -If the user's membership in the organization is pending their acceptance of an invite, -the role they would have once they accept will be returned. - -## Example Usage - -```hcl -data "github_membership" "membership_for_some_user" { - username = "SomeUser" -} -``` - -## Argument Reference - - * `username` - (Required) The username to lookup in the organization. - - * `organization` - (Optional) The organization to check for the above username. - -## Attributes Reference - - * `username` - The username. - * `role` - `admin` or `member` -- the role the user has within the organization. - * `etag` - An etag representing the membership object. - * `state` - `active` or `pending` -- the state of membership within the organization. `active` if the member has accepted the invite, or `pending` if the invite is still pending. diff --git a/website/docs/d/organization.html.markdown b/website/docs/d/organization.html.markdown deleted file mode 100644 index 55979f8be1..0000000000 --- a/website/docs/d/organization.html.markdown +++ /dev/null @@ -1,59 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization" -description: |- - Get an organization. ---- - -# github_organization - -Use this data source to retrieve basic information about a GitHub Organization. - -## Example Usage - -```hcl -data "github_organization" "example" { - name = "github" -} -``` - -## Argument Reference - -* `name` - (Required) The name of the organization. -* `ignore_archived_repos` - (Optional) Whether or not to include archived repos in the `repositories` list. Defaults to `false`. -* `summary_only` - (Optional) Exclude the repos, members and other attributes from the returned result. Defaults to `false`. - -## Attributes Reference - - * `id` - The ID of the organization - * `node_id` - GraphQL global node ID for use with the v4 API - * `name` - The organization's public profile name - * `orgname` - The organization's name as used in URLs and the API - * `login` - The organization account login - * `description` - The organization account description - * `plan` - The organization account plan name - * `repositories` - (`list`) A list of the full names of the repositories in the organization formatted as `owner/name` strings - * `members` - **Deprecated**: use `users` instead by replacing `github_organization.example.members` to `github_organization.example.users[*].login` which will give you the same value, expect this field to be removed in next major version - * `users` - (`list`) A list with the members of the organization with following fields: - * `id` - The ID of the member - * `login` - The members login - * `email` - Publicly available email - * `role` - Member role `ADMIN`, `MEMBER` - * `two_factor_requirement_enabled` - Whether two-factor authentication is required for all members of the organization. - * `default_repository_permission` - Default permission level members have for organization repositories. - * `members_allowed_repository_creation_type` - The type of repository allowed to be created by members of the organization. Can be one of `ALL`, `PUBLIC`, `PRIVATE`, `NONE`. - * `members_can_create_repositories` - Whether non-admin organization members can create repositories. - * `members_can_create_internal_repositories` - Whether organization members can create internal repositories. - * `members_can_create_private_repositories` - Whether organization members can create private repositories. - * `members_can_create_public_repositories` - Whether organization members can create public repositories. - * `members_can_create_pages` - Whether organization members can create pages sites. - * `members_can_create_public_pages` - Whether organization members can create public pages sites. - * `members_can_create_private_pages` - Whether organization members can create private pages sites. - * `members_can_fork_private_repositories` - Whether organization members can create private repository forks. - * `web_commit_signoff_required` - Whether organization members must sign all commits. - * `advanced_security_enabled_for_new_repositories` - Whether advanced security is enabled for new repositories. - * `dependabot_alerts_enabled_for_new_repositories` - Whether Dependabot alerts is automatically enabled for new repositories. - * `dependabot_security_updates_enabled_for_new_repositories` - Whether Dependabot security updates is automatically enabled for new repositories. - * `dependency_graph_enabled_for_new_repositories` - Whether dependency graph is automatically enabled for new repositories. - * `secret_scanning_enabled_for_new_repositories` - Whether secret scanning is automatically enabled for new repositories. - * `secret_scanning_push_protection_enabled_for_new_repositories` - Whether secret scanning push protection is automatically enabled for new repositories. diff --git a/website/docs/d/organization_app_installations.html.markdown b/website/docs/d/organization_app_installations.html.markdown deleted file mode 100644 index 4f2ec8957c..0000000000 --- a/website/docs/d/organization_app_installations.html.markdown +++ /dev/null @@ -1,40 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_app_installations" -description: |- - Get information on all GitHub App installations of the organization. ---- - -# github\_organization\_app_installations - -Use this data source to retrieve all GitHub App installations of the organization. - -## Example Usage - -To retrieve *all* GitHub App installations of the organization: - -```hcl -data "github_organization_app_installations" "all" {} -``` - -## Attributes Reference - -* `installations` - List of GitHub App installations in the organization. Each `installation` block consists of the fields documented below. - ---- - -The `installation` block consists of: - - * `id` - The ID of the GitHub App installation. - * `app_slug` - The URL-friendly name of the GitHub App. - * `app_id` - The ID of the GitHub App. - * `repository_selection` - Whether the installation has access to all repositories or only selected ones. Possible values are `all` or `selected`. - * `permissions` - A map of the permissions granted to the GitHub App installation. - * `events` - The list of events the GitHub App installation subscribes to. - * `client_id` - The OAuth client ID of the GitHub App. - * `target_id` - The ID of the account the GitHub App is installed on. - * `target_type` - The type of account the GitHub App is installed on. Possible values are `Organization` or `User`. - * `suspended` - Whether the GitHub App installation is currently suspended. - * `single_file_paths` - The list of single file paths the GitHub App installation has access to. - * `created_at` - The date the GitHub App installation was created. - * `updated_at` - The date the GitHub App installation was last updated. diff --git a/website/docs/d/organization_custom_properties.html.markdown b/website/docs/d/organization_custom_properties.html.markdown deleted file mode 100644 index 783eda2ad0..0000000000 --- a/website/docs/d/organization_custom_properties.html.markdown +++ /dev/null @@ -1,40 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_custom_properties" -description: |- - Get information about a GitHub organization custom property ---- - -# github_organization_custom_properties - -Use this data source to retrieve information about a GitHub organization custom property. - -## Example Usage - -```hcl -data "github_organization_custom_properties" "environment" { - property_name = "environment" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `property_name` - (Required) The name of the custom property to retrieve. - -## Attributes Reference - -* `property_name` - The name of the custom property. - -* `value_type` - The type of the custom property. Can be one of `string`, `single_select`, `multi_select`, or `true_false`. - -* `required` - Whether the custom property is required. - -* `description` - The description of the custom property. - -* `default_value` - The default value of the custom property. - -* `allowed_values` - List of allowed values for the custom property. Only populated when `value_type` is `single_select` or `multi_select`. - -* `values_editable_by` - Who can edit the values of the custom property. Can be one of `org_actors` or `org_and_repo_actors`. \ No newline at end of file diff --git a/website/docs/d/organization_ip_allow_list.html.markdown b/website/docs/d/organization_ip_allow_list.html.markdown deleted file mode 100644 index cd22a7af24..0000000000 --- a/website/docs/d/organization_ip_allow_list.html.markdown +++ /dev/null @@ -1,32 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_ip_allow_list" -description: |- - Get the IP allow list of an organization. ---- - -# github_organization_ip_allow_list - -Use this data source to retrieve information about the IP allow list of an organization. -The allow list for IP addresses will block access to private resources via the web, API, -and Git from any IP addresses that are not on the allow list. - -## Example Usage - -```hcl -data "github_organization_ip_allow_list" "all" {} -``` - -## Attributes Reference - -* `ip_allow_list` - An Array of allowed IP addresses. -___ - -Each element in the `ip_allow_list` block consists of: - - * `id` - The ID of the IP allow list entry. - * `name` - The name of the IP allow list entry. - * `allow_list_value` - A single IP address or range of IP addresses in CIDR notation. - * `is_active` - Whether the entry is currently active. - * `created_at` - Identifies the date and time when the object was created. - * `updated_at` - Identifies the date and time when the object was last updated. diff --git a/website/docs/d/organization_security_managers.html.markdown b/website/docs/d/organization_security_managers.html.markdown deleted file mode 100644 index 52b9cb29d7..0000000000 --- a/website/docs/d/organization_security_managers.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_security_managers" -description: |- - Get the security managers for an organization. ---- - -# github_organization_security_managers - -~> **Note:** This data source is deprecated, please use the `github_organization_role_team` resource instead. - -Use this data source to retrieve the security managers for an organization. - -## Example Usage - -```hcl -data "github_organization_security_managers" "test" {} -``` - -## Attributes Reference - -* `teams` - An list of GitHub teams. Each `team` block consists of the fields documented below. - ----___ - -The `team` block consists of: - -* `id` - Unique identifier of the team. -* `slug` - Name based identifier of the team. -* `name` - Name of the team. -* `permission` - Permission that the team will have for its repositories. diff --git a/website/docs/d/organization_team_sync_groups.html.markdown b/website/docs/d/organization_team_sync_groups.html.markdown deleted file mode 100644 index 85b36fb436..0000000000 --- a/website/docs/d/organization_team_sync_groups.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_team_sync_groups" -description: |- - Get the external identity provider (IdP) groups for an organization. ---- - -# github_organization_team_sync_groups - -Use this data source to retrieve the identity provider (IdP) groups for an organization. - -## Example Usage - -```hcl -data "github_organization_team_sync_groups" "test" {} -``` - -## Attributes Reference - - * `groups` - An Array of GitHub Identity Provider Groups. Each `group` block consists of the fields documented below. - -___ - -The `group` block consists of: - -* `group_id` - The ID of the IdP group. - -* `group_name` - The name of the IdP group. - -* `group_description` - The description of the IdP group. - diff --git a/website/docs/d/organization_teams.html.markdown b/website/docs/d/organization_teams.html.markdown deleted file mode 100644 index f2476738ff..0000000000 --- a/website/docs/d/organization_teams.html.markdown +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_teams" -description: |- - Get information on all GitHub teams of an organization. ---- - -# github\_organization\_teams - -Use this data source to retrieve information about all GitHub teams in an organization. - -## Example Usage - -To retrieve *all* teams of the organization: - -```hcl -data "github_organization_teams" "all" {} -``` - -To retrieve only the team's at the root of the organization: - -```hcl -data "github_organization_teams" "root_teams" { - root_teams_only = true -} -``` - -## Attributes Reference - -* `teams` - (Required) An Array of GitHub Teams. Each `team` block consists of the fields documented below. -* `root_teams_only` - (Optional) Only return teams that are at the organization's root, i.e. no nested teams. Defaults to `false`. -* `summary_only` - (Optional) Exclude the members and repositories of the team from the returned result. Defaults to `false`. -* `results_per_page` - (Optional) Set the number of results per graphql query. Reducing this number can alleviate timeout errors. Accepts a value between 0 - 100. Defaults to `100`. - -___ - -The `team` block consists of: - - * `id` - The ID of the team. - * `node_id` - The Node ID of the team. - * `slug` - The slug of the team. - * `name` - The team's full name. - * `description` - The team's description. - * `privacy` - The team's privacy type. - * `members` - List of team members. Not returned if `summary_only = true` - * `repositories` - List of team repositories. Not returned if `summary_only = true` - * `parent_team_id` - The ID of the parent team, if there is one. - * `parent_team_slug` - The slug of the parent team, if there is one. - * `parent` - (**DEPRECATED**) The parent team, use `parent_team_id` or `parent_team_slug` instead. diff --git a/website/docs/d/organization_webhooks.html.markdown b/website/docs/d/organization_webhooks.html.markdown deleted file mode 100644 index 3ae975322b..0000000000 --- a/website/docs/d/organization_webhooks.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_webhooks" -description: |- - Get information on all GitHub webhooks of the organization. ---- - -# github\_organization\_webhooks - -Use this data source to retrieve all webhooks of the organization. - -## Example Usage - -To retrieve *all* webhooks of the organization: - -```hcl -data "github_organization_webhooks" "all" {} -``` - -## Attributes Reference - -* `webhooks` - An Array of GitHub Webhooks. Each `webhook` block consists of the fields documented below. -___ - -The `webhook` block consists of: - - * `id` - the ID of the webhook. - * `type` - the type of the webhook. - * `name` - the name of the webhook. - * `url` - the url of the webhook. - * `active` - `true` if the webhook is active. diff --git a/website/docs/d/release.html.markdown b/website/docs/d/release.html.markdown deleted file mode 100644 index 63a49d6504..0000000000 --- a/website/docs/d/release.html.markdown +++ /dev/null @@ -1,87 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_release" -description: |- - Get information on a GitHub release. ---- - -# github\_release - -Use this data source to retrieve information about a GitHub release in a specific repository. - -## Example Usage -To retrieve the latest release that is present in a repository: - -```hcl -data "github_release" "example" { - repository = "example-repository" - owner = "example-owner" - retrieve_by = "latest" -} -``` - -To retrieve a specific release from a repository based on its ID: - -```hcl -data "github_release" "example" { - repository = "example-repository" - owner = "example-owner" - retrieve_by = "id" - id = 12345 -} -``` - -Finally, to retrieve a release based on its tag: - -```hcl -data "github_release" "example" { - repository = "example-repository" - owner = "example-owner" - retrieve_by = "tag" - release_tag = "v1.0.0" -} -``` - -## Argument Reference - - * `repository` - (Required) Name of the repository to retrieve the release from. - - * `owner` - (Required) Owner of the repository. - - * `retrieve_by` - (Required) Describes how to fetch the release. Valid values are `id`, `tag`, `latest`. - - * `release_id` - (Optional) ID of the release to retrieve. Must be specified when `retrieve_by` = `id`. - - * `release_tag` - (Optional) Tag of the release to retrieve. Must be specified when `retrieve_by` = `tag`. - - -## Attributes Reference - - * `release_tag` - Tag of release - * `release_id` - ID of release - * `target_commitish` - Commitish value that determines where the Git release is created from - * `name` - Name of release - * `body` - Contents of the description (body) of a release - * `draft` - (`Boolean`) indicates whether the release is a draft - * `prerelease` - (`Boolean`) indicates whether the release is a prerelease - * `created_at` - Date of release creation - * `published_at` - Date of release publishing - * `url` - Base URL of the release - * `html_url` - URL directing to detailed information on the release - * `assets_url` - URL of any associated assets with the release - * `asserts_url` - **Deprecated**: Use `assets_url` resource instead - * `upload_url` - URL that can be used to upload Assets to the release - * `zipball_url` - Download URL of a specific release in `zip` format - * `tarball_url` - Download URL of a specific release in `tar.gz` format - * `assets` - Collection of assets for the release. Each asset conforms to the following schema: - * `id` - ID of the asset - * `url` - URL of the asset - * `node_id` - Node ID of the asset - * `name` - The file name of the asset - * `label` - Label for the asset - * `content_type` - MIME type of the asset - * `size` - Size in byte - * `created_at` - Date the asset was created - * `updated_at` - Date the asset was last updated - * `browser_download_url` - Browser download URL - diff --git a/website/docs/d/release_asset.html.markdown b/website/docs/d/release_asset.html.markdown deleted file mode 100644 index a5b9faa1ec..0000000000 --- a/website/docs/d/release_asset.html.markdown +++ /dev/null @@ -1,88 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_release_asset" -description: |- - Get information on a GitHub release asset. ---- - -# github\_release\_asset - -Use this data source to retrieve information about a GitHub release asset. - -## Example Usage -To retrieve a specific release asset from a repository based on its ID: - -```hcl -data "github_release_asset" "example" { - repository = "example-repository" - owner = "example-owner" - asset_id = 12345 -} -``` - -To retrieve a specific release asset from a repository, and download the file -into a `file` attribute on the data source: - -```hcl -data "github_release_asset" "example" { - repository = "example-repository" - owner = "example-owner" - asset_id = 12345 - download_file = true -} -``` - - -To retrieve the first release asset associated with the latest release in a repository: - -```hcl -data "github_release" "example" { - repository = "example-repository" - owner = "example-owner" - retrieve_by = "latest" -} - -data "github_release_asset" "example" { - repository = "example-repository" - owner = "example-owner" - asset_id = data.github_release.example.assets[0].id -} -``` - -To retrieve all release assets associated with the the latest release in a repository: - -```hcl -data "github_release" "example" { - repository = "example-repository" - owner = "example-owner" - retrieve_by = "latest" -} - -data "github_release_asset" "example" { - count = length(data.github_release.example.assets) - repository = "example-repository" - owner = "example-owner" - asset_id = data.github_release.example.assets[count.index].id -} -``` - -## Argument Reference - -* `repository` - (Required) Name of the repository to retrieve the release from -* `owner` - (Required) Owner of the repository -* `asset_id` - (Required) ID of the release asset to retrieve -* `download_file_contents` - (Optional) Whether to download the asset file content into the `file_contents` attribute (defaults to `false`) - -## Attributes Reference - -* `id` - ID of the asset -* `url` - URL of the asset -* `node_id` - Node ID of the asset -* `name` - The file name of the asset -* `label` - Label for the asset -* `content_type` - MIME type of the asset -* `size` - Asset size in bytes -* `created_at` - Date the asset was created -* `updated_at` - Date the asset was last updated -* `browser_download_url` - Browser URL from which the release asset can be downloaded -* `file_contents` - The base64-encoded release asset file contents (requires `download_file_contents` to be `true`) diff --git a/website/docs/d/repository_autolink_references.html.markdown b/website/docs/d/repository_autolink_references.html.markdown deleted file mode 100644 index a219a1bf4f..0000000000 --- a/website/docs/d/repository_autolink_references.html.markdown +++ /dev/null @@ -1,29 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: repository_autolink_references" -description: |- - Get autolink references for a Github repository. ---- - -# github_repository_autolink_references - -Use this data source to retrieve autolink references for a repository. - -## Example Usage - -```hcl -data "github_repository_autolink_references" "example" { - repository = "example-repository" -} -``` - -## Argument Reference - -* `repository` - (Required) Name of the repository to retrieve the autolink references from. - -## Attributes Reference - -* `autolink_references` - The list of this repository's autolink references. Each element of `autolink_references` has the following attributes: - * `key_prefix` - Key prefix. - * `target_url_template` - Target url template. - * `is_alphanumeric` - True if alphanumeric. diff --git a/website/docs/d/repository_custom_properties.html.markdown b/website/docs/d/repository_custom_properties.html.markdown deleted file mode 100644 index 17677b5f75..0000000000 --- a/website/docs/d/repository_custom_properties.html.markdown +++ /dev/null @@ -1,28 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_repository_custom_properties" -description: |- - Get all custom properties of a repository ---- - -# github_repository_custom_properties - -Use this data source to retrieve all custom properties of a repository. - -## Example Usage - -```hcl -data "github_repository_custom_properties" "example" { - repository = "example-repository" -} -``` - -## Argument Reference - -* `repository` - (Required) Name of the repository to retrieve the custom properties from. - -## Attributes Reference - -* `property` - The list of this repository's custom properties. Each element of `property` has the following attributes: - * `property_name` - Name of the property - * `property_value` - Value of the property diff --git a/website/docs/d/repository_deploy_keys.html.markdown b/website/docs/d/repository_deploy_keys.html.markdown deleted file mode 100644 index d7f6387f6c..0000000000 --- a/website/docs/d/repository_deploy_keys.html.markdown +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: repository_deploy_keys" -description: |- - Get all deploy keys of a repository ---- - -# github_repository_deploy_keys - -Use this data source to retrieve all deploy keys of a repository. - -## Example Usage - -```hcl -data "github_repository_deploy_keys" "example" { - repository = "example-repository" -} -``` - -## Argument Reference - -* `repository` - (Required) Name of the repository to retrieve the branches from. - -## Attributes Reference - -* `keys` - The list of this repository's deploy keys. Each element of `keys` has the following attributes: - * `id` - Key id - * `title` - Key title - * `key` - Key itself - * `verified` - `true` if the key was verified. diff --git a/website/docs/d/repository_environment_deployment_policies.html.markdown b/website/docs/d/repository_environment_deployment_policies.html.markdown deleted file mode 100644 index 93efcc912a..0000000000 --- a/website/docs/d/repository_environment_deployment_policies.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_repository_environment_deployment_policies" -description: |- - Get the list of environment deployment policies for a given repository environment. ---- - -# github_repository_environment_deployment_policies - -Use this data source to retrieve deployment branch policies for a repository environment. - -## Example Usage - -```hcl -data "github_repository_environment_deployment_policies" "example" { - repository = "example-repository" - environment = "env-name" -} -``` - -## Argument Reference - -* `repository` - (Required) Name of the repository to retrieve the deployment branch policies from. - -* `environment` - (Required) Name of the environment to retrieve the deployment branch policies from. - -## Attributes Reference - -* `policies` - The list of deployment policies for the repository environment. Each element of `policies` has the following attributes: - * `type` - Type of the policy; this could be `branch` or `tag`. - * `pattern` - The pattern that branch or tag names must match in order to deploy to the environment. diff --git a/website/docs/d/repository_file.html.markdown b/website/docs/d/repository_file.html.markdown deleted file mode 100644 index b1683deac9..0000000000 --- a/website/docs/d/repository_file.html.markdown +++ /dev/null @@ -1,52 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_repository_file" -description: |- - Reads files within a GitHub repository ---- - -# github_repository_file - -This data source allows you to read files within a -GitHub repository. - - -## Example Usage - -```hcl -data "github_repository_file" "foo" { - repository = github_repository.foo.name - branch = "main" - file = ".gitignore" -} - -``` - - -## Argument Reference - -The following arguments are supported: - -* `repository` - (Required) The repository to read the file from. If an unqualified repo name (without an owner) is passed, the owner will be inferred from the owner of the token used to execute the plan. If a name of the type "owner/repo" (with a slash in the middle) is passed, the owner will be as specified and not the owner of the token. - -* `file` - (Required) The path of the file to read. - -* `branch` - (Optional) Git branch. Defaults to the repository's default branch. - -## Attributes Reference - -The following additional attributes are exported: - -* `content` - The file content. - -* `commit_sha` - The SHA of the commit that modified the file. - -* `sha` - The SHA blob of the file. - -* `commit_author` - Committer author name. - -* `commit_email` - Committer email address. - -* `commit_message` - Commit message when file was last updated. - -* `ref` - The name of the commit/branch/tag. diff --git a/website/docs/d/repository_milestone.html.markdown b/website/docs/d/repository_milestone.html.markdown deleted file mode 100644 index fe177f4b68..0000000000 --- a/website/docs/d/repository_milestone.html.markdown +++ /dev/null @@ -1,35 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_repository_milestone" -description: |- - Get information on a GitHub Repository Milestone. ---- - -# github_repository_milestone - -Use this data source to retrieve information about a specific GitHub milestone in a repository. - -## Example Usage - -```hcl -data "github_repository_milestone" "example" { - owner = "example-owner" - repository = "example-repository" - number = 1 -} -``` - -## Argument Reference - - * `owner` - (Required) Owner of the repository. - - * `repository` - (Required) Name of the repository to retrieve the milestone from. - - * `number` - (Required) The number of the milestone. - -## Attributes Reference - - * `description` - Description of the milestone. - * `due_date` - The milestone due date (in ISO-8601 `yyyy-mm-dd` format). - * `state` - State of the milestone. - * `title` - Title of the milestone. diff --git a/website/docs/d/repository_pull_request.html.markdown b/website/docs/d/repository_pull_request.html.markdown deleted file mode 100644 index 4173601e61..0000000000 --- a/website/docs/d/repository_pull_request.html.markdown +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: repository_pull_request" -description: |- - Get information on a single GitHub Pull Request. ---- - -# github_repository_pull_request - -Use this data source to retrieve information about a specific GitHub Pull Request in a repository. - -## Example Usage - -```hcl -data "github_repository_pull_request" "example" { - base_repository = "example_repository" - number = 1 -} -``` - -## Argument Reference - -* `base_repository` - (Required) Name of the base repository to retrieve the Pull Request from. - -* `number` - (Required) The number of the Pull Request within the repository. - -* `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. - -## Attributes Reference - -* `base_ref` - Name of the ref (branch) of the Pull Request base. - -* `base_sha` - Head commit SHA of the Pull Request base. - -* `body` - Body of the Pull Request. - -* `draft` - Indicates Whether this Pull Request is a draft. - -* `head_owner` - Owner of the Pull Request head repository. - -* `head_repository` - Name of the Pull Request head repository. - -* `head_sha` - Head commit SHA of the Pull Request head. - -* `labels` - List of label names set on the Pull Request. - -* `maintainer_can_modify` - Indicates whether the base repository maintainers can modify the Pull Request. - -* `opened_at` - Unix timestamp indicating the Pull Request creation time. - -* `opened_by` - GitHub login of the user who opened the Pull Request. - -* `state` - the current Pull Request state - can be "open", "closed" or "merged". - -* `title` - The title of the Pull Request. - -* `updated_at` - The timestamp of the last Pull Request update. - \ No newline at end of file diff --git a/website/docs/d/repository_pull_requests.html.markdown b/website/docs/d/repository_pull_requests.html.markdown deleted file mode 100644 index 10797e89b6..0000000000 --- a/website/docs/d/repository_pull_requests.html.markdown +++ /dev/null @@ -1,74 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: repository_pull_requests" -description: |- - Get information on multiple GitHub Pull Requests. ---- - -# github_repository_pull_requests - -Use this data source to retrieve information about multiple GitHub Pull Requests in a repository. - -## Example Usage - -```hcl -data "github_repository_pull_requests" "example" { - base_repository = "example-repository" - base_ref = "main" - sort_by = "updated" - sort_direction = "desc" - state = "open" -} -``` - -## Argument Reference - -* `base_repository` - (Required) Name of the base repository to retrieve the Pull Requests from. - -* `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. - -* `base_ref` - (Optional) If set, filters Pull Requests by base branch name. - -* `head_ref` - (Optional) If set, filters Pull Requests by head user or head organization and branch name in the format of "user:ref-name" or "organization:ref-name". For example: "github:new-script-format" or "octocat:test-branch". - -* `sort_by` - (Optional) If set, indicates what to sort results by. Can be either "created", "updated", "popularity" (comment count) or "long-running" (age, filtering by pulls updated in the last month). Default: "created". - -* `sort_direction` - (Optional) If set, controls the direction of the sort. Can be either "asc" or "desc". Default: "asc". - -* `state` - (Optional) If set, filters Pull Requests by state. Can be "open", "closed", or "all". Default: "open". - -## Attributes Reference - -* `results` - Collection of Pull Requests matching the filters. Each of the results conforms to the following scheme: - - * `base_ref` - Name of the ref (branch) of the Pull Request base. - - * `base_sha` - Head commit SHA of the Pull Request base. - - * `body` - Body of the Pull Request. - - * `draft` - Indicates Whether this Pull Request is a draft. - - * `head_owner` - Owner of the Pull Request head repository. - - * `head_ref` - Value of the Pull Request `HEAD` reference. - - * `head_repository` - Name of the Pull Request head repository. - - * `head_sha` - Head commit SHA of the Pull Request head. - - * `labels` - List of label names set on the Pull Request. - - * `maintainer_can_modify` - Indicates whether the base repository maintainers can modify the Pull Request. - - * `number` - The number of the Pull Request within the repository. - - * `opened_at` - Unix timestamp indicating the Pull Request creation time. - - * `opened_by` - GitHub login of the user who opened the Pull Request. - - * `state` - the current Pull Request state - can be "open", "closed" or "merged". - - * `title` - The title of the Pull Request. - - * `updated_at` - The timestamp of the last Pull Request update. diff --git a/website/docs/d/repository_teams.html.markdown b/website/docs/d/repository_teams.html.markdown deleted file mode 100644 index ca67c980f0..0000000000 --- a/website/docs/d/repository_teams.html.markdown +++ /dev/null @@ -1,31 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_repository_teams" -description: |- - Get teams which have permission on the given repo. ---- - -# github\_repository\_teams - -Use this data source to retrieve the list of teams which have access to a GitHub repository. - -## Example Usage - -```hcl -data "github_repository_teams" "example" { - name = "example" -} -``` - -## Argument Reference - - * `name` - (Optional) The name of the repository. - * `full_name` - (Optional) Full name of the repository (in `org/name` format). - -## Attributes Reference - - * `teams` - List of teams which have access to the repository - * `name` - Team name - * `slug` - Team slug - * `permission` - Team permission - diff --git a/website/docs/d/rest_api.html.markdown b/website/docs/d/rest_api.html.markdown deleted file mode 100644 index de628acef6..0000000000 --- a/website/docs/d/rest_api.html.markdown +++ /dev/null @@ -1,30 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_rest_api" -description: |- - Get information on a GitHub resource with a custom GET request to GitHub REST API. ---- - -# github_rest_api - -Use this data source to retrieve information about a GitHub resource through REST API. - -## Example Usage - -```hcl -data "github_rest_api" "example" { - endpoint = "repos/example_repo/git/refs/heads/main" -} -``` - -## Argument Reference - - * `endpoint` - (Required) REST API endpoint to send the GET request to. - -## Attributes Reference - - * `id` - The GitHub API Request ID - * `code` - A response status code. - * `status` - A response status string. - * `headers` - A JSON string containing response headers. - * `body` - A JSON string containing response body. diff --git a/website/docs/d/team.html.markdown b/website/docs/d/team.html.markdown deleted file mode 100644 index f8fdde4de5..0000000000 --- a/website/docs/d/team.html.markdown +++ /dev/null @@ -1,38 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_team" -description: |- - Get information on a GitHub team. ---- - -# github\_team - -Use this data source to retrieve information about a GitHub team. - -## Example Usage - -```hcl -data "github_team" "example" { - slug = "example" -} -``` - -## Argument Reference - -* `slug` - (Required) The team slug. -* `membership_type` - (Optional) Type of membership to be requested to fill the list of members. Can be either `all` _(default)_ or `immediate`. -* `summary_only` - (Optional) Exclude the members and repositories of the team from the returned result. Defaults to `false`. -* `results_per_page` - (**DEPRECATED**) (Optional) Set the number of results per REST API query. Accepts a value between 0 - 100 _(defaults to `100`)_. - -## Attributes Reference - -* `id` - ID of the team. -* `node_id` - Node ID of the team. -* `name` - Team's full name. -* `description` - Team's description. -* `privacy` - Team's privacy type. Can either be `closed` or `secret`. -* `notification_setting` - Teams's notification setting. Can be either `notifications_enabled` or `notifications_disabled`. -* `permission` - (**DEPRECATED**) The permission that new repositories will be added to the team with when none is specified. -* `members` - List of team members (list of GitHub usernames). Not returned if `summary_only = true`. -* `repositories` - (**DEPRECATED**) List of team repositories (list of repo names). Not returned if `summary_only = true`. -* `repositories_detailed` - List of team repositories (each item comprises of `repo_id`, `repo_name` & [`role_name`](https://registry.terraform.io/providers/integrations/github/latest/docs/resources/team_repository#permission)). Not returned if `summary_only = true`. diff --git a/website/docs/d/user.html.markdown b/website/docs/d/user.html.markdown deleted file mode 100644 index 9b031a89e8..0000000000 --- a/website/docs/d/user.html.markdown +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_user" -description: |- - Get information on a GitHub user. ---- - -# github\_user - -Use this data source to retrieve information about a GitHub user. - -## Example Usage - -```hcl -# Retrieve information about a GitHub user. -data "github_user" "example" { - username = "example" -} - -# Retrieve information about the currently authenticated user. -data "github_user" "current" { - username = "" -} - -output "current_github_login" { - value = "${data.github_user.current.login}" -} - -``` - -## Argument Reference - - * `username` - (Required) The username. Use an empty string `""` to retrieve information about the currently authenticated user. - -## Attributes Reference - - * `id` - the ID of the user. - * `node_id` - the Node ID of the user. - * `login` - the user's login. - * `avatar_url` - the user's avatar URL. - * `gravatar_id` - the user's gravatar ID. - * `site_admin` - whether the user is a GitHub admin. - * `name` - the user's full name. - * `company` - the user's company name. - * `blog` - the user's blog location. - * `location` - the user's location. - * `email` - the user's email. - * `gpg_keys` - list of user's GPG keys. - * `ssh_keys` - list of user's SSH keys. - * `bio` - the user's bio. - * `public_repos` - the number of public repositories. - * `public_gists` - the number of public gists. - * `followers` - the number of followers. - * `following` - the number of following users. - * `created_at` - the creation date. - * `updated_at` - the update date. - * `suspended_at` - the suspended date if the user is suspended. diff --git a/website/docs/d/users.html.markdown b/website/docs/d/users.html.markdown deleted file mode 100644 index 81e0f11f7a..0000000000 --- a/website/docs/d/users.html.markdown +++ /dev/null @@ -1,38 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_users" -description: |- - Get information about multiple GitHub users. ---- - -# github\_users - -Use this data source to retrieve information about multiple GitHub users at once. - -## Example Usage - -```hcl -# Retrieve information about multiple GitHub users. -data "github_users" "example" { - usernames = ["example1", "example2", "example3"] -} - -output "valid_users" { - value = "${data.github_users.example.logins}" -} - -output "invalid_users" { - value = "${data.github_users.example.unknown_logins}" -} -``` - -## Argument Reference - - * `usernames` - (Required) List of usernames. - -## Attributes Reference - - * `node_ids` - list of Node IDs of users that could be found. - * `logins` - list of logins of users that could be found. - * `emails` - list of the user's publicly visible profile email (will be empty string in case if user decided not to show it). - * `unknown_logins` - list of logins without matching user. diff --git a/website/docs/r/actions_organization_oidc_subject_claim_customization_template.html.markdown b/website/docs/r/actions_organization_oidc_subject_claim_customization_template.html.markdown deleted file mode 100644 index abbd3841c8..0000000000 --- a/website/docs/r/actions_organization_oidc_subject_claim_customization_template.html.markdown +++ /dev/null @@ -1,36 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_organization_oidc_subject_claim_customization_template" -description: |- -Creates and manages an OpenID Connect subject claim customization template for an organization ---- - -# github_actions_organization_oidc_subject_claim_customization_template - -This resource allows you to create and manage an OpenID Connect subject claim customization template within a GitHub -organization. - -More information on integrating GitHub with cloud providers using OpenID Connect and a list of available claims is -available in the [Actions documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect). - -## Example Usage - -```hcl -resource "github_actions_organization_oidc_subject_claim_customization_template" "example_template" { - include_claim_keys = ["actor", "context", "repository_owner"] -} -``` - -## Argument Reference - -The following arguments are supported: - -* `include_claim_keys` - (Required) A list of OpenID Connect claims. - -## Import - -This resource can be imported using the organization's name. - -``` -$ terraform import github_actions_organization_oidc_subject_claim_customization_template.test example_organization -``` \ No newline at end of file diff --git a/website/docs/r/actions_organization_permissions.html.markdown b/website/docs/r/actions_organization_permissions.html.markdown deleted file mode 100644 index 9c9e5670b8..0000000000 --- a/website/docs/r/actions_organization_permissions.html.markdown +++ /dev/null @@ -1,64 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_organization_permissions" -description: |- - Creates and manages Actions permissions within a GitHub organization ---- - -# github_actions_organization_permissions - -This resource allows you to create and manage GitHub Actions permissions within your GitHub enterprise organizations. -You must have admin access to an organization to use this resource. - -## Example Usage - -```hcl -resource "github_repository" "example" { - name = "my-repository" -} - -resource "github_actions_organization_permissions" "test" { - allowed_actions = "selected" - enabled_repositories = "selected" - allowed_actions_config { - github_owned_allowed = true - patterns_allowed = ["actions/cache@*", "actions/checkout@*"] - verified_allowed = true - } - enabled_repositories_config { - repository_ids = [github_repository.example.repo_id] - } -} -``` - -## Argument Reference - -The following arguments are supported: - -* `allowed_actions` - (Optional) The permissions policy that controls the actions that are allowed to run. Can be one of: `all`, `local_only`, or `selected`. -* `enabled_repositories` - (Required) The policy that controls the repositories in the organization that are allowed to run GitHub Actions. Can be one of: `all`, `none`, or `selected`. -* `allowed_actions_config` - (Optional) Sets the actions that are allowed in an organization. Only available when `allowed_actions` = `selected`. See [Allowed Actions Config](#allowed-actions-config) below for details. -* `enabled_repositories_config` - (Optional) Sets the list of selected repositories that are enabled for GitHub Actions in an organization. Only available when `enabled_repositories` = `selected`. See [Enabled Repositories Config](#enabled-repositories-config) below for details. -* `sha_pinning_required` - (Optional) Whether pinning to a specific SHA is required for all actions and reusable workflows in the organization. - -### Allowed Actions Config - -The `allowed_actions_config` block supports the following: - -* `github_owned_allowed` - (Required) Whether GitHub-owned actions are allowed in the organization. -* `patterns_allowed` - (Optional) Specifies a list of string-matching patterns to allow specific action(s). Wildcards, tags, and SHAs are allowed. For example, monalisa/octocat@*, monalisa/octocat@v2, monalisa/*." -* `verified_allowed` - (Optional) Whether actions in GitHub Marketplace from verified creators are allowed. Set to true to allow all GitHub Marketplace actions by verified creators. - -### Enabled Repositories Config - -The `enabled_repositories_config` block supports the following: - -* `repository_ids` - (Required) List of repository IDs to enable for GitHub Actions. - -## Import - -This resource can be imported using the name of the GitHub organization: - -``` -$ terraform import github_actions_organization_permissions.test github_organization_name -``` diff --git a/website/docs/r/actions_runner_group.html.markdown b/website/docs/r/actions_runner_group.html.markdown deleted file mode 100644 index 2c0c02fe84..0000000000 --- a/website/docs/r/actions_runner_group.html.markdown +++ /dev/null @@ -1,57 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_actions_runner_group" -description: |- - Creates and manages an Actions Runner Group within a GitHub organization ---- - -# github_actions_runner_group - -This resource allows you to create and manage GitHub Actions runner groups within your GitHub enterprise organizations. -You must have admin access to an organization to use this resource. - -## Example Usage - -```hcl -resource "github_repository" "example" { - name = "my-repository" -} - -resource "github_actions_runner_group" "example" { - name = github_repository.example.name - visibility = "selected" - selected_repository_ids = [github_repository.example.repo_id] -} -``` - -## Argument Reference - -The following arguments are supported: - -* `name` - (Required) Name of the runner group -* `restricted_to_workflows` - (Optional) If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. -* `selected_repository_ids` - (Optional) IDs of the repositories which should be added to the runner group -* `selected_workflows` - (Optional) List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. -* `visibility` - (Optional) Visibility of a runner group. Whether the runner group can include `all`, `selected`, or `private` repositories. A value of `private` is not currently supported due to limitations in the GitHub API. -* `allows_public_repositories` - (Optional) Whether public repositories can be added to the runner group. Defaults to false. - -## Attributes Reference - -* `allows_public_repositories` - Whether public repositories can be added to the runner group -* `default` - Whether this is the default runner group -* `etag` - An etag representing the runner group object -* `inherited` - Whether the runner group is inherited from the enterprise level -* `runners_url` - The GitHub API URL for the runner group's runners -* `selected_repository_ids` - List of repository IDs that can access the runner group -* `selected_repositories_url` - GitHub API URL for the runner group's repositories -* `visibility` - The visibility of the runner group -* `restricted_to_workflows` - If true, the runner group will be restricted to running only the workflows specified in the selected_workflows array. Defaults to false. -* `selected_workflows` - List of workflows the runner group should be allowed to run. This setting will be ignored unless restricted_to_workflows is set to true. - -## Import - -This resource can be imported using the ID of the runner group: - -``` -$ terraform import github_actions_runner_group.test 7 -``` diff --git a/website/docs/r/app_installation_repository.html.markdown b/website/docs/r/app_installation_repository.html.markdown deleted file mode 100644 index 4be7ead063..0000000000 --- a/website/docs/r/app_installation_repository.html.markdown +++ /dev/null @@ -1,51 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_app_installation_repository" -description: |- - Manages the associations between app installations and repositories. ---- - -# github_app_installation_repository - -~> **Note**: This resource is not compatible with the GitHub App Installation authentication method. - -This resource manages relationships between app installations and repositories -in your GitHub organization or your user account. - -Creating this resource installs a particular app on a particular repository. - -The app installation and the repository must both belong to the same -organization or user account on GitHub. Note: you can review your organization's installations -by the following the instructions at this -[link](https://docs.github.com/en/github/setting-up-and-managing-organizations-and-teams/reviewing-your-organizations-installed-integrations) or for your user account at this [link](https://docs.github.com/en/apps/using-github-apps/reviewing-and-modifying-installed-github-apps). - -## Example Usage - -```hcl -# Create a repository. -resource "github_repository" "some_repo" { - name = "some-repo" -} - -resource "github_app_installation_repository" "some_app_repo" { - # The installation id of the app (in the organization). - installation_id = "1234567" - repository = "${github_repository.some_repo.name}" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `installation_id` - (Required) The GitHub app installation id. -* `repository` - (Required) The repository to install the app on. - -## Import - -GitHub App Installation Repository can be imported -using an ID made up of `installation_id:repository`, e.g. - -``` -$ terraform import github_app_installation_repository.terraform_repo 1234567:terraform -``` diff --git a/website/docs/r/codespaces_secret.html.markdown b/website/docs/r/codespaces_secret.html.markdown deleted file mode 100644 index 4af0608ec7..0000000000 --- a/website/docs/r/codespaces_secret.html.markdown +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_codespaces_secret" -description: |- - Creates and manages an Codespaces Secret within a GitHub repository ---- - -# github_codespaces_secret - -This resource allows you to create and manage GitHub Codespaces secrets within your GitHub repositories. -You must have write access to a repository to use this resource. - -Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is -interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. - -For the purposes of security, the contents of the `plaintext_value` field have been marked as `sensitive` to Terraform, -but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. -It is also advised that you do not store plaintext values in your code but rather populate the `encrypted_value` -using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible -in your code. See below for an example of this abstraction. - -## Example Usage - -```hcl -data "github_codespaces_public_key" "example_public_key" { - repository = "example_repository" -} - -resource "github_codespaces_secret" "example_secret" { - repository = "example_repository" - secret_name = "example_secret_name" - plaintext_value = var.some_secret_string -} - -resource "github_codespaces_secret" "example_secret" { - repository = "example_repository" - secret_name = "example_secret_name" - encrypted_value = var.some_encrypted_secret_string -} -``` - -## Argument Reference - -The following arguments are supported: - -* `repository` - (Required) Name of the repository -* `secret_name` - (Required) Name of the secret -* `encrypted_value` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format. -* `plaintext_value` - (Optional) Plaintext value of the secret to be encrypted - -## Attributes Reference - -* `created_at` - Date of codespaces_secret creation. -* `updated_at` - Date of codespaces_secret update. - -## Import - -This resource can be imported using an ID made up of the `repository` and `secret_name`: - -``` -$ terraform import github_codespaces_secret.example_secret example_repository/example_secret_name -``` - -NOTE: the implementation is limited in that it won't fetch the value of the -`plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. diff --git a/website/docs/r/codespaces_user_secret.html.markdown b/website/docs/r/codespaces_user_secret.html.markdown deleted file mode 100644 index c3838b382d..0000000000 --- a/website/docs/r/codespaces_user_secret.html.markdown +++ /dev/null @@ -1,65 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_codespaces_user_secret" -description: |- - Creates and manages an Codespaces Secret within a GitHub user ---- - -# github_codespaces_user_secret - -This resource allows you to create and manage GitHub Codespaces secrets within your GitHub user. -You must have write access to a repository to use this resource. - -Secret values are encrypted using the [Go '/crypto/box' module](https://godoc.org/golang.org/x/crypto/nacl/box) which is -interoperable with [libsodium](https://libsodium.gitbook.io/doc/). Libsodium is used by GitHub to decrypt secret values. - -For the purposes of security, the contents of the `plaintext_value` field have been marked as `sensitive` to Terraform, -but it is important to note that **this does not hide it from state files**. You should treat state as sensitive always. -It is also advised that you do not store plaintext values in your code but rather populate the `encrypted_value` -using fields from a resource, data source or variable as, while encrypted in state, these will be easily accessible -in your code. See below for an example of this abstraction. - -## Example Usage - -```hcl -data "github_repository" "repo" { - full_name = "my-org/repo" -} - -resource "github_codespaces_user_secret" "example_secret" { - secret_name = "example_secret_name" - plaintext_value = var.some_secret_string - selected_repository_ids = [data.github_repository.repo.repo_id] -} - -resource "github_codespaces_user_secret" "example_secret" { - secret_name = "example_secret_name" - encrypted_value = var.some_encrypted_secret_string - selected_repository_ids = [data.github_repository.repo.repo_id] -} -``` - -## Argument Reference - -The following arguments are supported: - -* `secret_name` - (Required) Name of the secret -* `encrypted_value` - (Optional) Encrypted value of the secret using the GitHub public key in Base64 format. -* `plaintext_value` - (Optional) Plaintext value of the secret to be encrypted -* `selected_repository_ids` - (Optional) An array of repository ids that can access the user secret. - -## Attributes Reference - -* `created_at` - Date of codespaces_secret creation. -* `updated_at` - Date of codespaces_secret update. - -## Import - -This resource can be imported using an ID made up of the secret name: - -``` -terraform import github_codespaces_user_secret.test_secret test_secret_name -``` - -NOTE: the implementation is limited in that it won't fetch the value of the -`plaintext_value` or `encrypted_value` fields when importing. You may need to ignore changes for these as a workaround. diff --git a/website/docs/r/membership.html.markdown b/website/docs/r/membership.html.markdown deleted file mode 100644 index 898431cf10..0000000000 --- a/website/docs/r/membership.html.markdown +++ /dev/null @@ -1,46 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_membership" -description: |- - Provides a GitHub membership resource. ---- - -# github_membership - -Provides a GitHub membership resource. - -This resource allows you to add/remove users from your organization. When applied, -an invitation will be sent to the user to become part of the organization. When -destroyed, either the invitation will be cancelled or the user will be removed. - -## Example Usage - -```hcl -# Add a user to the organization -resource "github_membership" "membership_for_some_user" { - username = "SomeUser" - role = "member" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `username` - (Required) The user to add to the organization. -* `role` - (Optional) The role of the user within the organization. - Must be one of `member` or `admin`. Defaults to `member`. - `admin` role represents the `owner` role available via GitHub UI. -* `downgrade_on_destroy` - (Optional) Defaults to `false`. If set to true, - when this resource is destroyed, the member will not be removed - from the organization. Instead, the member's role will be - downgraded to 'member'. - - -## Import - -GitHub Membership can be imported using an ID made up of `organization:username`, e.g. - -``` -$ terraform import github_membership.member hashicorp:someuser -``` diff --git a/website/docs/r/organization_settings.html.markdown b/website/docs/r/organization_settings.html.markdown deleted file mode 100644 index c8a4db54a6..0000000000 --- a/website/docs/r/organization_settings.html.markdown +++ /dev/null @@ -1,91 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_organization_settings" -description: |- - Creates and manages settings for a GitHub Organization. ---- - -# github_organization_settings - -This resource allows you to create and manage settings for a GitHub Organization. - -## Example Usage - -```hcl -resource "github_organization_settings" "test" { - billing_email = "test@example.com" - company = "Test Company" - blog = "https://example.com" - email = "test@example.com" - twitter_username = "Test" - location = "Test Location" - name = "Test Name" - description = "Test Description" - has_organization_projects = true - has_repository_projects = true - default_repository_permission = "read" - members_can_create_repositories = true - members_can_create_public_repositories = true - members_can_create_private_repositories = true - members_can_create_internal_repositories = true - members_can_create_pages = true - members_can_create_public_pages = true - members_can_create_private_pages = true - members_can_fork_private_repositories = true - web_commit_signoff_required = true - advanced_security_enabled_for_new_repositories = false - dependabot_alerts_enabled_for_new_repositories= false - dependabot_security_updates_enabled_for_new_repositories = false - dependency_graph_enabled_for_new_repositories = false - secret_scanning_enabled_for_new_repositories = false - secret_scanning_push_protection_enabled_for_new_repositories = false -} -``` - -## Argument Reference - -The following arguments are supported: - -* `billing_email` - (Required) The billing email address for the organization. -* `company` - (Optional) The company name for the organization. -* `blog` - (Optional) The blog URL for the organization. -* `email` - (Optional) The email address for the organization. -* `twitter_username` - (Optional) The Twitter username for the organization. -* `location` - (Optional) The location for the organization. -* `name` - (Optional) The name for the organization. -* `description` - (Optional) The description for the organization. -* `has_organization_projects` - (Optional) Whether or not organization projects are enabled for the organization. -* `has_repository_projects` - (Optional) Whether or not repository projects are enabled for the organization. -* `default_repository_permission` - (Optional) The default permission for organization members to create new repositories. Can be one of `read`, `write`, `admin`, or `none`. Defaults to `read`. -* `members_can_create_repositories` - (Optional) Whether or not organization members can create new repositories. Defaults to `true`. -* `members_can_create_public_repositories` - (Optional) Whether or not organization members can create new public repositories. Defaults to `true`. -* `members_can_create_private_repositories` - (Optional) Whether or not organization members can create new private repositories. Defaults to `true`. -* `members_can_create_internal_repositories` - (Optional) Whether or not organization members can create new internal repositories. For Enterprise Organizations only. -* `members_can_create_pages` - (Optional) Whether or not organization members can create new pages. Defaults to `true`. -* `members_can_create_public_pages` - (Optional) Whether or not organization members can create new public pages. Defaults to `true`. -* `members_can_create_private_pages` - (Optional) Whether or not organization members can create new private pages. Defaults to `true`. -* `members_can_fork_private_repositories` - (Optional) Whether or not organization members can fork private repositories. Defaults to `false`. -* `web_commit_signoff_required` - (Optional) Whether or not commit signatures are required for commits to the organization. Defaults to `false`. -* `advanced_security_enabled_for_new_repositories` - (Optional) Whether or not advanced security is enabled for new repositories. Defaults to `false`. -* `dependabot_alerts_enabled_for_new_repositories` - (Optional) Whether or not dependabot alerts are enabled for new repositories. Defaults to `false`. -* `dependabot_security_updates_enabled_for_new_repositories` - (Optional) Whether or not dependabot security updates are enabled for new repositories. Defaults to `false`. -* `dependency_graph_enabled_for_new_repositories` - (Optional) Whether or not dependency graph is enabled for new repositories. Defaults to `false`. -* `secret_scanning_enabled_for_new_repositories` - (Optional) Whether or not secret scanning is enabled for new repositories. Defaults to `false`. -* `secret_scanning_push_protection_enabled_for_new_repositories` - (Optional) Whether or not secret scanning push protection is enabled for new repositories. Defaults to `false`. - - -## Attributes Reference - -The following additional attributes are exported: - -* `id` - The ID of the organization settings. - - -## Import - -Organization settings can be imported using the `id` of the organization. -The `id` of the organization can be found using the [get an organization](https://docs.github.com/en/rest/orgs/orgs#get-an-organization) API. - -``` -$ terraform import github_organization_settings.test 123456789 -``` diff --git a/website/docs/r/repository_dependabot_security_updates.html.markdown b/website/docs/r/repository_dependabot_security_updates.html.markdown deleted file mode 100644 index 0a029929c1..0000000000 --- a/website/docs/r/repository_dependabot_security_updates.html.markdown +++ /dev/null @@ -1,49 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_repository_dependabot_security_updates" -description: |- - Manages automated security fixes for a single repository ---- - -# github_repository_dependabot_security_updates - -This resource allows you to manage dependabot automated security fixes for a single repository. See the -[documentation](https://docs.github.com/en/code-security/dependabot/dependabot-security-updates/about-dependabot-security-updates) -for details of usage and how this will impact your repository - -## Example Usage - -```hcl -resource "github_repository" "repo" { - name = "my-repo" - description = "GitHub repo managed by Terraform" - - private = false - - vulnerability_alerts = true -} - - -resource "github_repository_dependabot_security_updates" "example" { - repository = github_repository.test.name - enabled = true -} -``` - -## Argument Reference - -The following arguments are supported: - -* `repository` - (Required) The name of the GitHub repository. - -* `enabled` - (Required) The state of the automated security fixes. - -## Import - -Automated security references can be imported using the `name` of the repository - -### Import by name - -```sh -terraform import github_repository_dependabot_security_updates.example my-repo -``` diff --git a/website/docs/r/repository_pull_request.html.markdown b/website/docs/r/repository_pull_request.html.markdown deleted file mode 100644 index 24ccca034c..0000000000 --- a/website/docs/r/repository_pull_request.html.markdown +++ /dev/null @@ -1,58 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: repository_pull_request" -description: |- - Get information on a single GitHub Pull Request. ---- - -# github_repository_pull_request - -This resource allows you to create and manage PullRequests for repositories within your GitHub organization or personal account. - -## Example Usage - -```hcl -resource "github_repository_pull_request" "example" { - base_repository = "example-repository" - base_ref = "main" - head_ref = "feature-branch" - title = "My newest feature" - body = "This will change everything" -} -``` - -## Argument Reference - -* `base_repository` - (Required) Name of the base repository to retrieve the Pull Requests from. - -* `base_ref` - (Required) Name of the branch serving as the base of the Pull Request. - -* `head_ref` - (Required) Name of the branch serving as the head of the Pull Request. - -* `owner` - (Optional) Owner of the repository. If not provided, the provider's default owner is used. - -* `title` - (Optional) The title of the Pull Request. - -* `body` - (Optional) Body of the Pull Request. - -* `maintainer_can_modify` - Controls whether the base repository maintainers can modify the Pull Request. Default: false. - -## Attributes Reference - -* `base_sha` - Head commit SHA of the Pull Request base. - -* `draft` - Indicates Whether this Pull Request is a draft. - -* `head_sha` - Head commit SHA of the Pull Request head. - -* `labels` - List of label names set on the Pull Request. - -* `number` - The number of the Pull Request within the repository. - -* `opened_at` - Unix timestamp indicating the Pull Request creation time. - -* `opened_by` - GitHub login of the user who opened the Pull Request. - -* `state` - the current Pull Request state - can be "open", "closed" or "merged". - -* `updated_at` - The timestamp of the last Pull Request update. diff --git a/website/docs/r/repository_topics.html.markdown b/website/docs/r/repository_topics.html.markdown deleted file mode 100644 index 57b2c28ccf..0000000000 --- a/website/docs/r/repository_topics.html.markdown +++ /dev/null @@ -1,42 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_repository_topics" -description: |- - Creates and manages the topics on a repository ---- - -# github_repository_topics - -This resource allows you to create and manage topics for repositories within your GitHub organization or personal account. - -~> Note: This resource is not compatible with the `topic` attribute of the `github_repository` Use either ``github_repository_topics`` -or ``topic`` in ``github_repository``. `github_repository_topics` is only meant to be used if the repository itself is not handled via terraform, for example if it's only read as a datasource (see [issue #1845](https://github.com/integrations/terraform-provider-github/issues/1845)). - -## Example Usage - -```hcl -data "github_repository" "test" { - name = "test" -} - -resource "github_repository_topics" "test" { - repository = github_repository.test.name - topics = ["topic-1", "topic-2"] -} -``` - -## Argument Reference - -The following arguments are supported: - -* `repository` - (Required) The repository name. - -* `topics` - (Required) A list of topics to add to the repository. - -## Import - -Repository topics can be imported using the `name` of the repository. - -``` -$ terraform import github_repository_topics.terraform terraform -``` diff --git a/website/docs/r/team.html.markdown b/website/docs/r/team.html.markdown deleted file mode 100644 index baa295ee56..0000000000 --- a/website/docs/r/team.html.markdown +++ /dev/null @@ -1,55 +0,0 @@ ---- -layout: "github" -page_title: "GitHub: github_team" -description: |- - Provides a GitHub team resource. ---- - -# github_team - -Provides a GitHub team resource. - -This resource allows you to add/remove teams from your organization. When applied, -a new team will be created. When destroyed, that team will be removed. - -## Example Usage - -```hcl -# Add a team to the organization -resource "github_team" "some_team" { - name = "some-team" - description = "Some cool team" - privacy = "closed" -} -``` - -## Argument Reference - -The following arguments are supported: - -* `name` - (Required) The name of the team. -* `description` - (Optional) A description of the team. -* `privacy` - (Optional) The level of privacy for the team. Must be one of `secret` _(default)_ or `closed`. -* `notification_setting` - (Optional) The notification setting for the team. Must be one of `notifications_enabled` _(default)_ or `notifications_disabled`. -* `parent_team_id` - (Optional) The ID or slug of the parent team, if this is a nested team. -* `ldap_dn` - (Optional) The LDAP Distinguished Name of the group where membership will be synchronized. Only available in GitHub Enterprise Server. -* `create_default_maintainer` - (**DEPRECATED**) (Optional) Adds a default maintainer to the team. Defaults to `false` and adds the creating user to the team when `true`. - -## Attributes Reference - -The following attributes are exported: - -* `id` - The ID of the created team. -* `node_id` - The Node ID of the created team. -* `slug` - The slug of the created team, which may or may not differ from `name`, - depending on whether `name` contains "URL-unsafe" characters. - Useful when referencing the team in [`github_branch_protection`](/docs/providers/github/r/branch_protection.html). - -## Import - -GitHub Teams can be imported using the GitHub team ID or name e.g. - -```shell -terraform import github_team.core 1234567 -terraform import github_team.core Administrators -``` diff --git a/website/github.erb b/website/github.erb deleted file mode 100644 index 997536b42f..0000000000 --- a/website/github.erb +++ /dev/null @@ -1,461 +0,0 @@ -<% wrap_layout :inner do %> - <% content_for :sidebar do %> - - <% end %> - - <%= yield %> - <% end %>