Skip to content

479 import ethernet port #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@ FEATURES:
ENHANCEMENTS:

- **netapp-ontap_aggregate_data_source**, **netapp-ontap_aggregates_data_source**: added `space.block_storage.available` option ([#256](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/256))
- **netapp-ontap_volume_resource**: added `autosize.*` options. ([#245](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/245))
- **netapp-ontap_networking_ip_interface**: added `ipspace` option ([#249](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/249))

BUG FIXES:

- **netapp-ontap_port**: error when importing VLANs in multi-node clusters ([#479](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/479))
- **netapp-ontap_security_account**: Error importing security_account resource if same account exists on multiple SVMs([#457](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/457))
- **netapp-ontap_svm_qos_policy_activation**: ID parameter missing in QOS policy ([#429](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/429))
- **netapp-ontap_security_account**: password, comment and locked parameters not passed into body request for creating account ([#462](https://github.com/NetApp/terraform-provider-netapp-ontap/issues/462))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -641,16 +641,17 @@ func (r *EthernetPortResource) ImportState(ctx context.Context, req resource.Imp

// Extract ethernet_port info from import identifier
idParts := strings.Split(req.ID, ",")
if len(idParts) != 2 || idParts[0] == "" || idParts[1] == "" {
if len(idParts) != 3 || idParts[0] == "" || idParts[1] == "" || idParts[2] == "" {
resp.Diagnostics.AddError(
"Unexpected Import Identifier",
fmt.Sprintf("Expected import identifier with format: cx_profile_name,name, got: %q.", req.ID),
fmt.Sprintf("Expected import identifier with format: name,node,cx_profile_name, got: %q.", req.ID),
)

return
}

// Save ethernet_port info to attributes
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("cx_profile_name"), idParts[0])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("name"), idParts[1])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("name"), idParts[0])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("node").AtName("name"), idParts[1])...)
resp.Diagnostics.Append(resp.State.SetAttribute(ctx, path.Root("cx_profile_name"), idParts[2])...)
}
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func TestAccNetworkEthernetPortResource(t *testing.T) {
// {
// ResourceName: "netapp-ontap_port.vlan",
// ImportState: true,
// ImportStateId: fmt.Sprintf("%s,%s", "cluster4", "e0a-300"),
// ImportStateId: fmt.Sprintf("%s,%s", "e0a-300", "bsuhas-vsim1", "cluster4"),
// Check: resource.ComposeTestCheckFunc(
// resource.TestMatchResourceAttr("netapp-ontap_port.vlan", "broadcast_domain.id", regexp.MustCompile(idRegexNetworkEthernetPort)),
// resource.TestCheckResourceAttr("netapp-ontap_port.vlan", "broadcast_domain.name", "Default"),
Expand Down
Loading