@@ -13,7 +13,6 @@ import (
1313 "github.com/hashicorp/terraform-plugin-framework/resource/schema"
1414 "github.com/hashicorp/terraform-plugin-framework/resource/schema/planmodifier"
1515 "github.com/hashicorp/terraform-plugin-framework/resource/schema/stringplanmodifier"
16- "github.com/hashicorp/terraform-plugin-framework/types"
1716 "github.com/hashicorp/terraform-plugin-log/tflog"
1817)
1918
@@ -92,11 +91,6 @@ func (r *resourceTFEStack) Schema(ctx context.Context, req resource.SchemaReques
9291 Description : "Description of the Stack" ,
9392 Optional : true ,
9493 },
95- "deployment_names" : schema.SetAttribute {
96- Description : "The time when the Stack was created." ,
97- Computed : true ,
98- ElementType : types .StringType ,
99- },
10094 "created_at" : schema.StringAttribute {
10195 Description : "The time when the stack was created." ,
10296 Computed : true ,
@@ -194,7 +188,7 @@ func (r *resourceTFEStack) Read(ctx context.Context, req resource.ReadRequest, r
194188 }
195189
196190 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 ())
198192 if err != nil {
199193 resp .Diagnostics .AddError ("Unable to read stack" , err .Error ())
200194 return
@@ -222,27 +216,6 @@ func (r *resourceTFEStack) Update(ctx context.Context, req resource.UpdateReques
222216 return
223217 }
224218
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-
246219 options := tfe.StackUpdateOptions {
247220 Name : tfe .String (plan .Name .ValueString ()),
248221 Description : tfe .String (plan .Description .ValueString ()),
0 commit comments