Skip to content

Commit 3a5ec85

Browse files
committed
Improve docs of importing github_repository_file
Signed-off-by: Timo Sand <[email protected]>
1 parent 64cb030 commit 3a5ec85

1 file changed

Lines changed: 21 additions & 27 deletions

File tree

website/docs/r/repository_file.html.markdown

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ GitHub repository.
1515
## Example Usage
1616

1717
### Existing Branch
18+
1819
```hcl
1920
2021
resource "github_repository" "foo" {
21-
name = "tf-acc-test-%s"
22+
name = "example"
2223
auto_init = true
2324
}
2425
@@ -36,10 +37,11 @@ resource "github_repository_file" "foo" {
3637
```
3738

3839
### Auto Created Branch
40+
3941
```hcl
4042
4143
resource "github_repository" "foo" {
42-
name = "tf-acc-test-%s"
44+
name = "example"
4345
auto_init = true
4446
}
4547
@@ -57,55 +59,47 @@ resource "github_repository_file" "foo" {
5759
5860
```
5961

60-
6162
## Argument Reference
6263

6364
The following arguments are supported:
6465

65-
* `repository` - (Required) The repository to create the file in.
66+
- `repository` - (Required) The repository to create the file in.
6667

67-
* `file` - (Required) The path of the file to manage.
68+
- `file` - (Required) The path of the file to manage.
6869

69-
* `content` - (Required) The file content.
70+
- `content` - (Required) The file content.
7071

71-
* `branch` - (Optional) Git branch (defaults to the repository's default branch).
72+
- `branch` - (Optional) Git branch (defaults to the repository's default branch).
7273
The branch must already exist, it will only be created automatically if 'autocreate_branch' is set true.
7374

74-
* `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.
75+
- `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.
7576

76-
* `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.
77+
- `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.
7778

78-
* `commit_message` - (Optional) The commit message when creating, updating or deleting the managed file.
79+
- `commit_message` - (Optional) The commit message when creating, updating or deleting the managed file.
7980

80-
* `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.
81+
- `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.
8182

82-
* `autocreate_branch` - (Optional) 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'.
83+
- `autocreate_branch` - (Optional) 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'.
8384

84-
* `autocreate_branch_source_branch` - (Optional) The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
85+
- `autocreate_branch_source_branch` - (Optional) The branch name to start from, if 'autocreate_branch' is set. Defaults to 'main'.
8586

86-
* `autocreate_branch_source_sha` - (Optional) 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.
87+
- `autocreate_branch_source_sha` - (Optional) 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.
8788

8889
## Attributes Reference
8990

9091
The following additional attributes are exported:
9192

92-
* `commit_sha` - The SHA of the commit that modified the file.
93+
- `commit_sha` - The SHA of the commit that modified the file.
9394

94-
* `sha` - The SHA blob of the file.
95-
96-
* `ref` - The name of the commit/branch/tag.
95+
- `sha` - The SHA blob of the file.
9796

97+
- `ref` - The name of the commit/branch/tag.
9898

9999
## Import
100100

101-
Repository files can be imported using a combination of the `repo` and `file`, e.g.
101+
Repository files can be imported using a combination of the `repo`, `file` and `branch`, e.g.
102102

103-
```
104-
$ terraform import github_repository_file.gitignore example/.gitignore
105-
```
106-
107-
To import a file from a branch other than the default branch, append `:` and the branch name, e.g.
108-
109-
```
110-
$ terraform import github_repository_file.gitignore example/.gitignore:dev
103+
```sh
104+
terraform import github_repository_file.gitignore example/.gitignore:main
111105
```

0 commit comments

Comments
 (0)