@@ -13,7 +13,6 @@ import (
13
13
"github.com/hashicorp/terraform-plugin-framework/resource/schema"
14
14
"github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
15
15
"github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
16
- "github.com/hashicorp/terraform-plugin-framework/types"
17
16
"github.com/hashicorp/terraform-plugin-log/tflog"
18
17
)
19
18
@@ -92,11 +91,6 @@ func (r *resourceTFEStack) Schema(ctx context.Context, req resource.SchemaReques
92
91
Description : "Description of the Stack" ,
93
92
Optional : true ,
94
93
},
95
- "deployment_names" : schema.SetAttribute {
96
- Description : "The time when the Stack was created." ,
97
- Computed : true ,
98
- ElementType : types .StringType ,
99
- },
100
94
"created_at" : schema.StringAttribute {
101
95
Description : "The time when the stack was created." ,
102
96
Computed : true ,
@@ -194,7 +188,7 @@ func (r *resourceTFEStack) Read(ctx context.Context, req resource.ReadRequest, r
194
188
}
195
189
196
190
tflog .Debug (ctx , fmt .Sprintf ("Reading stack %q" , state .ID .ValueString ()))
197
- stack , err := r .config .Client .Stacks .Read (ctx , state .ID .ValueString (), nil )
191
+ stack , err := r .config .Client .Stacks .Read (ctx , state .ID .ValueString ())
198
192
if err != nil {
199
193
resp .Diagnostics .AddError ("Unable to read stack" , err .Error ())
200
194
return
@@ -222,27 +216,6 @@ func (r *resourceTFEStack) Update(ctx context.Context, req resource.UpdateReques
222
216
return
223
217
}
224
218
225
- // NOTE: if there are existing deployments, and you plan to move a stack from vcs to non-vcs or vice versa,
226
- // we should prevent the update and return an error because the API does not allow this.
227
- // TODO: When the go-tfe package would allow such operation we should revisit this logic.
228
- // This is also inspired by similar behavior of the destroy / delete operation for this resource.
229
- var deploymentNames []string
230
- if ! state .DeploymentNames .IsNull () {
231
- if diags := state .DeploymentNames .ElementsAs (ctx , & deploymentNames , false ); diags .HasError () {
232
- resp .Diagnostics .AddError ("Invalid deployment names" , "Expected a set of strings for deployment names." )
233
- return
234
- }
235
- }
236
- tflog .Debug (ctx , fmt .Sprintf ("Current deployments: %v" , deploymentNames ))
237
-
238
- if (len (deploymentNames ) > 0 ) && ((state .VCSRepo != nil && plan .VCSRepo == nil ) || (state .VCSRepo == nil && plan .VCSRepo != nil )) {
239
- resp .Diagnostics .AddError (
240
- "Cannot update Stack VCS configuration with existing deployments" ,
241
- "Please remove all deployments associated with this Stack before updating the VCS configuration." ,
242
- )
243
- return
244
- }
245
-
246
219
options := tfe.StackUpdateOptions {
247
220
Name : tfe .String (plan .Name .ValueString ()),
248
221
Description : tfe .String (plan .Description .ValueString ()),
0 commit comments