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:
Łukasz Jan Niemier 2017-05-24 14:05:27 +02:00 committed by Paul Stack
parent d820ff9ed5
commit 18f2edf729
3 changed files with 25 additions and 17 deletions

View File

@ -21,6 +21,10 @@ func resourceGitlabProject() *schema.Resource {
Type: schema.TypeString,
Required: true,
},
"namespace_id": {
Type: schema.TypeInt,
Optional: true,
},
"description": {
Type: schema.TypeString,
Optional: true,
@ -97,6 +101,10 @@ func resourceGitlabProjectCreate(d *schema.ResourceData, meta interface{}) error
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 {
options.Description = gitlab.String(v.(string))
}