Add namespcace ID attribute (#14483)
* Add namespcace ID attribute This commit also introduce `id` comouted value which is numeric value used by GitLab to iteract with repository. This should simplify use of `gitlab_project_hook` usage and would allow to introduce other resources as described in #14471 * Fixes requested by @richardc * Handle optional `namespace_id`
This commit is contained in:
parent
d820ff9ed5
commit
18f2edf729
|
@ -21,6 +21,10 @@ func resourceGitlabProject() *schema.Resource {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Required: true,
|
Required: true,
|
||||||
},
|
},
|
||||||
|
"namespace_id": {
|
||||||
|
Type: schema.TypeInt,
|
||||||
|
Optional: true,
|
||||||
|
},
|
||||||
"description": {
|
"description": {
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -97,6 +101,10 @@ func resourceGitlabProjectCreate(d *schema.ResourceData, meta interface{}) error
|
||||||
SnippetsEnabled: gitlab.Bool(d.Get("snippets_enabled").(bool)),
|
SnippetsEnabled: gitlab.Bool(d.Get("snippets_enabled").(bool)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if v, ok := d.GetOk("namespace_id"); ok {
|
||||||
|
options.NamespaceID = gitlab.Int(v.(int))
|
||||||
|
}
|
||||||
|
|
||||||
if v, ok := d.GetOk("description"); ok {
|
if v, ok := d.GetOk("description"); ok {
|
||||||
options.Description = gitlab.String(v.(string))
|
options.Description = gitlab.String(v.(string))
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,8 +186,8 @@ resource "gitlab_project" "foo" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "gitlab_project_hook" "foo" {
|
resource "gitlab_project_hook" "foo" {
|
||||||
project = "${gitlab_project.foo.id}"
|
project = "${gitlab_project.foo.id}"
|
||||||
url = "https://example.com/hook-%d"
|
url = "https://example.com/hook-%d"
|
||||||
}
|
}
|
||||||
`, rInt, rInt)
|
`, rInt, rInt)
|
||||||
}
|
}
|
||||||
|
@ -204,17 +204,17 @@ resource "gitlab_project" "foo" {
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "gitlab_project_hook" "foo" {
|
resource "gitlab_project_hook" "foo" {
|
||||||
project = "${gitlab_project.foo.id}"
|
project = "${gitlab_project.foo.id}"
|
||||||
url = "https://example.com/hook-%d"
|
url = "https://example.com/hook-%d"
|
||||||
enable_ssl_verification = false
|
enable_ssl_verification = false
|
||||||
push_events = false
|
push_events = false
|
||||||
issues_events = true
|
issues_events = true
|
||||||
merge_requests_events = true
|
merge_requests_events = true
|
||||||
tag_push_events = true
|
tag_push_events = true
|
||||||
note_events = true
|
note_events = true
|
||||||
build_events = true
|
build_events = true
|
||||||
pipeline_events = true
|
pipeline_events = true
|
||||||
wiki_page_events = true
|
wiki_page_events = true
|
||||||
}
|
}
|
||||||
`, rInt, rInt)
|
`, rInt, rInt)
|
||||||
}
|
}
|
||||||
|
|
|
@ -182,10 +182,10 @@ resource "gitlab_project" "foo" {
|
||||||
# with no billing
|
# with no billing
|
||||||
visibility_level = "public"
|
visibility_level = "public"
|
||||||
|
|
||||||
issues_enabled = false
|
issues_enabled = false
|
||||||
merge_requests_enabled = false
|
merge_requests_enabled = false
|
||||||
wiki_enabled = false
|
wiki_enabled = false
|
||||||
snippets_enabled = false
|
snippets_enabled = false
|
||||||
}
|
}
|
||||||
`, rInt)
|
`, rInt)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue