Skip to content

Commit c43f69e

Browse files
committed
Update docs to use generated content
Signed-off-by: Timo Sand <timo.sand@f-secure.com>
1 parent 53f842f commit c43f69e

7 files changed

Lines changed: 169 additions & 326 deletions

File tree

RESOURCES.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ The overall status of each resource or data source is captured in this document
179179
| `github_project_card` (🚫) ||||||||
180180
| `github_project_column` (🚫) ||||||||
181181
| `github_release` ||||||||
182-
| `github_repository` | | | | | | | |
182+
| `github_repository` | ⚠️ | | | | | | |
183183
| `github_repository_autolink_reference` ||||||||
184184
| `github_repository_collaborator` ||||||||
185185
| `github_repository_collaborators` ||||||||

docs/resources/repository.md

Lines changed: 123 additions & 134 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
terraform import github_repository.terraform myrepo
File renamed without changes.
File renamed without changes.

github/resource_github_repository.go

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ func resourceGithubRepository() *schema.Resource {
3535
},
3636
},
3737

38+
Description: "This resource allows you to create and manage repositories within your GitHub organization or personal account.",
39+
3840
Schema: map[string]*schema.Schema{
3941
"name": {
4042
Type: schema.TypeString,
@@ -58,6 +60,7 @@ func resourceGithubRepository() *schema.Resource {
5860
Optional: true,
5961
ConflictsWith: []string{"visibility"},
6062
Deprecated: "use visibility instead",
63+
Description: "Set to `true` to create a private repository. Repositories are created as public (e.g. open source) by default. Use `visibility` instead.",
6164
},
6265
"visibility": {
6366
Type: schema.TypeString,
@@ -405,10 +408,11 @@ func resourceGithubRepository() *schema.Resource {
405408
Deprecated: "Use the github_repository_vulnerability_alerts resource instead. This field will be removed in a future version.",
406409
},
407410
"ignore_vulnerability_alerts_during_read": {
408-
Type: schema.TypeBool,
409-
Optional: true,
410-
Default: false,
411-
Deprecated: "This is ignored as the provider now handles lack of permissions automatically. This field will be removed in a future version.",
411+
Type: schema.TypeBool,
412+
Optional: true,
413+
Default: false,
414+
Deprecated: "This is ignored as the provider now handles lack of permissions automatically. This field will be removed in a future version.",
415+
Description: "This is ignored as the provider now handles lack of permissions automatically. This field will be removed in a future version.",
412416
},
413417
"full_name": {
414418
Type: schema.TypeString,
@@ -448,16 +452,18 @@ func resourceGithubRepository() *schema.Resource {
448452
return true
449453
},
450454
DiffSuppressOnRefresh: true,
455+
Description: "An etag representing the repository object.",
451456
},
452457
"primary_language": {
453-
Type: schema.TypeString,
454-
Computed: true,
458+
Type: schema.TypeString,
459+
Computed: true,
460+
Description: "The primary language of the repository. This is the language with the largest number of bytes of code, as determined by GitHub's linguist library.",
455461
},
456462
"template": {
457463
Type: schema.TypeList,
458464
Optional: true,
459465
MaxItems: 1,
460-
Description: "Use a template repository to create this resource.",
466+
Description: "Use a template repository to create this resource.\n\n\t~> **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.",
461467
Elem: &schema.Resource{
462468
Schema: map[string]*schema.Schema{
463469
"include_all_branches": {
Lines changed: 31 additions & 184 deletions
Original file line numberDiff line numberDiff line change
@@ -1,209 +1,56 @@
11
---
22
page_title: "{{.Name}} ({{.Type}}) - {{.RenderedProviderName}}"
3+
subcategory: ""
34
description: |-
4-
Creates and manages repositories within GitHub organizations or personal accounts
5+
{{ .Description | plainmarkdown | trimspace | prefixlines " " }}
56
---
67

78
# {{.Name}} ({{.Type}})
89

9-
This resource allows you to create and manage repositories within your GitHub organization or personal account.
10+
{{ .Description | trimspace }}
1011

1112
~> **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`.
1213

14+
{{ if .HasExamples -}}
1315
## Example Usage
1416

15-
{{ tffile "examples/resources/repository/example_1.tf" }}
17+
{{- range .ExampleFiles }}
1618

17-
## Example Usage with Repository Forking
19+
{{- $parts := split . "resource_" -}}
20+
{{- $lastItem := index $parts 1 }}
21+
{{- $fileNameParts := split $lastItem "." }}
22+
{{- $fileName := index $fileNameParts 0 }}
1823

19-
{{ tffile "examples/resources/repository/example_2.tf" }}
24+
### {{ $fileName | title }}
2025

21-
## Argument Reference
26+
{{ tffile . }}
27+
{{- end }}
28+
{{- end }}
2229

23-
The following arguments are supported:
30+
{{ .SchemaMarkdown | trimspace }}
31+
{{- if or .HasImport .HasImportIDConfig .HasImportIdentityConfig }}
2432

25-
- `name` - (Required) The name of the repository.
26-
27-
- `description` - (Optional) A description of the repository.
28-
29-
- `homepage_url` - (Optional) URL of a page describing the project.
30-
31-
- `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.
32-
33-
- `source_owner` - (Optional) The GitHub username or organization that owns the repository being forked. Required when `fork` is `true`.
34-
35-
- `source_repo` - (Optional) The name of the repository to fork. Required when `fork` is `true`.
36-
37-
- `private` - (**DEPRECATED**) (Optional) Set to `true` to create a private repository. Repositories are created as public (e.g. open source) by default. Use `visibility` instead.
38-
39-
- `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.
40-
41-
- `has_issues` - (Optional) Set to `true` to enable the GitHub Issues features on the repository.
42-
43-
- `has_discussions` - (Optional) Set to `true` to enable GitHub Discussions on the repository. Defaults to `false`.
44-
45-
- `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.
46-
47-
- `has_wiki` - (Optional) Set to `true` to enable the GitHub Wiki features on the repository.
48-
49-
- `is_template` - (Optional) Set to `true` to tell GitHub that this is a template repository.
50-
51-
- `allow_merge_commit` - (Optional) Set to `false` to disable merge commits on the repository.
52-
53-
- `allow_squash_merge` - (Optional) Set to `false` to disable squash merges on the repository.
54-
55-
- `allow_rebase_merge` - (Optional) Set to `false` to disable rebase merges on the repository.
56-
57-
- `allow_auto_merge` - (Optional) Set to `true` to allow auto-merging pull requests on the repository.
58-
59-
- `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.
60-
61-
- `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`.
62-
63-
- `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`.
64-
65-
- `merge_commit_title` - (Optional) Can be `PR_TITLE` or `MERGE_MESSAGE` for a default merge commit title. Applicable only if `allow_merge_commit` is `true`.
66-
67-
- `merge_commit_message` - (Optional) Can be `PR_BODY`, `PR_TITLE`, or `BLANK` for a default merge commit message. Applicable only if `allow_merge_commit` is `true`.
68-
69-
- `delete_branch_on_merge` - (Optional) Automatically delete head branch after a pull request is merged. Defaults to `false`.
70-
71-
- `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).
72-
73-
- `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).
74-
75-
- `auto_init` - (Optional) Set to `true` to produce an initial commit in the repository.
76-
77-
- `gitignore_template` - (Optional) Use the [name of the template](https://github.com/github/gitignore) without the extension. For example, "Haskell".
78-
79-
- `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".
80-
81-
- `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.
82-
83-
- `archived` - (Optional) Specifies if the repository should be archived. Defaults to `false`. **NOTE** Currently, the API does not support unarchiving.
84-
85-
- `archive_on_destroy` - (Optional) Set to `true` to archive the repository instead of deleting on destroy.
86-
87-
- `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.
88-
89-
- `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.
90-
91-
- `topics` - (Optional) The list of topics of the repository.
92-
93-
~> 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)).
94-
95-
- `template` - (Optional) Use a template repository to create this resource. See [Template Repositories](#template-repositories) below for details.
96-
97-
- `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.
98-
99-
- `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.
100-
101-
- `allow_update_branch` (Optional) - Set to `true` to always suggest updating pull request branches.
102-
103-
### GitHub Pages Configuration
104-
105-
The `pages` block supports the following:
106-
107-
- `source` - (Optional) The source branch and directory for the rendered Pages site. See [GitHub Pages Source](#github-pages-source) below for details.
108-
109-
- `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`.
110-
111-
- `cname` - (Optional) The custom domain for the repository. This can only be set after the repository has been created.
112-
113-
#### GitHub Pages Source
114-
115-
The `source` block supports the following:
116-
117-
- `branch` - (Required) The repository branch used to publish the site's source files. (i.e. `main` or `gh-pages`.
118-
119-
- `path` - (Optional) The repository directory from which the site publishes (Default: `/`).
120-
121-
### Security and Analysis Configuration
122-
123-
The `security_and_analysis` block supports the following:
124-
125-
- `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.
126-
127-
- `code_security` - (Optional) The code security configuration for the repository. See [Code Security](#code-security-configuration) below for details.
128-
129-
- `secret_scanning` - (Optional) The secret scanning configuration for the repository. See [Secret Scanning Configuration](#secret-scanning-configuration) below for details.
130-
131-
- `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.
132-
133-
- `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.
134-
135-
- `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.
136-
137-
#### Advanced Security Configuration
138-
139-
The `advanced_security` block supports the following:
140-
141-
- `status` - (Required) Set to `enabled` to enable advanced security features on the repository. Can be `enabled` or `disabled`.
142-
143-
#### Code Security Configuration
144-
145-
- `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.
146-
147-
#### Secret Scanning Configuration
148-
149-
- `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.
150-
151-
#### Secret Scanning Push Protection Configuration
152-
153-
- `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.
154-
155-
#### Secret Scanning AI Detection
156-
157-
- `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.
158-
159-
#### Secret Scanning Non-Provider Patterns
160-
161-
- `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.
162-
163-
### Template Repositories
164-
165-
`template` supports the following arguments:
166-
167-
- `owner`: The GitHub organization or user the template repository is owned by.
168-
- `repository`: The name of the template repository.
169-
- `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).
170-
171-
~> **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.
172-
173-
## Attributes Reference
174-
175-
The following additional attributes are exported:
176-
177-
- `full_name` - A string of the form "repo_owner/reponame".
178-
179-
- `html_url` - URL to the repository on the web.
180-
181-
- `ssh_clone_url` - URL that can be provided to `git clone` to clone the repository via SSH.
182-
183-
- `http_clone_url` - URL that can be provided to `git clone` to clone the repository via HTTPS.
184-
185-
- `git_clone_url` - URL that can be provided to `git clone` to clone the repository anonymously via the git protocol.
186-
187-
- `svn_url` - URL that can be provided to `svn checkout` to check out the repository via GitHub's Subversion protocol emulation.
33+
## Import
18834

189-
- `node_id` - GraphQL global node id for use with v4 API
35+
Import is supported using the following syntax:
36+
{{- end }}
37+
{{- if .HasImportIdentityConfig }}
19038

191-
- `repo_id` - GitHub ID for the repository
39+
In Terraform v1.12.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `identity` attribute, for example:
19240

193-
- `primary_language` - The primary language used in the repository.
41+
{{tffile .ImportIdentityConfigFile }}
19442

195-
- `etag` - An etag representing the repository object.
43+
{{ .IdentitySchemaMarkdown | trimspace }}
44+
{{- end }}
45+
{{- if .HasImportIDConfig }}
19646

197-
- `pages` - The block consisting of the repository's GitHub Pages configuration.
198-
- `custom_404` - Whether the rendered GitHub Pages site has a custom 404 page.
199-
- `html_url` - The absolute URL (including scheme) of the rendered GitHub Pages site e.g. `https://username.github.io`.
200-
- `status` - The Pages build status of the latest build e.g. `building`, `built` `errored`.
201-
- `url` - The API address for accessing this Page resource.
47+
In Terraform v1.5.0 and later, the [`import` block](https://developer.hashicorp.com/terraform/language/import) can be used with the `id` attribute, for example:
20248

203-
## Import
49+
{{tffile .ImportIDConfigFile }}
50+
{{- end }}
51+
{{- if .HasImport }}
20452

205-
Repositories can be imported using the `name`, e.g.
53+
The [`terraform import` command](https://developer.hashicorp.com/terraform/cli/commands/import) can be used, for example:
20654

207-
```shell
208-
terraform import github_repository.terraform myrepo
209-
```
55+
{{codefile "shell" .ImportFile }}
56+
{{- end }}

0 commit comments

Comments
 (0)