@@ -13,17 +13,7 @@ func gitlabProjectMilestoneGetSchema() map[string]*schema.Schema {
13
13
validMilestoneStates := []string {"active" , "closed" }
14
14
15
15
return map [string ]* schema.Schema {
16
- "iid" : {
17
- Description : "The ID of the project's milestone." ,
18
- Type : schema .TypeInt ,
19
- Computed : true ,
20
- },
21
- "milestone_id" : {
22
- Description : "The instance-wide ID of the project’s milestone." ,
23
- Type : schema .TypeInt ,
24
- Computed : true ,
25
- },
26
- "project_id" : {
16
+ "project" : {
27
17
Description : "The ID or URL-encoded path of the project owned by the authenticated user." ,
28
18
Type : schema .TypeString ,
29
19
ForceNew : true ,
@@ -51,50 +41,66 @@ func gitlabProjectMilestoneGetSchema() map[string]*schema.Schema {
51
41
Optional : true ,
52
42
ValidateDiagFunc : isISO6801Date ,
53
43
},
54
- "updated_at" : {
55
- Description : "The last update time of the milestone. Date time string, ISO 8601 formatted, for example 2016-03-11T03:45:40Z." ,
44
+ // NOTE: not part of `CREATE`, but part of `UPDATE` with the `state_event` field.
45
+ "state" : {
46
+ Description : fmt .Sprintf ("The state of the milestone. Valid values are: %s." , renderValueListForDocs (validMilestoneStates )),
47
+ Type : schema .TypeString ,
48
+ Optional : true ,
49
+ Default : "active" ,
50
+ ValidateDiagFunc : validation .ToDiagFunc (validation .StringInSlice (validMilestoneStates , false )),
51
+ },
52
+ "created_at" : {
53
+ Description : "The time of creation of the milestone. Date time string, ISO 8601 formatted, for example 2016-03-11T03:45:40Z." ,
56
54
Type : schema .TypeString ,
57
- Computed : true ,
58
55
Optional : true ,
56
+ Computed : true ,
59
57
// NOTE: since RFC3339 is pretty much a subset of ISO8601 and actually expected by GitLab,
60
58
// we use it here to avoid having to parse the string ourselves.
61
59
ValidateDiagFunc : validation .ToDiagFunc (validation .IsRFC3339Time ),
62
60
},
63
- "created_at " : {
64
- Description : "The time of creation of the milestone. Date time string, ISO 8601 formatted, for example 2016-03-11T03:45:40Z." ,
61
+ "updated_at " : {
62
+ Description : "The last update time of the milestone. Date time string, ISO 8601 formatted, for example 2016-03-11T03:45:40Z." ,
65
63
Type : schema .TypeString ,
66
- Computed : true ,
67
64
Optional : true ,
65
+ Computed : true ,
68
66
// NOTE: since RFC3339 is pretty much a subset of ISO8601 and actually expected by GitLab,
69
67
// we use it here to avoid having to parse the string ourselves.
70
68
ValidateDiagFunc : validation .ToDiagFunc (validation .IsRFC3339Time ),
71
69
},
72
- // NOTE: not part of `CREATE`, but part of `UPDATE` with the `state_event` field.
73
- "state" : {
74
- Description : fmt .Sprintf ("The state of the milestone. Valid values are: %s." , renderValueListForDocs (validMilestoneStates )),
75
- Type : schema .TypeString ,
76
- Optional : true ,
77
- Default : "active" ,
78
- ValidateDiagFunc : validation .ToDiagFunc (validation .StringInSlice (validMilestoneStates , false )),
70
+ "expired" : {
71
+ Description : "Bool, true if milestore expired." ,
72
+ Type : schema .TypeBool ,
73
+ Computed : true ,
74
+ },
75
+ "iid" : {
76
+ Description : "The ID of the project's milestone." ,
77
+ Type : schema .TypeInt ,
78
+ Computed : true ,
79
+ },
80
+ "milestone_id" : {
81
+ Description : "The instance-wide ID of the project’s milestone." ,
82
+ Type : schema .TypeInt ,
83
+ Computed : true ,
84
+ },
85
+ "project_id" : {
86
+ Description : "The project ID of milestone." ,
87
+ Type : schema .TypeInt ,
88
+ Computed : true ,
79
89
},
80
90
"web_url" : {
81
91
Description : "The web URL of the milestone." ,
82
92
Type : schema .TypeString ,
83
93
Computed : true ,
84
94
},
85
- "expired" : {
86
- Description : "Bool, true if milestore expired." ,
87
- Type : schema .TypeBool ,
88
- Computed : true ,
89
- },
90
95
}
91
96
}
92
97
93
- func gitlabProjectMilestoneToStateMap (milestone * gitlab.Milestone ) map [string ]interface {} {
98
+ func gitlabProjectMilestoneToStateMap (project string , milestone * gitlab.Milestone ) map [string ]interface {} {
94
99
stateMap := make (map [string ]interface {})
95
100
stateMap ["iid" ] = milestone .IID
96
101
stateMap ["milestone_id" ] = milestone .ID
97
- stateMap ["project_id" ] = fmt .Sprintf ("%d" , milestone .ProjectID )
102
+ stateMap ["project" ] = project
103
+ stateMap ["project_id" ] = milestone .ProjectID
98
104
stateMap ["title" ] = milestone .Title
99
105
stateMap ["description" ] = milestone .Description
100
106
if milestone .DueDate != nil {
0 commit comments