Skip to content

Commit

Permalink
fix import
Browse files Browse the repository at this point in the history
  • Loading branch information
shaswot77 committed Jan 15, 2025
1 parent 662712c commit 27ea26e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/provider/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ type DataSource struct {
DisplayName string `json:"displayName"`
ID string `json:"id,omitempty"`
Plugin struct {
Name string `json:"name"`
Name string `json:"name"`
OnPrem bool `json:"onPrem"`
} `json:"plugin"`
AgentGroupID string `json:"agentGroupId,omitempty"`
}
Expand Down
5 changes: 3 additions & 2 deletions internal/provider/resource_data_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (r *dataSourceResource) Create(ctx context.Context, req resource.CreateRequ

state := dataSource{
DisplayName: types.StringValue(newDataSource.DisplayName),
OnPrem: types.BoolPointerValue(plan.OnPrem.ValueBoolPointer()),
OnPrem: types.BoolPointerValue(&newDataSource.Plugin.OnPrem),
Name: types.StringValue(newDataSource.Plugin.Name),
AgentGroupID: types.StringValue(newDataSource.AgentGroupID),
ID: types.StringValue(newDataSource.ID),
Expand Down Expand Up @@ -176,6 +176,7 @@ func (r *dataSourceResource) Read(ctx context.Context, req resource.ReadRequest,
}

state.DisplayName = types.StringValue(readDataSource.DisplayName)
state.OnPrem = types.BoolValue(readDataSource.Plugin.OnPrem)
state.Name = types.StringValue(readDataSource.Plugin.Name)
state.AgentGroupID = types.StringValue(readDataSource.AgentGroupID)
state.ID = types.StringValue(readDataSource.ID)
Expand Down Expand Up @@ -245,7 +246,7 @@ func (r *dataSourceResource) Update(ctx context.Context, req resource.UpdateRequ

state = dataSource{
DisplayName: types.StringValue(getDataSource.DisplayName),
OnPrem: types.BoolPointerValue(plan.OnPrem.ValueBoolPointer()),
OnPrem: types.BoolPointerValue(&getDataSource.Plugin.OnPrem),
Name: types.StringValue(getDataSource.Plugin.Name),
AgentGroupID: types.StringValue(getDataSource.AgentGroupID),
ID: types.StringValue(getDataSource.ID),
Expand Down
1 change: 1 addition & 0 deletions internal/provider/resource_data_source_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ resource "squaredup_datasource" "sample_data_source" {
resource.TestCheckResourceAttr("squaredup_datasource.sample_data_source", "display_name", "Sample Data - DataSource Test - "+uuid),
resource.TestCheckResourceAttrSet("squaredup_datasource.sample_data_source", "id"),
resource.TestCheckResourceAttrSet("squaredup_datasource.sample_data_source", "last_updated"),
resource.TestCheckResourceAttr("squaredup_datasource.sample_data_source", "on_prem", "false"),
),
},
//Update DataSource Test
Expand Down

0 comments on commit 27ea26e

Please sign in to comment.