diff --git a/migration-readme.md b/migration-readme.md index 0328319c..539cbec5 100644 --- a/migration-readme.md +++ b/migration-readme.md @@ -161,7 +161,10 @@ func (b *blahResource) Create(ctx context.Context, request resource.CreateReques newResource := ... // call client for create - blah := blahResources.Add(b.Client, util.GetSpace(), newResource) + // the space id here should come from the plan. + // If the user doesn't provide a space_id on the plan, this will return an empty string, which the client will replace with the + // space_id configured on the provider, otherwise the API will assume the default space. + blah := blahResources.Add(b.Client, plan.SpaceID.ValueString(), newResource) // map result to state plan.Name := types.StringValue(blah.Name) diff --git a/octopusdeploy_framework/resource_variable.go b/octopusdeploy_framework/resource_variable.go index e8ecd944..96a842f1 100644 --- a/octopusdeploy_framework/resource_variable.go +++ b/octopusdeploy_framework/resource_variable.go @@ -90,7 +90,7 @@ func (r *variableTypeResource) Create(ctx context.Context, req resource.CreateRe tflog.Info(ctx, fmt.Sprintf("creating variable: %#v", newVariable)) - variableSet, err := variables.AddSingle(r.Config.Client, r.Config.SpaceID, variableOwnerId.ValueString(), newVariable) + variableSet, err := variables.AddSingle(r.Config.Client, data.SpaceID.ValueString(), variableOwnerId.ValueString(), newVariable) if err != nil { resp.Diagnostics.AddError("create variable failed", err.Error()) return