Skip to content

Commit 452aba9

Browse files
committed
datasource/gitlab_project: Add many missing attributes
1 parent e6e3922 commit 452aba9

File tree

2 files changed

+210
-0
lines changed

2 files changed

+210
-0
lines changed

docs/data-sources/project.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,33 +32,74 @@ data "gitlab_project" "example" {
3232

3333
- **id** (String) The integer or path with namespace that uniquely identifies the project within the gitlab install.
3434
- **path_with_namespace** (String) The path of the repository with namespace.
35+
- **public_builds** (Boolean) If true, jobs can be viewed by non-project members.
3536

3637
### Read-Only
3738

39+
- **analytics_access_level** (String) Set the analytics access level. Valid values are `disabled`, `private`, `enabled`.
3840
- **archived** (Boolean) Whether the project is in read-only mode (archived).
41+
- **auto_cancel_pending_pipelines** (String) Auto-cancel pending pipelines. This isn’t a boolean, but enabled/disabled.
42+
- **auto_devops_deploy_strategy** (String) Auto Deploy strategy. Valid values are `continuous`, `manual`, `timed_incremental`.
43+
- **auto_devops_enabled** (Boolean) Enable Auto DevOps for this project.
44+
- **autoclose_referenced_issues** (Boolean) Set whether auto-closing referenced issues on default branch.
45+
- **build_git_strategy** (String) The Git strategy. Defaults to fetch.
46+
- **build_timeout** (Number) The maximum amount of time, in seconds, that a job can run.
47+
- **builds_access_level** (String) Set the builds access level. Valid values are `disabled`, `private`, `enabled`.
48+
- **container_expiration_policy** (List of Object) Set the image cleanup policy for this project. **Note**: this field is sometimes named `container_expiration_policy_attributes` in the GitLab Upstream API. (see [below for nested schema](#nestedatt--container_expiration_policy))
49+
- **container_registry_access_level** (String) Set visibility of container registry, for this project. Valid values are `disabled`, `private`, `enabled`.
3950
- **default_branch** (String) The default branch for the project.
4051
- **description** (String) A description of the project.
52+
- **emails_disabled** (Boolean) Disable email notifications.
53+
- **external_authorization_classification_label** (String) The classification label for the project.
54+
- **forking_access_level** (String) Set the forking access level. Valid values are `disabled`, `private`, `enabled`.
4155
- **http_url_to_repo** (String) URL that can be provided to `git clone` to clone the
56+
- **issues_access_level** (String) Set the issues access level. Valid values are `disabled`, `private`, `enabled`.
4257
- **issues_enabled** (Boolean) Enable issue tracking for the project.
4358
- **lfs_enabled** (Boolean) Enable LFS for the project.
59+
- **merge_commit_template** (String) Template used to create merge commit message in merge requests. (Introduced in GitLab 14.5.)
4460
- **merge_pipelines_enabled** (Boolean) Enable or disable merge pipelines.
61+
- **merge_requests_access_level** (String) Set the merge requests access level. Valid values are `disabled`, `private`, `enabled`.
4562
- **merge_requests_enabled** (Boolean) Enable merge requests for the project.
4663
- **merge_trains_enabled** (Boolean) Enable or disable merge trains.
4764
- **name** (String) The name of the project.
4865
- **namespace_id** (Number) The namespace (group or user) of the project. Defaults to your user.
66+
- **operations_access_level** (String) Set the operations access level. Valid values are `disabled`, `private`, `enabled`.
4967
- **path** (String) The path of the repository.
5068
- **pipelines_enabled** (Boolean) Enable pipelines for the project.
5169
- **printing_merge_request_link_enabled** (Boolean) Show link to create/view merge request when pushing from the command line
5270
- **push_rules** (List of Object) Push rules for the project. (see [below for nested schema](#nestedatt--push_rules))
5371
- **remove_source_branch_after_merge** (Boolean) Enable `Delete source branch` option by default for all new merge requests
72+
- **repository_access_level** (String) Set the repository access level. Valid values are `disabled`, `private`, `enabled`.
73+
- **repository_storage** (String) Which storage shard the repository is on. (administrator only)
5474
- **request_access_enabled** (Boolean) Allow users to request member access.
75+
- **requirements_access_level** (String) Set the requirements access level. Valid values are `disabled`, `private`, `enabled`.
76+
- **resolve_outdated_diff_discussions** (Boolean) Automatically resolve merge request diffs discussions on lines changed with a push.
5577
- **runners_token** (String) Registration token to use during runner setup.
78+
- **security_and_compliance_access_level** (String) Set the security and compliance access level. Valid values are `disabled`, `private`, `enabled`.
79+
- **snippets_access_level** (String) Set the snippets access level. Valid values are `disabled`, `private`, `enabled`.
5680
- **snippets_enabled** (Boolean) Enable snippets for the project.
81+
- **squash_commit_template** (String) Template used to create squash commit message in merge requests. (Introduced in GitLab 14.6.)
5782
- **ssh_url_to_repo** (String) URL that can be provided to `git clone` to clone the
83+
- **topics** (Set of String) The list of topics for the project.
5884
- **visibility_level** (String) Repositories are created as private by default.
5985
- **web_url** (String) URL that can be used to find the project in a browser.
86+
- **wiki_access_level** (String) Set the wiki access level. Valid values are `disabled`, `private`, `enabled`.
6087
- **wiki_enabled** (Boolean) Enable wiki for the project.
6188

89+
<a id="nestedatt--container_expiration_policy"></a>
90+
### Nested Schema for `container_expiration_policy`
91+
92+
Read-Only:
93+
94+
- **cadence** (String)
95+
- **enabled** (Boolean)
96+
- **keep_n** (Number)
97+
- **name_regex_delete** (String)
98+
- **name_regex_keep** (String)
99+
- **next_run_at** (String)
100+
- **older_than** (String)
101+
102+
62103
<a id="nestedatt--push_rules"></a>
63104
### Nested Schema for `push_rules`
64105

internal/provider/data_source_gitlab_project.go

Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,144 @@ var _ = registerDataSource("gitlab_project", func() *schema.Resource {
151151
Type: schema.TypeBool,
152152
Computed: true,
153153
},
154+
"resolve_outdated_diff_discussions": {
155+
Description: "Automatically resolve merge request diffs discussions on lines changed with a push.",
156+
Type: schema.TypeBool,
157+
Computed: true,
158+
},
159+
"analytics_access_level": {
160+
Description: fmt.Sprintf("Set the analytics access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
161+
Type: schema.TypeString,
162+
Computed: true,
163+
},
164+
"auto_cancel_pending_pipelines": {
165+
Description: "Auto-cancel pending pipelines. This isn’t a boolean, but enabled/disabled.",
166+
Type: schema.TypeString,
167+
Computed: true,
168+
},
169+
"auto_devops_deploy_strategy": {
170+
Description: fmt.Sprintf("Auto Deploy strategy. Valid values are %s.", renderValueListForDocs(validProjectAutoDevOpsDeployStrategyValues)),
171+
Type: schema.TypeString,
172+
Computed: true,
173+
},
174+
"auto_devops_enabled": {
175+
Description: "Enable Auto DevOps for this project.",
176+
Type: schema.TypeBool,
177+
Computed: true,
178+
},
179+
"autoclose_referenced_issues": {
180+
Description: "Set whether auto-closing referenced issues on default branch.",
181+
Type: schema.TypeBool,
182+
Computed: true,
183+
},
184+
"build_git_strategy": {
185+
Description: "The Git strategy. Defaults to fetch.",
186+
Type: schema.TypeString,
187+
Computed: true,
188+
},
189+
"build_timeout": {
190+
Description: "The maximum amount of time, in seconds, that a job can run.",
191+
Type: schema.TypeInt,
192+
Computed: true,
193+
},
194+
"builds_access_level": {
195+
Description: fmt.Sprintf("Set the builds access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
196+
Type: schema.TypeString,
197+
Computed: true,
198+
},
199+
"container_expiration_policy": {
200+
Description: "Set the image cleanup policy for this project. **Note**: this field is sometimes named `container_expiration_policy_attributes` in the GitLab Upstream API.",
201+
Type: schema.TypeList,
202+
Elem: containerExpirationPolicyAttributesSchema,
203+
Computed: true,
204+
},
205+
"container_registry_access_level": {
206+
Description: fmt.Sprintf("Set visibility of container registry, for this project. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
207+
Type: schema.TypeString,
208+
Computed: true,
209+
},
210+
"emails_disabled": {
211+
Description: "Disable email notifications.",
212+
Type: schema.TypeBool,
213+
Computed: true,
214+
},
215+
"external_authorization_classification_label": {
216+
Description: "The classification label for the project.",
217+
Type: schema.TypeString,
218+
Computed: true,
219+
},
220+
"forking_access_level": {
221+
Description: fmt.Sprintf("Set the forking access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
222+
Type: schema.TypeString,
223+
Computed: true,
224+
},
225+
"issues_access_level": {
226+
Description: fmt.Sprintf("Set the issues access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
227+
Type: schema.TypeString,
228+
Computed: true,
229+
},
230+
"merge_requests_access_level": {
231+
Description: fmt.Sprintf("Set the merge requests access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
232+
Type: schema.TypeString,
233+
Computed: true,
234+
},
235+
"operations_access_level": {
236+
Description: fmt.Sprintf("Set the operations access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
237+
Type: schema.TypeString,
238+
Computed: true,
239+
},
240+
"public_builds": {
241+
Description: "If true, jobs can be viewed by non-project members.",
242+
Type: schema.TypeBool,
243+
Optional: true,
244+
},
245+
"repository_access_level": {
246+
Description: fmt.Sprintf("Set the repository access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
247+
Type: schema.TypeString,
248+
Computed: true,
249+
},
250+
"repository_storage": {
251+
Description: " Which storage shard the repository is on. (administrator only)",
252+
Type: schema.TypeString,
253+
Computed: true,
254+
},
255+
"requirements_access_level": {
256+
Description: fmt.Sprintf("Set the requirements access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
257+
Type: schema.TypeString,
258+
Computed: true,
259+
},
260+
"security_and_compliance_access_level": {
261+
Description: fmt.Sprintf("Set the security and compliance access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
262+
Type: schema.TypeString,
263+
Computed: true,
264+
},
265+
"snippets_access_level": {
266+
Description: fmt.Sprintf("Set the snippets access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
267+
Type: schema.TypeString,
268+
Computed: true,
269+
},
270+
"topics": {
271+
Description: "The list of topics for the project.",
272+
Type: schema.TypeSet,
273+
Set: schema.HashString,
274+
Elem: &schema.Schema{Type: schema.TypeString},
275+
Computed: true,
276+
},
277+
"wiki_access_level": {
278+
Description: fmt.Sprintf("Set the wiki access level. Valid values are %s.", renderValueListForDocs(validProjectAccessLevels)),
279+
Type: schema.TypeString,
280+
Computed: true,
281+
},
282+
"squash_commit_template": {
283+
Description: "Template used to create squash commit message in merge requests. (Introduced in GitLab 14.6.)",
284+
Type: schema.TypeString,
285+
Computed: true,
286+
},
287+
"merge_commit_template": {
288+
Description: "Template used to create merge commit message in merge requests. (Introduced in GitLab 14.5.)",
289+
Type: schema.TypeString,
290+
Computed: true,
291+
},
154292
// lintignore: S031 // TODO: Resolve this tfproviderlint issue
155293
"push_rules": {
156294
Description: "Push rules for the project.",
@@ -261,6 +399,37 @@ func dataSourceGitlabProjectRead(ctx context.Context, d *schema.ResourceData, me
261399
d.Set("remove_source_branch_after_merge", found.RemoveSourceBranchAfterMerge)
262400
d.Set("merge_pipelines_enabled", found.MergePipelinesEnabled)
263401
d.Set("merge_trains_enabled", found.MergeTrainsEnabled)
402+
d.Set("resolve_outdated_diff_discussions", found.ResolveOutdatedDiffDiscussions)
403+
d.Set("analytics_access_level", string(found.AnalyticsAccessLevel))
404+
d.Set("auto_cancel_pending_pipelines", found.AutoCancelPendingPipelines)
405+
d.Set("auto_devops_deploy_strategy", found.AutoDevopsDeployStrategy)
406+
d.Set("auto_devops_enabled", found.AutoDevopsEnabled)
407+
d.Set("autoclose_referenced_issues", found.AutocloseReferencedIssues)
408+
d.Set("build_git_strategy", found.BuildGitStrategy)
409+
d.Set("build_timeout", found.BuildTimeout)
410+
d.Set("builds_access_level", string(found.BuildsAccessLevel))
411+
if err := d.Set("container_expiration_policy", flattenContainerExpirationPolicy(found.ContainerExpirationPolicy)); err != nil {
412+
return diag.Errorf("error setting container_expiration_policy: %v", err)
413+
}
414+
d.Set("container_registry_access_level", string(found.ContainerRegistryAccessLevel))
415+
d.Set("emails_disabled", found.EmailsDisabled)
416+
d.Set("external_authorization_classification_label", found.ExternalAuthorizationClassificationLabel)
417+
d.Set("forking_access_level", string(found.ForkingAccessLevel))
418+
d.Set("issues_access_level", string(found.IssuesAccessLevel))
419+
d.Set("merge_requests_access_level", string(found.MergeRequestsAccessLevel))
420+
d.Set("operations_access_level", string(found.OperationsAccessLevel))
421+
d.Set("public_builds", found.PublicBuilds)
422+
d.Set("repository_access_level", string(found.RepositoryAccessLevel))
423+
d.Set("repository_storage", found.RepositoryStorage)
424+
d.Set("requirements_access_level", string(found.RequirementsAccessLevel))
425+
d.Set("security_and_compliance_access_level", string(found.SecurityAndComplianceAccessLevel))
426+
d.Set("snippets_access_level", string(found.SnippetsAccessLevel))
427+
if err := d.Set("topics", found.Topics); err != nil {
428+
return diag.Errorf("error setting topics: %v", err)
429+
}
430+
d.Set("wiki_access_level", string(found.WikiAccessLevel))
431+
d.Set("squash_commit_template", found.SquashCommitTemplate)
432+
d.Set("merge_commit_template", found.MergeCommitTemplate)
264433

265434
log.Printf("[DEBUG] Reading Gitlab project %q push rules", d.Id())
266435

0 commit comments

Comments
 (0)