Skip to content

Commit

Permalink
internal/resource: Use the Plan to create host and lighthouse res…
Browse files Browse the repository at this point in the history
…ources

The provider is incorrectly using user-passed configuration to create resources when it should be using the planned state.
  • Loading branch information
janartodesk committed Nov 28, 2024
1 parent b9720e6 commit c41ae7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion internal/resource/host/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *res
func (r *Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var state State

resp.Diagnostics.Append(req.Config.Get(ctx, &state)...)
resp.Diagnostics.Append(req.Plan.Get(ctx, &state)...)
if resp.Diagnostics.HasError() {
return
}
Expand Down
2 changes: 1 addition & 1 deletion internal/resource/lighthouse/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func (r *Resource) Schema(_ context.Context, _ resource.SchemaRequest, resp *res
func (r *Resource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var state State

resp.Diagnostics.Append(req.Config.Get(ctx, &state)...)
resp.Diagnostics.Append(req.Plan.Get(ctx, &state)...)
if resp.Diagnostics.HasError() {
return
}
Expand Down

0 comments on commit c41ae7e

Please sign in to comment.