@@ -88,7 +88,7 @@ func (r *integrationProjectAccessResource) Create(ctx context.Context, req resou
88
88
return
89
89
}
90
90
91
- _ , err := r .client .GrantIntegrationProjectAccess (ctx , plan .IntegrationID .ValueString (), plan .ProjectID .ValueString (), plan .TeamID .ValueString ())
91
+ ipa , err := r .client .GrantIntegrationProjectAccess (ctx , plan .IntegrationID .ValueString (), plan .ProjectID .ValueString (), plan .TeamID .ValueString ())
92
92
if err != nil {
93
93
resp .Diagnostics .AddError (
94
94
"Error granting integration project access" ,
@@ -98,7 +98,7 @@ func (r *integrationProjectAccessResource) Create(ctx context.Context, req resou
98
98
}
99
99
100
100
result := IntegrationProjectAccess {
101
- TeamID : plan . TeamID ,
101
+ TeamID : types . StringValue ( ipa . TeamID ) ,
102
102
IntegrationID : plan .IntegrationID ,
103
103
ProjectID : plan .ProjectID ,
104
104
}
@@ -124,7 +124,7 @@ func (r *integrationProjectAccessResource) Read(ctx context.Context, req resourc
124
124
return
125
125
}
126
126
127
- allowed , err := r .client .GetIntegrationProjectAccess (ctx , state .IntegrationID .ValueString (), state .ProjectID .ValueString (), state .TeamID .ValueString ())
127
+ ipa , err := r .client .GetIntegrationProjectAccess (ctx , state .IntegrationID .ValueString (), state .ProjectID .ValueString (), state .TeamID .ValueString ())
128
128
if err != nil {
129
129
resp .Diagnostics .AddError (
130
130
"Error granting integration project access" ,
@@ -134,18 +134,18 @@ func (r *integrationProjectAccessResource) Read(ctx context.Context, req resourc
134
134
}
135
135
136
136
result := IntegrationProjectAccess {
137
- TeamID : state . TeamID ,
137
+ TeamID : types . StringValue ( ipa . TeamID ) ,
138
138
IntegrationID : state .IntegrationID ,
139
139
ProjectID : state .ProjectID ,
140
140
}
141
141
tflog .Info (ctx , "read integration project access" , map [string ]interface {}{
142
142
"team_id" : result .TeamID .ValueString (),
143
143
"integration_id" : result .IntegrationID .ValueString (),
144
144
"project_id" : result .ProjectID .ValueString (),
145
- "allowed" : allowed ,
145
+ "allowed" : ipa . Allowed ,
146
146
})
147
147
148
- if allowed {
148
+ if ipa . Allowed {
149
149
diags = resp .State .Set (ctx , result )
150
150
resp .Diagnostics .Append (diags ... )
151
151
if resp .Diagnostics .HasError () {
@@ -157,40 +157,7 @@ func (r *integrationProjectAccessResource) Read(ctx context.Context, req resourc
157
157
}
158
158
159
159
func (r * integrationProjectAccessResource ) Update (ctx context.Context , req resource.UpdateRequest , resp * resource.UpdateResponse ) {
160
- var plan IntegrationProjectAccess
161
- diags := req .Plan .Get (ctx , & plan )
162
- resp .Diagnostics .Append (diags ... )
163
- if resp .Diagnostics .HasError () {
164
- return
165
- }
166
-
167
- allowed , err := r .client .GrantIntegrationProjectAccess (ctx , plan .IntegrationID .ValueString (), plan .ProjectID .ValueString (), plan .TeamID .ValueString ())
168
- if err != nil {
169
- resp .Diagnostics .AddError (
170
- "Error granting integration project access" ,
171
- "Could not grant integration project access, unexpected error: " + err .Error (),
172
- )
173
- return
174
- }
175
-
176
- result := IntegrationProjectAccess {
177
- TeamID : plan .TeamID ,
178
- IntegrationID : plan .IntegrationID ,
179
- ProjectID : plan .ProjectID ,
180
- }
181
-
182
- tflog .Info (ctx , "granted integration project access" , map [string ]interface {}{
183
- "team_id" : result .TeamID .ValueString (),
184
- "integration_id" : result .IntegrationID .ValueString (),
185
- "project_id" : result .ProjectID .ValueString (),
186
- "allowed" : allowed ,
187
- })
188
-
189
- diags = resp .State .Set (ctx , result )
190
- resp .Diagnostics .Append (diags ... )
191
- if resp .Diagnostics .HasError () {
192
- return
193
- }
160
+ resp .Diagnostics .AddError ("Access should always be recreated" , "Something incorrectly caused an Update, this should always be recreated instead of updated." )
194
161
}
195
162
196
163
func (r * integrationProjectAccessResource ) Delete (ctx context.Context , req resource.DeleteRequest , resp * resource.DeleteResponse ) {
@@ -201,7 +168,7 @@ func (r *integrationProjectAccessResource) Delete(ctx context.Context, req resou
201
168
return
202
169
}
203
170
204
- allowed , err := r .client .RevokeIntegrationProjectAccess (ctx , plan .IntegrationID .ValueString (), plan .ProjectID .ValueString (), plan .TeamID .ValueString ())
171
+ ipa , err := r .client .RevokeIntegrationProjectAccess (ctx , plan .IntegrationID .ValueString (), plan .ProjectID .ValueString (), plan .TeamID .ValueString ())
205
172
if err != nil {
206
173
resp .Diagnostics .AddError (
207
174
"Error revoking integration project access" ,
@@ -211,7 +178,7 @@ func (r *integrationProjectAccessResource) Delete(ctx context.Context, req resou
211
178
}
212
179
213
180
result := IntegrationProjectAccess {
214
- TeamID : plan . TeamID ,
181
+ TeamID : types . StringValue ( ipa . TeamID ) ,
215
182
IntegrationID : plan .IntegrationID ,
216
183
ProjectID : plan .ProjectID ,
217
184
}
@@ -220,6 +187,6 @@ func (r *integrationProjectAccessResource) Delete(ctx context.Context, req resou
220
187
"team_id" : result .TeamID .ValueString (),
221
188
"integration_id" : result .IntegrationID .ValueString (),
222
189
"project_id" : result .ProjectID .ValueString (),
223
- "allowed" : allowed ,
190
+ "allowed" : ipa . Allowed ,
224
191
})
225
192
}
0 commit comments