Skip to content

Commit

Permalink
Fix in resource create vlan to use resource model instad of datasourc…
Browse files Browse the repository at this point in the history
…e model

Signed-off-by: Ayush Rangwala <[email protected]>
  • Loading branch information
aayushrangwala committed Feb 21, 2024
1 parent 498c979 commit e158b3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 2 additions & 3 deletions equinix/resource_metal_virtual_circuit_acc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,8 @@ func TestAccMetalVirtualCircuit_dedicated(t *testing.T) {
ri := acctest.RandIntRange(1024, 1093)

resource.ParallelTest(t, resource.TestCase{ // Error: Error waiting for virtual circuit 863d4df5-b3ea-46ee-8497-858cb0cbfcb9 to be created: GET https://api.equinix.com/metal/v1/virtual-circuits/863d4df5-b3ea-46ee-8497-858cb0cbfcb9?include=project%2Cport%2Cvirtual_network%2Cvrf: 500 Oh snap, something went wrong! We've logged the error and will take a look - please reach out to us if you continue having trouble.
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
//ProviderFactories: testAccProviderFactories,
PreCheck: func() { testAccPreCheck(t) },
ExternalProviders: testExternalProviders,
ProtoV5ProviderFactories: testAccProtoV5ProviderFactories,
CheckDestroy: testAccMetalVirtualCircuitCheckDestroyed,
Steps: []resource.TestStep{
Expand Down
7 changes: 3 additions & 4 deletions internal/resources/metal/vlans/resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r
r.Meta.AddFwModuleToMetalUserAgent(ctx, request.ProviderMeta)
client := r.Meta.Metal

var data DataSourceModel
var data ResourceModel
response.Diagnostics.Append(request.Config.Get(ctx, &data)...)
if response.Diagnostics.HasError() {
return
Expand Down Expand Up @@ -82,15 +82,14 @@ func (r *Resource) Create(ctx context.Context, request resource.CreateRequest, r
return
}

var vlanModel ResourceModel
// Parse API response into the Terraform state
response.Diagnostics.Append(vlanModel.parse(vlan)...)
response.Diagnostics.Append(data.parse(vlan)...)
if response.Diagnostics.HasError() {
return
}

// Set state to fully populated data
response.Diagnostics.Append(response.State.Set(ctx, &vlanModel)...)
response.Diagnostics.Append(response.State.Set(ctx, &data)...)
return
}

Expand Down

0 comments on commit e158b3c

Please sign in to comment.