diff --git a/docs/data-sources/project.md b/docs/data-sources/project.md index ae9a2a4a9..06ed4eeb9 100644 --- a/docs/data-sources/project.md +++ b/docs/data-sources/project.md @@ -69,6 +69,8 @@ The following attributes are exported: * `remove_source_branch_after_merge` - Enable `Delete source branch` option by default for all new merge requests +* `printing_merge_request_link_enabled` - Show link to create/view merge request when pushing from the command line. + * `packages_enabled` - Enable packages repository for the project. * `push_rules` Push rules for the project (documented below). diff --git a/docs/resources/project.md b/docs/resources/project.md index f28b131a1..3bd5c7986 100644 --- a/docs/resources/project.md +++ b/docs/resources/project.md @@ -133,6 +133,8 @@ The following additional attributes are exported: * `remove_source_branch_after_merge` - Enable `Delete source branch` option by default for all new merge requests. +* `printing_merge_request_link_enabled` - Show link to create/view merge request when pushing from the command line. + ## Nested Blocks ### push_rules diff --git a/examples/gitlab-managed-state/main.tf b/examples/gitlab-managed-state/main.tf index 48eaf2a1e..56c8140c5 100644 --- a/examples/gitlab-managed-state/main.tf +++ b/examples/gitlab-managed-state/main.tf @@ -41,6 +41,7 @@ resource "gitlab_project" "api" { only_allow_merge_if_all_discussions_are_resolved = true only_allow_merge_if_pipeline_succeeds = true remove_source_branch_after_merge = true + printing_merge_request_link_enabled = true container_registry_enabled = false lfs_enabled = false diff --git a/gitlab/data_source_gitlab_project.go b/gitlab/data_source_gitlab_project.go index d7db92db3..a73da6adb 100644 --- a/gitlab/data_source_gitlab_project.go +++ b/gitlab/data_source_gitlab_project.go @@ -99,6 +99,10 @@ func dataSourceGitlabProject() *schema.Resource { Type: schema.TypeBool, Computed: true, }, + "printing_merge_request_link_enabled": { + Type: schema.TypeBool, + Computed: true, + }, // lintignore: S031 // TODO: Resolve this tfproviderlint issue "push_rules": { Type: schema.TypeList, @@ -189,6 +193,7 @@ func dataSourceGitlabProjectRead(d *schema.ResourceData, meta interface{}) error d.Set("runners_token", found.RunnersToken) d.Set("archived", found.Archived) d.Set("remove_source_branch_after_merge", found.RemoveSourceBranchAfterMerge) + d.Set("printing_merge_request_link_enabled", found.PrintingMergeRequestLinkEnabled) log.Printf("[DEBUG] Reading Gitlab project %q push rules", d.Id()) diff --git a/gitlab/resource_gitlab_project.go b/gitlab/resource_gitlab_project.go index 2b2394455..798e4e6bd 100644 --- a/gitlab/resource_gitlab_project.go +++ b/gitlab/resource_gitlab_project.go @@ -687,6 +687,10 @@ func resourceGitlabProjectUpdate(d *schema.ResourceData, meta interface{}) error options.RemoveSourceBranchAfterMerge = gitlab.Bool(d.Get("remove_source_branch_after_merge").(bool)) } + if d.HasChange("printing_merge_request_link_enabled") { + options.RemoveSourceBranchAfterMerge = gitlab.Bool(d.Get("printing_merge_request_link_enabled").(bool)) + } + if d.HasChange("packages_enabled") { options.PackagesEnabled = gitlab.Bool(d.Get("packages_enabled").(bool)) }