@@ -43,16 +43,21 @@ func resourceGitlabProjectVariable() *schema.Resource {
43
43
44
44
func resourceGitlabProjectVariableCreate (d * schema.ResourceData , meta interface {}) error {
45
45
client := meta .(* gitlab.Client )
46
+
46
47
project := d .Get ("project" ).(string )
47
48
key := d .Get ("key" ).(string )
48
- options := & gitlab.CreateBuildVariableOptions {
49
- Key : gitlab .String (key ),
50
- Value : gitlab .String (d .Get ("value" ).(string )),
51
- Protected : gitlab .Bool (d .Get ("protected" ).(bool )),
49
+ value := d .Get ("value" ).(string )
50
+ protected := d .Get ("protected" ).(bool )
51
+
52
+ options := gitlab.CreateVariableOptions {
53
+ Key : & key ,
54
+ Value : & value ,
55
+ Protected : & protected ,
56
+ EnvironmentScope : nil ,
52
57
}
53
58
log .Printf ("[DEBUG] create gitlab project variable %s/%s" , project , key )
54
59
55
- v , _ , err := client .BuildVariables . CreateBuildVariable (project , options )
60
+ v , _ , err := client .ProjectVariables . CreateVariable (project , & options )
56
61
if err != nil {
57
62
return err
58
63
}
@@ -72,7 +77,7 @@ func resourceGitlabProjectVariableRead(d *schema.ResourceData, meta interface{})
72
77
73
78
log .Printf ("[DEBUG] read gitlab project variable %s/%s" , project , key )
74
79
75
- v , _ , err := client .BuildVariables . GetBuildVariable (project , key )
80
+ v , _ , err := client .ProjectVariables . GetVariable (project , key )
76
81
if err != nil {
77
82
return err
78
83
}
@@ -88,16 +93,21 @@ func resourceGitlabProjectVariableRead(d *schema.ResourceData, meta interface{})
88
93
89
94
func resourceGitlabProjectVariableUpdate (d * schema.ResourceData , meta interface {}) error {
90
95
client := meta .(* gitlab.Client )
96
+
91
97
project := d .Get ("project" ).(string )
92
98
key := d .Get ("key" ).(string )
93
- options := & gitlab.UpdateBuildVariableOptions {
94
- Key : gitlab .String (d .Get ("key" ).(string )),
95
- Value : gitlab .String (d .Get ("value" ).(string )),
96
- Protected : gitlab .Bool (d .Get ("protected" ).(bool )),
99
+ value := d .Get ("value" ).(string )
100
+ protected := d .Get ("protected" ).(bool )
101
+
102
+ options := & gitlab.UpdateVariableOptions {
103
+ Key : & key ,
104
+ Value : & value ,
105
+ Protected : & protected ,
106
+ EnvironmentScope : nil ,
97
107
}
98
108
log .Printf ("[DEBUG] update gitlab project variable %s/%s" , project , key )
99
109
100
- v , _ , err := client .BuildVariables . UpdateBuildVariable (project , key , options )
110
+ v , _ , err := client .ProjectVariables . UpdateVariable (project , key , options )
101
111
if err != nil {
102
112
return err
103
113
}
@@ -113,6 +123,6 @@ func resourceGitlabProjectVariableDelete(d *schema.ResourceData, meta interface{
113
123
key := d .Get ("key" ).(string )
114
124
log .Printf ("[DEBUG] Delete gitlab project variable %s/%s" , project , key )
115
125
116
- _ , err := client .BuildVariables . RemoveBuildVariable (project , key )
126
+ _ , err := client .ProjectVariables . RemoveVariable (project , key )
117
127
return err
118
128
}
0 commit comments