From acb620c79a19f11b59ecb8dbf13dd333c5cc1e80 Mon Sep 17 00:00:00 2001 From: Ujjwal Kumar Date: Wed, 20 Dec 2023 12:13:42 +0530 Subject: [PATCH] changed the name to default, vm to storage vm --- ibm/provider/provider.go | 18 +- ..._ontap_instance_storage_virtual_machine.go | 455 ++++++++++++++++++ ...p_instance_storage_virtual_machine_test.go | 45 ++ ...nstance_storage_virtual_machine_volume.go} | 46 +- ...nce_storage_virtual_machine_volume_test.go | 149 ++++++ ...stance_storage_virtual_machine_volumes.go} | 60 +-- ...ce_storage_virtual_machine_volumes_test.go | 139 ++++++ ...ntap_instance_storage_virtual_machines.go} | 54 +-- ..._instance_storage_virtual_machines_test.go | 42 ++ ...ap_instance_virtual_machine_volume_test.go | 149 ------ ...p_instance_virtual_machine_volumes_test.go | 139 ------ ...ge_ontap_instance_virtual_machines_test.go | 42 -- ...nstance_storage_virtual_machine_volume.go} | 130 ++--- ...ce_storage_virtual_machine_volume_test.go} | 70 +-- ...ance_storage_virtual_machine.html.markdown | 119 +++++ ...rage_virtual_machine_volume.html.markdown} | 10 +- ...age_virtual_machine_volumes.html.markdown} | 10 +- ...ce_storage_virtual_machines.html.markdown} | 6 +- ...rage_virtual_machine_volume.html.markdown} | 10 +- 19 files changed, 1156 insertions(+), 537 deletions(-) create mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine.go create mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_test.go rename ibm/service/vpc/{data_source_ibm_is_storage_ontap_instance_virtual_machine_volume.go => data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go} (79%) create mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go rename ibm/service/vpc/{data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes.go => data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.go} (76%) create mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes_test.go rename ibm/service/vpc/{data_source_ibm_is_storage_ontap_instance_virtual_machines.go => data_source_ibm_is_storage_ontap_instance_storage_virtual_machines.go} (81%) create mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machines_test.go delete mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go delete mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes_test.go delete mode 100644 ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machines_test.go rename ibm/service/vpc/{resource_ibm_is_storage_ontap_instance_virtual_machine_volume.go => resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go} (75%) rename ibm/service/vpc/{resource_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go => resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go} (56%) create mode 100644 website/docs/d/is_storage_ontap_instance_storage_virtual_machine.html.markdown rename website/docs/d/{is_storage_ontap_instance_virtual_machine_volume.html.markdown => is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown} (94%) rename website/docs/d/{is_storage_ontap_instance_virtual_machine_volumes.html.markdown => is_storage_ontap_instance_storage_virtual_machine_volumes.html.markdown} (95%) rename website/docs/d/{is_storage_ontap_instance_virtual_machines.html.markdown => is_storage_ontap_instance_storage_virtual_machines.html.markdown} (97%) rename website/docs/r/{is_storage_ontap_instance_virtual_machine_volume.html.markdown => is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown} (95%) diff --git a/ibm/provider/provider.go b/ibm/provider/provider.go index 5139bb5c1c..7973fbe350 100644 --- a/ibm/provider/provider.go +++ b/ibm/provider/provider.go @@ -377,12 +377,12 @@ func Provider() *schema.Provider { "ibm_iam_policy_assignment": iampolicy.DataSourceIBMIAMPolicyAssignment(), // ontap - "ibm_is_storage_ontap_instance": vpc.DataSourceIbmIsStorageOntapInstance(), - "ibm_is_storage_ontap_instances": vpc.DataSourceIbmIsStorageOntapInstances(), - // "ibm_is_storage_ontap_instance_virtual_machine": vpc.DataSourceIbmIsStorageOntapInstanceVirtualMachine(), - "ibm_is_storage_ontap_instance_virtual_machines": vpc.DataSourceIbmIsStorageOntapInstanceVirtualMachines(), - "ibm_is_storage_ontap_instance_virtual_machine_volume": vpc.DataSourceIbmIsStorageOntapInstanceVirtualMachineVolume(), - "ibm_is_storage_ontap_instance_virtual_machine_volumes": vpc.DataSourceIbmIsStorageOntapInstanceVirtualMachineVolumes(), + "ibm_is_storage_ontap_instance": vpc.DataSourceIbmIsStorageOntapInstance(), + "ibm_is_storage_ontap_instances": vpc.DataSourceIbmIsStorageOntapInstances(), + "ibm_is_storage_ontap_instance_storage_virtual_machine": vpc.DataSourceIbmIsStorageOntapInstanceStorageVirtualMachine(), + "ibm_is_storage_ontap_instance_storage_virtual_machines": vpc.DataSourceIbmIsStorageOntapInstanceStorageVirtualMachines(), + "ibm_is_storage_ontap_instance_storage_virtual_machine_volume": vpc.DataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolume(), + "ibm_is_storage_ontap_instance_storage_virtual_machine_volumes": vpc.DataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumes(), // backup as Service "ibm_is_backup_policy": vpc.DataSourceIBMIsBackupPolicy(), @@ -1049,7 +1049,7 @@ func Provider() *schema.Provider { // ontap "ibm_is_storage_ontap_instance": vpc.ResourceIbmIsStorageOntapInstance(), // "ibm_is_storage_ontap_instance_virtual_machine": vpc.DataSourceIbmIsStorageOntapInstanceVirtualMachine(), - "ibm_is_storage_ontap_instance_virtual_machine_volume": vpc.ResourceIbmIsStorageOntapInstanceVirtualMachineVolume(), + "ibm_is_storage_ontap_instance_storage_virtual_machine_volume": vpc.ResourceIbmIsStorageOntapInstanceStorageVirtualMachineVolume(), "ibm_is_backup_policy": vpc.ResourceIBMIsBackupPolicy(), "ibm_is_backup_policy_plan": vpc.ResourceIBMIsBackupPolicyPlan(), @@ -1504,8 +1504,8 @@ func Validator() validate.ValidatorDict { "ibm_mqcloud_truststore_certificate": mqcloud.ResourceIbmMqcloudTruststoreCertificateValidator(), // ontap - "ibm_is_storage_ontap_instance": vpc.ResourceIbmIsStorageOntapInstanceValidator(), - "ibm_is_storage_ontap_instance_virtual_machine_volume": vpc.ResourceIbmIsStorageOntapInstanceVirtualMachineVolumeValidator(), + "ibm_is_storage_ontap_instance": vpc.ResourceIbmIsStorageOntapInstanceValidator(), + "ibm_is_storage_ontap_instance_storage_virtual_machine_volume": vpc.ResourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeValidator(), "ibm_is_backup_policy": vpc.ResourceIBMIsBackupPolicyValidator(), "ibm_is_backup_policy_plan": vpc.ResourceIBMIsBackupPolicyPlanValidator(), diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine.go new file mode 100644 index 0000000000..a2ca91798b --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine.go @@ -0,0 +1,455 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc + +import ( + "context" + "fmt" + "log" + + "github.com/hashicorp/terraform-plugin-sdk/v2/diag" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/conns" + "github.com/IBM-Cloud/terraform-provider-ibm/ibm/flex" + "github.com/IBM/vpc-beta-go-sdk/ontapv1" +) + +func DataSourceIbmIsStorageOntapInstanceStorageVirtualMachine() *schema.Resource { + return &schema.Resource{ + ReadContext: dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineRead, + + Schema: map[string]*schema.Schema{ + "storage_ontap_instance_id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The storage ontap instance identifier.", + }, + "id": &schema.Schema{ + Type: schema.TypeString, + Required: true, + Description: "The storage virtual machine identifier.", + }, + "active_directory": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The Active Directory service this storage virtual machine is joined to.If absent, this storage virtual machine is not joined to an Active Directory service.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "administrators_group": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the domain group whose members have been granted administrative privileges for this storage virtual machine.", + }, + "dns_ips": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The IP addresses of the Active Directory DNS servers or domain controllers.", + Elem: &schema.Schema{ + Type: schema.TypeString, + }, + }, + "domain_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The fully qualified domain name of the self-managed Active Directory.", + }, + "domain_password": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The password credential for the Active Directory domain.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this credential.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "domain_password_credential": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The password credential for the Active Directory domain.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this credential.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "netbios_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name of the Active Directory computer object that will be created for the storage virtual machine.", + }, + "organizational_unit_distinguished_name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The distinguished name of the organizational unit within the self-managed Active Directory.", + }, + "username": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The username that this storage virtual machine will use when joining the Active Directory domain. This username will be the same as the username credential used in `domain_password_credential`.", + }, + }, + }, + }, + "admin_credentials": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The credentials used for the administrator to access the storage virtual machine of thestorage ontap instance. At least one of `password`, `ssh`, or `http` will be present.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "http": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The security certificate credential for ONTAP REST API access for the storage virtualmachine administrator.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this credential.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "password": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The password credential for the storage virtual machine administrator.If present, this password credential is used by the storage virtual machineadministrator for both ONTAP CLI SSH access and ONTAP REST API access.If absent, the storage virtual machine is not accessible through either the ONTAP CLIor ONTAP REST API using password-based authentication.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this credential.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "ssh": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The public key credential for ONTAP CLI based ssh login for the storage virtualmachine administrator.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this credential.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + }, + }, + }, + "admin_password": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The password credential for the storage virtual machine administrator.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "crn": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The CRN for this credential.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + }, + }, + "created_at": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The date and time that the storage virtual machine was created.", + }, + "endpoints": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The data and management endpoints for this storage virtual machine.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "management": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The NetApp management endpoint for this storage virtual machine. Management may beperformed using the ONTAP CLI, ONTAP API, or NetApp CloudManager.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ipv4_address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique IP address of an endpoint.", + }, + }, + }, + }, + "nfs": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The Network File System (NFS) protocol endpoint for this storage virtual machine.If absent, NFS is not enabled on this storage virtual machine.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ipv4_address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique IP address of an endpoint.", + }, + }, + }, + }, + "smb": &schema.Schema{ + Type: schema.TypeList, + Computed: true, + Description: "The Server Message Block (SMB) protocol endpoint for this storage virtual machine.If absent, SMB is not enabled on this storage virtual machine.", + Elem: &schema.Resource{ + Schema: map[string]*schema.Schema{ + "ipv4_address": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The unique IP address of an endpoint.", + }, + }, + }, + }, + }, + }, + }, + "href": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The URL for this storage virtual machine.", + }, + "lifecycle_state": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The lifecycle state of the storage virtual machine.", + }, + "name": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The name for this storage virtual machine. The name is unique across all storage virtual machines in the storage ontap instance.", + }, + "resource_type": &schema.Schema{ + Type: schema.TypeString, + Computed: true, + Description: "The resource type.", + }, + }, + } +} + +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { + ontapClient, err := meta.(conns.ClientSession).OntapAPI() + if err != nil { + return diag.FromErr(err) + } + + getStorageOntapInstanceStorageVirtualMachineOptions := &ontapv1.GetStorageOntapInstanceStorageVirtualMachineOptions{} + + getStorageOntapInstanceStorageVirtualMachineOptions.SetStorageOntapInstanceID(d.Get("storage_ontap_instance_id").(string)) + getStorageOntapInstanceStorageVirtualMachineOptions.SetID(d.Get("id").(string)) + + storageOntapInstanceStorageVirtualMachine, response, err := ontapClient.GetStorageOntapInstanceStorageVirtualMachineWithContext(context, getStorageOntapInstanceStorageVirtualMachineOptions) + if err != nil { + log.Printf("[DEBUG] GetStorageOntapInstanceStorageVirtualMachineWithContext failed %s\n%s", err, response) + return diag.FromErr(fmt.Errorf("GetStorageOntapInstanceStorageVirtualMachineWithContext failed %s\n%s", err, response)) + } + + d.SetId(*storageOntapInstanceStorageVirtualMachine.ID) + + activeDirectory := []map[string]interface{}{} + if storageOntapInstanceStorageVirtualMachine.ActiveDirectory != nil { + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceStorageVirtualMachineActiveDirectoryToMap(storageOntapInstanceStorageVirtualMachine.ActiveDirectory) + if err != nil { + return diag.FromErr(err) + } + activeDirectory = append(activeDirectory, modelMap) + } + if err = d.Set("active_directory", activeDirectory); err != nil { + return diag.FromErr(fmt.Errorf("Error setting active_directory %s", err)) + } + + adminCredentials := []map[string]interface{}{} + if storageOntapInstanceStorageVirtualMachine.AdminCredentials != nil { + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceStorageVirtualMachineAdminCredentialsToMap(storageOntapInstanceStorageVirtualMachine.AdminCredentials) + if err != nil { + return diag.FromErr(err) + } + adminCredentials = append(adminCredentials, modelMap) + } + if err = d.Set("admin_credentials", adminCredentials); err != nil { + return diag.FromErr(fmt.Errorf("Error setting admin_credentials %s", err)) + } + + adminPassword := []map[string]interface{}{} + if storageOntapInstanceStorageVirtualMachine.AdminPassword != nil { + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineCredentialReferenceToMap(storageOntapInstanceStorageVirtualMachine.AdminPassword) + if err != nil { + return diag.FromErr(err) + } + adminPassword = append(adminPassword, modelMap) + } + if err = d.Set("admin_password", adminPassword); err != nil { + return diag.FromErr(fmt.Errorf("Error setting admin_password %s", err)) + } + + if err = d.Set("created_at", flex.DateTimeToString(storageOntapInstanceStorageVirtualMachine.CreatedAt)); err != nil { + return diag.FromErr(fmt.Errorf("Error setting created_at: %s", err)) + } + + endpoints := []map[string]interface{}{} + if storageOntapInstanceStorageVirtualMachine.Endpoints != nil { + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceStorageVirtualMachineEndpointsToMap(storageOntapInstanceStorageVirtualMachine.Endpoints) + if err != nil { + return diag.FromErr(err) + } + endpoints = append(endpoints, modelMap) + } + if err = d.Set("endpoints", endpoints); err != nil { + return diag.FromErr(fmt.Errorf("Error setting endpoints %s", err)) + } + + if err = d.Set("href", storageOntapInstanceStorageVirtualMachine.Href); err != nil { + return diag.FromErr(fmt.Errorf("Error setting href: %s", err)) + } + + if err = d.Set("lifecycle_state", storageOntapInstanceStorageVirtualMachine.LifecycleState); err != nil { + return diag.FromErr(fmt.Errorf("Error setting lifecycle_state: %s", err)) + } + + if err = d.Set("name", storageOntapInstanceStorageVirtualMachine.Name); err != nil { + return diag.FromErr(fmt.Errorf("Error setting name: %s", err)) + } + + if err = d.Set("resource_type", storageOntapInstanceStorageVirtualMachine.ResourceType); err != nil { + return diag.FromErr(fmt.Errorf("Error setting resource_type: %s", err)) + } + + return nil +} + +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceStorageVirtualMachineActiveDirectoryToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineActiveDirectory) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["administrators_group"] = model.AdministratorsGroup + modelMap["dns_ips"] = model.DnsIps + modelMap["domain_name"] = model.DomainName + if model.DomainPassword != nil { + domainPasswordMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineCredentialReferenceToMap(model.DomainPassword) + if err != nil { + return modelMap, err + } + modelMap["domain_password"] = []map[string]interface{}{domainPasswordMap} + } + if model.DomainPasswordCredential != nil { + domainPasswordCredentialMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineCredentialReferenceToMap(model.DomainPasswordCredential) + if err != nil { + return modelMap, err + } + modelMap["domain_password_credential"] = []map[string]interface{}{domainPasswordCredentialMap} + } + modelMap["netbios_name"] = model.NetbiosName + modelMap["organizational_unit_distinguished_name"] = model.OrganizationalUnitDistinguishedName + modelMap["username"] = model.Username + return modelMap, nil +} + +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineCredentialReferenceToMap(model *ontapv1.CredentialReference) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["crn"] = model.Crn + modelMap["resource_type"] = model.ResourceType + return modelMap, nil +} + +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceStorageVirtualMachineAdminCredentialsToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineAdminCredentials) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + if model.Http != nil { + httpMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineCredentialReferenceToMap(model.Http) + if err != nil { + return modelMap, err + } + modelMap["http"] = []map[string]interface{}{httpMap} + } + if model.Password != nil { + passwordMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineCredentialReferenceToMap(model.Password) + if err != nil { + return modelMap, err + } + modelMap["password"] = []map[string]interface{}{passwordMap} + } + if model.Ssh != nil { + sshMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineCredentialReferenceToMap(model.Ssh) + if err != nil { + return modelMap, err + } + modelMap["ssh"] = []map[string]interface{}{sshMap} + } + return modelMap, nil +} + +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceStorageVirtualMachineEndpointsToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineEndpoints) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + managementMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceEndpointToMap(model.Management) + if err != nil { + return modelMap, err + } + modelMap["management"] = []map[string]interface{}{managementMap} + if model.Nfs != nil { + nfsMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceEndpointToMap(model.Nfs) + if err != nil { + return modelMap, err + } + modelMap["nfs"] = []map[string]interface{}{nfsMap} + } + if model.Smb != nil { + smbMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceEndpointToMap(model.Smb) + if err != nil { + return modelMap, err + } + modelMap["smb"] = []map[string]interface{}{smbMap} + } + return modelMap, nil +} + +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineStorageOntapInstanceEndpointToMap(model *ontapv1.StorageOntapInstanceEndpoint) (map[string]interface{}, error) { + modelMap := make(map[string]interface{}) + modelMap["ipv4_address"] = model.Ipv4Address + return modelMap, nil +} diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_test.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_test.go new file mode 100644 index 0000000000..e0e1f0e1af --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_test.go @@ -0,0 +1,45 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachineDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "storage_ontap_instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "endpoints.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine.is_storage_ontap_instance_storage_virtual_machine", "resource_type"), + ), + }, + }, + }) +} + +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineDataSourceConfigBasic() string { + return fmt.Sprintf(` + data "ibm_is_storage_ontap_instance_storage_virtual_machine" "is_storage_ontap_instance_storage_virtual_machine_instance" { + storage_ontap_instance_id = "storage_ontap_instance_id" + id = "id" + } + `) +} diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volume.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go similarity index 79% rename from ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volume.go rename to ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go index e2228a3d37..dfaf0923a1 100644 --- a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volume.go +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go @@ -16,9 +16,9 @@ import ( "github.com/IBM/vpc-beta-go-sdk/ontapv1" ) -func DataSourceIbmIsStorageOntapInstanceVirtualMachineVolume() *schema.Resource { +func DataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolume() *schema.Resource { return &schema.Resource{ - ReadContext: dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead, + ReadContext: dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeRead, Schema: map[string]*schema.Schema{ "storage_ontap_instance_id": &schema.Schema{ @@ -246,7 +246,7 @@ func DataSourceIbmIsStorageOntapInstanceVirtualMachineVolume() *schema.Resource } } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { ontapClient, err := meta.(conns.ClientSession).OntapAPI() if err != nil { return diag.FromErr(err) @@ -272,7 +272,7 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context cifsShare := []map[string]interface{}{} if storageOntapInstanceStorageVirtualMachineVolume.CifsShare != nil { - modelMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(storageOntapInstanceStorageVirtualMachineVolume.CifsShare) + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(storageOntapInstanceStorageVirtualMachineVolume.CifsShare) if err != nil { return diag.FromErr(err) } @@ -292,7 +292,7 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context exportPolicy := []map[string]interface{}{} if storageOntapInstanceStorageVirtualMachineVolume.ExportPolicy != nil { - modelMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(storageOntapInstanceStorageVirtualMachineVolume.ExportPolicy) + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(storageOntapInstanceStorageVirtualMachineVolume.ExportPolicy) if err != nil { return diag.FromErr(err) } @@ -305,7 +305,7 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context healthReasons := []map[string]interface{}{} if storageOntapInstanceStorageVirtualMachineVolume.HealthReasons != nil { for _, modelItem := range storageOntapInstanceStorageVirtualMachineVolume.HealthReasons { - modelMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(&modelItem) + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(&modelItem) if err != nil { return diag.FromErr(err) } @@ -359,11 +359,11 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context return nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShare) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShare) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) accessControlList := []map[string]interface{}{} for _, accessControlListItem := range model.AccessControlList { - accessControlListItemMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(&accessControlListItem) + accessControlListItemMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(&accessControlListItem) if err != nil { return modelMap, err } @@ -375,20 +375,20 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstance return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControl) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControl) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["permission"] = model.Permission modelMap["users"] = model.Users return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicy) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicy) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["mount_path"] = model.MountPath if model.Rules != nil { rules := []map[string]interface{}{} for _, rulesItem := range model.Rules { - rulesItemMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(&rulesItem) + rulesItemMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(&rulesItem) if err != nil { return modelMap, err } @@ -399,12 +399,12 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstance return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRule) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRule) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["access_control"] = model.AccessControl clients := []map[string]interface{}{} for _, clientsItem := range model.Clients { - clientsItemMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(clientsItem) + clientsItemMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(clientsItem) if err != nil { return modelMap, err } @@ -417,15 +417,15 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstance return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(model ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(model ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf) (map[string]interface{}, error) { if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient); ok { modelMap := make(map[string]interface{}) model := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient) @@ -447,31 +447,31 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstance } } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["hostname"] = model.Hostname return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["address"] = model.Address return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["cidr_block"] = model.CidrBlock return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["domain_suffix"] = model.DomainSuffix return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeHealthReason) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeHealthReason) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["code"] = model.Code modelMap["message"] = model.Message diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go new file mode 100644 index 0000000000..6dea9d59f9 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go @@ -0,0 +1,149 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDataSourceBasic(t *testing.T) { + storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_virtual_machine_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "capacity"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "health_reasons.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "health_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_storage_virtual_machine_volume_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "junction_path"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "security_style"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "type"), + ), + }, + }, + }) +} + +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDataSourceAllArgs(t *testing.T) { + storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeCapacity := fmt.Sprintf("%d", acctest.RandIntRange(10, 16000)) + storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency := "false" + storageOntapInstanceStorageVirtualMachineVolumeName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle := "mixed" + storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency := "disabled" + storageOntapInstanceStorageVirtualMachineVolumeType := "data_protection" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_virtual_machine_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "capacity"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "cifs_share.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "created_at"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "enable_storage_efficiency"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "export_policy.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "health_reasons.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "health_reasons.0.code"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "health_reasons.0.message"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "health_reasons.0.more_info"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "health_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "href"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_storage_virtual_machine_volume_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "junction_path"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "lifecycle_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "resource_type"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "security_style"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_efficiency"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "type"), + ), + }, + }, + }) +} + +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string) string { + return fmt.Sprintf(` + resource "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { + storage_ontap_instance_id = "%s" + storage_virtual_machine_id = "%s" + } + + data "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { + storage_ontap_instance_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_ontap_instance_id + storage_virtual_machine_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_virtual_machine_id + id = "id" + } + `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID) +} + +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string, storageOntapInstanceStorageVirtualMachineVolumeCapacity string, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeName string, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle string, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeType string) string { + return fmt.Sprintf(` + resource "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { + storage_ontap_instance_id = "%s" + storage_virtual_machine_id = "%s" + capacity = %s + cifs_share { + access_control_list { + permission = "full_control" + users = ["user1"] + } + mount_path = "//192.168.3.4/my-share" + name = "my-share" + } + enable_storage_efficiency = %s + export_policy { + mount_path = "192.168.3.4:/vol/path" + rules { + access_control = "read_only" + clients { + hostname = "host1" + } + index = 1 + is_superuser = false + nfs_version = ["nfs4"] + } + } + name = "%s" + security_style = "%s" + storage_efficiency = "%s" + type = "%s" + } + + data "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { + storage_ontap_instance_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_ontap_instance_id + storage_virtual_machine_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_virtual_machine_id + id = "id" + } + `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType) +} diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.go similarity index 76% rename from ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes.go rename to ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.go index ea296ea7c7..846aa3c711 100644 --- a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes.go +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.go @@ -17,9 +17,9 @@ import ( "github.com/IBM/vpc-beta-go-sdk/ontapv1" ) -func DataSourceIbmIsStorageOntapInstanceVirtualMachineVolumes() *schema.Resource { +func DataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumes() *schema.Resource { return &schema.Resource{ - ReadContext: dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesRead, + ReadContext: dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesRead, Schema: map[string]*schema.Schema{ "storage_ontap_instance_id": &schema.Schema{ @@ -294,7 +294,7 @@ func DataSourceIbmIsStorageOntapInstanceVirtualMachineVolumes() *schema.Resource } } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { ontapClient, err := meta.(conns.ClientSession).OntapAPI() if err != nil { return diag.FromErr(err) @@ -320,11 +320,11 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesRead(context contex return diag.FromErr(fmt.Errorf("StorageOntapInstanceStorageVirtualMachineVolumesPager.GetAll() failed %s", err)) } - d.SetId(dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesID(d)) + d.SetId(dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesID(d)) mapSlice := []map[string]interface{}{} for _, modelItem := range allItems { - modelMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeToMap(&modelItem) + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeToMap(&modelItem) if err != nil { return diag.FromErr(err) } @@ -338,28 +338,28 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesRead(context contex return nil } -// dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesID returns a reasonable ID for the list. -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesID(d *schema.ResourceData) string { +// dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesID returns a reasonable ID for the list. +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCollectionFirstToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCollectionFirst) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCollectionFirstToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCollectionFirst) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCollectionNextToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCollectionNext) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCollectionNextToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCollectionNext) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolume) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolume) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["capacity"] = flex.IntValue(model.Capacity) if model.CifsShare != nil { - cifsShareMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model.CifsShare) + cifsShareMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model.CifsShare) if err != nil { return modelMap, err } @@ -370,7 +370,7 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanc modelMap["enable_storage_efficiency"] = model.EnableStorageEfficiency } if model.ExportPolicy != nil { - exportPolicyMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model.ExportPolicy) + exportPolicyMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model.ExportPolicy) if err != nil { return modelMap, err } @@ -378,7 +378,7 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanc } healthReasons := []map[string]interface{}{} for _, healthReasonsItem := range model.HealthReasons { - healthReasonsItemMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(&healthReasonsItem) + healthReasonsItemMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(&healthReasonsItem) if err != nil { return modelMap, err } @@ -400,11 +400,11 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanc return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShare) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShare) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) accessControlList := []map[string]interface{}{} for _, accessControlListItem := range model.AccessControlList { - accessControlListItemMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(&accessControlListItem) + accessControlListItemMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(&accessControlListItem) if err != nil { return modelMap, err } @@ -416,20 +416,20 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanc return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControl) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControl) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["permission"] = model.Permission modelMap["users"] = model.Users return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicy) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicy) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["mount_path"] = model.MountPath if model.Rules != nil { rules := []map[string]interface{}{} for _, rulesItem := range model.Rules { - rulesItemMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(&rulesItem) + rulesItemMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(&rulesItem) if err != nil { return modelMap, err } @@ -440,12 +440,12 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanc return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRule) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRule) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["access_control"] = model.AccessControl clients := []map[string]interface{}{} for _, clientsItem := range model.Clients { - clientsItemMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(clientsItem) + clientsItemMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(clientsItem) if err != nil { return modelMap, err } @@ -458,15 +458,15 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanc return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(model ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(model ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf) (map[string]interface{}, error) { if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName); ok { - return dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName)) + return dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient); ok { modelMap := make(map[string]interface{}) model := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient) @@ -488,31 +488,31 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanc } } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["hostname"] = model.Hostname return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["address"] = model.Address return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["cidr_block"] = model.CidrBlock return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["domain_suffix"] = model.DomainSuffix return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeHealthReason) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumesStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeHealthReason) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["code"] = model.Code modelMap["message"] = model.Message diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes_test.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes_test.go new file mode 100644 index 0000000000..41bf601389 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machine_volumes_test.go @@ -0,0 +1,139 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachineVolumesDataSourceBasic(t *testing.T) { + storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumesDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "storage_ontap_instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "storage_virtual_machine_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "first.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "limit"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "total_count"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.#"), + ), + }, + }, + }) +} + +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachineVolumesDataSourceAllArgs(t *testing.T) { + storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeCapacity := fmt.Sprintf("%d", acctest.RandIntRange(10, 16000)) + storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency := "false" + storageOntapInstanceStorageVirtualMachineVolumeName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) + storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle := "mixed" + storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency := "disabled" + storageOntapInstanceStorageVirtualMachineVolumeType := "data_protection" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumesDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "storage_ontap_instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "storage_virtual_machine_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "name"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "first.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "limit"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "next.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "total_count"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.#"), + resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.capacity", storageOntapInstanceStorageVirtualMachineVolumeCapacity), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.created_at"), + resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.enable_storage_efficiency", storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.health_state"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.href"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.junction_path"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.lifecycle_state"), + resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.name", storageOntapInstanceStorageVirtualMachineVolumeName), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.resource_type"), + resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.security_style", storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle), + resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.storage_efficiency", storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency), + resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_storage_virtual_machine_volumes.is_storage_ontap_instance_storage_virtual_machine_volumes", "volumes.0.type", storageOntapInstanceStorageVirtualMachineVolumeType), + ), + }, + }, + }) +} + +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumesDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string) string { + return fmt.Sprintf(` + resource "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { + storage_ontap_instance_id = "%s" + storage_virtual_machine_id = "%s" + } + + data "ibm_is_storage_ontap_instance_storage_virtual_machine_volumes" "is_storage_ontap_instance_storage_virtual_machine_volumes_instance" { + storage_ontap_instance_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_ontap_instance_id + storage_virtual_machine_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_virtual_machine_id + name = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.name + } + `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID) +} + +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumesDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string, storageOntapInstanceStorageVirtualMachineVolumeCapacity string, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeName string, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle string, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeType string) string { + return fmt.Sprintf(` + resource "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { + storage_ontap_instance_id = "%s" + storage_virtual_machine_id = "%s" + capacity = %s + cifs_share { + access_control_list { + permission = "full_control" + users = ["user1"] + } + mount_path = "//192.168.3.4/my-share" + name = "my-share" + } + enable_storage_efficiency = %s + export_policy { + mount_path = "192.168.3.4:/vol/path" + rules { + access_control = "read_only" + clients { + hostname = "host1" + } + index = 1 + is_superuser = false + nfs_version = ["nfs4"] + } + } + name = "%s" + security_style = "%s" + storage_efficiency = "%s" + type = "%s" + } + + data "ibm_is_storage_ontap_instance_storage_virtual_machine_volumes" "is_storage_ontap_instance_storage_virtual_machine_volumes_instance" { + storage_ontap_instance_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_ontap_instance_id + storage_virtual_machine_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_virtual_machine_id + name = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.name + } + `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType) +} diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machines.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machines.go similarity index 81% rename from ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machines.go rename to ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machines.go index c54463b8ce..0e5907a369 100644 --- a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machines.go +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machines.go @@ -16,9 +16,9 @@ import ( "github.com/IBM/vpc-beta-go-sdk/ontapv1" ) -func DataSourceIbmIsStorageOntapInstanceVirtualMachines() *schema.Resource { +func DataSourceIbmIsStorageOntapInstanceStorageVirtualMachines() *schema.Resource { return &schema.Resource{ - ReadContext: dataSourceIbmIsStorageOntapInstanceVirtualMachinesRead, + ReadContext: dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesRead, Schema: map[string]*schema.Schema{ "storage_ontap_instance_id": &schema.Schema{ @@ -328,7 +328,7 @@ func DataSourceIbmIsStorageOntapInstanceVirtualMachines() *schema.Resource { } } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { ontapClient, err := meta.(conns.ClientSession).OntapAPI() if err != nil { return diag.FromErr(err) @@ -353,11 +353,11 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachinesRead(context context.Cont return diag.FromErr(fmt.Errorf("StorageOntapInstanceStorageVirtualMachinesPager.GetAll() failed %s", err)) } - d.SetId(dataSourceIbmIsStorageOntapInstanceVirtualMachinesID(d)) + d.SetId(dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesID(d)) mapSlice := []map[string]interface{}{} for _, modelItem := range allItems { - modelMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineToMap(&modelItem) + modelMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineToMap(&modelItem) if err != nil { return diag.FromErr(err) } @@ -371,48 +371,48 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachinesRead(context context.Cont return nil } -// dataSourceIbmIsStorageOntapInstanceVirtualMachinesID returns a reasonable ID for the list. -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesID(d *schema.ResourceData) string { +// dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesID returns a reasonable ID for the list. +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesID(d *schema.ResourceData) string { return time.Now().UTC().String() } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineCollectionFirstToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineCollectionFirst) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineCollectionFirstToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineCollectionFirst) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineCollectionNextToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineCollectionNext) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineCollectionNextToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineCollectionNext) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["href"] = model.Href return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachine) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachine) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.ActiveDirectory != nil { - activeDirectoryMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineActiveDirectoryToMap(model.ActiveDirectory) + activeDirectoryMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineActiveDirectoryToMap(model.ActiveDirectory) if err != nil { return modelMap, err } modelMap["active_directory"] = []map[string]interface{}{activeDirectoryMap} } if model.AdminCredentials != nil { - adminCredentialsMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineAdminCredentialsToMap(model.AdminCredentials) + adminCredentialsMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineAdminCredentialsToMap(model.AdminCredentials) if err != nil { return modelMap, err } modelMap["admin_credentials"] = []map[string]interface{}{adminCredentialsMap} } if model.AdminPassword != nil { - adminPasswordMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesCredentialReferenceToMap(model.AdminPassword) + adminPasswordMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesCredentialReferenceToMap(model.AdminPassword) if err != nil { return modelMap, err } modelMap["admin_password"] = []map[string]interface{}{adminPasswordMap} } modelMap["created_at"] = model.CreatedAt.String() - endpointsMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineEndpointsToMap(model.Endpoints) + endpointsMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineEndpointsToMap(model.Endpoints) if err != nil { return modelMap, err } @@ -425,20 +425,20 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStora return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineActiveDirectoryToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineActiveDirectory) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineActiveDirectoryToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineActiveDirectory) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["administrators_group"] = model.AdministratorsGroup modelMap["dns_ips"] = model.DnsIps modelMap["domain_name"] = model.DomainName if model.DomainPassword != nil { - domainPasswordMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesCredentialReferenceToMap(model.DomainPassword) + domainPasswordMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesCredentialReferenceToMap(model.DomainPassword) if err != nil { return modelMap, err } modelMap["domain_password"] = []map[string]interface{}{domainPasswordMap} } if model.DomainPasswordCredential != nil { - domainPasswordCredentialMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesCredentialReferenceToMap(model.DomainPasswordCredential) + domainPasswordCredentialMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesCredentialReferenceToMap(model.DomainPasswordCredential) if err != nil { return modelMap, err } @@ -450,31 +450,31 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStora return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesCredentialReferenceToMap(model *ontapv1.CredentialReference) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesCredentialReferenceToMap(model *ontapv1.CredentialReference) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["crn"] = model.Crn modelMap["resource_type"] = model.ResourceType return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineAdminCredentialsToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineAdminCredentials) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineAdminCredentialsToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineAdminCredentials) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) if model.Http != nil { - httpMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesCredentialReferenceToMap(model.Http) + httpMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesCredentialReferenceToMap(model.Http) if err != nil { return modelMap, err } modelMap["http"] = []map[string]interface{}{httpMap} } if model.Password != nil { - passwordMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesCredentialReferenceToMap(model.Password) + passwordMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesCredentialReferenceToMap(model.Password) if err != nil { return modelMap, err } modelMap["password"] = []map[string]interface{}{passwordMap} } if model.Ssh != nil { - sshMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesCredentialReferenceToMap(model.Ssh) + sshMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesCredentialReferenceToMap(model.Ssh) if err != nil { return modelMap, err } @@ -483,22 +483,22 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStora return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStorageVirtualMachineEndpointsToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineEndpoints) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceStorageVirtualMachineEndpointsToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineEndpoints) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) - managementMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceEndpointToMap(model.Management) + managementMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceEndpointToMap(model.Management) if err != nil { return modelMap, err } modelMap["management"] = []map[string]interface{}{managementMap} if model.Nfs != nil { - nfsMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceEndpointToMap(model.Nfs) + nfsMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceEndpointToMap(model.Nfs) if err != nil { return modelMap, err } modelMap["nfs"] = []map[string]interface{}{nfsMap} } if model.Smb != nil { - smbMap, err := dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceEndpointToMap(model.Smb) + smbMap, err := dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceEndpointToMap(model.Smb) if err != nil { return modelMap, err } @@ -507,7 +507,7 @@ func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceStora return modelMap, nil } -func dataSourceIbmIsStorageOntapInstanceVirtualMachinesStorageOntapInstanceEndpointToMap(model *ontapv1.StorageOntapInstanceEndpoint) (map[string]interface{}, error) { +func dataSourceIbmIsStorageOntapInstanceStorageVirtualMachinesStorageOntapInstanceEndpointToMap(model *ontapv1.StorageOntapInstanceEndpoint) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["ipv4_address"] = model.Ipv4Address return modelMap, nil diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machines_test.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machines_test.go new file mode 100644 index 0000000000..a4b550a510 --- /dev/null +++ b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_storage_virtual_machines_test.go @@ -0,0 +1,42 @@ +// Copyright IBM Corp. 2023 All Rights Reserved. +// Licensed under the Mozilla Public License v2.0 + +package vpc_test + +import ( + "fmt" + "testing" + + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" + + acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" +) + +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachinesDataSourceBasic(t *testing.T) { + resource.Test(t, resource.TestCase{ + PreCheck: func() { acc.TestAccPreCheck(t) }, + Providers: acc.TestAccProviders, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachinesDataSourceConfigBasic(), + Check: resource.ComposeTestCheckFunc( + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machines.is_storage_ontap_instance_storage_virtual_machines", "id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machines.is_storage_ontap_instance_storage_virtual_machines", "storage_ontap_instance_id"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machines.is_storage_ontap_instance_storage_virtual_machines", "first.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machines.is_storage_ontap_instance_storage_virtual_machines", "limit"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machines.is_storage_ontap_instance_storage_virtual_machines", "storage_virtual_machines.#"), + resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_storage_virtual_machines.is_storage_ontap_instance_storage_virtual_machines", "total_count"), + ), + }, + }, + }) +} + +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachinesDataSourceConfigBasic() string { + return fmt.Sprintf(` + data "ibm_is_storage_ontap_instance_storage_virtual_machines" "is_storage_ontap_instance_storage_virtual_machines_instance" { + storage_ontap_instance_id = "storage_ontap_instance_id" + name = "name" + } + `) +} diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go deleted file mode 100644 index d26f5cfa2b..0000000000 --- a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package vpc_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" -) - -func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumeDataSourceBasic(t *testing.T) { - storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_virtual_machine_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "capacity"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "health_reasons.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "health_state"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_storage_virtual_machine_volume_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "junction_path"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "lifecycle_state"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "resource_type"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "security_style"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "type"), - ), - }, - }, - }) -} - -func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumeDataSourceAllArgs(t *testing.T) { - storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeCapacity := fmt.Sprintf("%d", acctest.RandIntRange(10, 16000)) - storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency := "false" - storageOntapInstanceStorageVirtualMachineVolumeName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle := "mixed" - storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency := "disabled" - storageOntapInstanceStorageVirtualMachineVolumeType := "data_protection" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_virtual_machine_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "capacity"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "cifs_share.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "created_at"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "enable_storage_efficiency"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "export_policy.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "health_reasons.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "health_reasons.0.code"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "health_reasons.0.message"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "health_reasons.0.more_info"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "health_state"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "href"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_storage_virtual_machine_volume_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "junction_path"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "lifecycle_state"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "resource_type"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "security_style"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_efficiency"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "type"), - ), - }, - }, - }) -} - -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string) string { - return fmt.Sprintf(` - resource "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { - storage_ontap_instance_id = "%s" - storage_virtual_machine_id = "%s" - } - - data "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { - storage_ontap_instance_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_ontap_instance_id - storage_virtual_machine_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_virtual_machine_id - id = "id" - } - `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID) -} - -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string, storageOntapInstanceStorageVirtualMachineVolumeCapacity string, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeName string, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle string, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeType string) string { - return fmt.Sprintf(` - resource "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { - storage_ontap_instance_id = "%s" - storage_virtual_machine_id = "%s" - capacity = %s - cifs_share { - access_control_list { - permission = "full_control" - users = ["user1"] - } - mount_path = "//192.168.3.4/my-share" - name = "my-share" - } - enable_storage_efficiency = %s - export_policy { - mount_path = "192.168.3.4:/vol/path" - rules { - access_control = "read_only" - clients { - hostname = "host1" - } - index = 1 - is_superuser = false - nfs_version = ["nfs4"] - } - } - name = "%s" - security_style = "%s" - storage_efficiency = "%s" - type = "%s" - } - - data "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { - storage_ontap_instance_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_ontap_instance_id - storage_virtual_machine_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_virtual_machine_id - id = "id" - } - `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType) -} diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes_test.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes_test.go deleted file mode 100644 index 04a6f949f3..0000000000 --- a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machine_volumes_test.go +++ /dev/null @@ -1,139 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package vpc_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/acctest" - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" -) - -func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumesDataSourceBasic(t *testing.T) { - storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumesDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "storage_ontap_instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "storage_virtual_machine_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "first.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "limit"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "total_count"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.#"), - ), - }, - }, - }) -} - -func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumesDataSourceAllArgs(t *testing.T) { - storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeCapacity := fmt.Sprintf("%d", acctest.RandIntRange(10, 16000)) - storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency := "false" - storageOntapInstanceStorageVirtualMachineVolumeName := fmt.Sprintf("tf_name_%d", acctest.RandIntRange(10, 100)) - storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle := "mixed" - storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency := "disabled" - storageOntapInstanceStorageVirtualMachineVolumeType := "data_protection" - - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumesDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "storage_ontap_instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "storage_virtual_machine_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "name"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "first.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "limit"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "next.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "total_count"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.#"), - resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.capacity", storageOntapInstanceStorageVirtualMachineVolumeCapacity), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.created_at"), - resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.enable_storage_efficiency", storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.health_state"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.href"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.junction_path"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.lifecycle_state"), - resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.name", storageOntapInstanceStorageVirtualMachineVolumeName), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.resource_type"), - resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.security_style", storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle), - resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.storage_efficiency", storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency), - resource.TestCheckResourceAttr("data.ibm_is_storage_ontap_instance_virtual_machine_volumes.is_storage_ontap_instance_virtual_machine_volumes", "volumes.0.type", storageOntapInstanceStorageVirtualMachineVolumeType), - ), - }, - }, - }) -} - -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumesDataSourceConfigBasic(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string) string { - return fmt.Sprintf(` - resource "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { - storage_ontap_instance_id = "%s" - storage_virtual_machine_id = "%s" - } - - data "ibm_is_storage_ontap_instance_virtual_machine_volumes" "is_storage_ontap_instance_virtual_machine_volumes_instance" { - storage_ontap_instance_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_ontap_instance_id - storage_virtual_machine_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_virtual_machine_id - name = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.name - } - `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID) -} - -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumesDataSourceConfig(storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID string, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID string, storageOntapInstanceStorageVirtualMachineVolumeCapacity string, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeName string, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle string, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency string, storageOntapInstanceStorageVirtualMachineVolumeType string) string { - return fmt.Sprintf(` - resource "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { - storage_ontap_instance_id = "%s" - storage_virtual_machine_id = "%s" - capacity = %s - cifs_share { - access_control_list { - permission = "full_control" - users = ["user1"] - } - mount_path = "//192.168.3.4/my-share" - name = "my-share" - } - enable_storage_efficiency = %s - export_policy { - mount_path = "192.168.3.4:/vol/path" - rules { - access_control = "read_only" - clients { - hostname = "host1" - } - index = 1 - is_superuser = false - nfs_version = ["nfs4"] - } - } - name = "%s" - security_style = "%s" - storage_efficiency = "%s" - type = "%s" - } - - data "ibm_is_storage_ontap_instance_virtual_machine_volumes" "is_storage_ontap_instance_virtual_machine_volumes_instance" { - storage_ontap_instance_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_ontap_instance_id - storage_virtual_machine_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_virtual_machine_id - name = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.name - } - `, storageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceID, storageOntapInstanceStorageVirtualMachineVolumeStorageVirtualMachineID, storageOntapInstanceStorageVirtualMachineVolumeCapacity, storageOntapInstanceStorageVirtualMachineVolumeEnableStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeName, storageOntapInstanceStorageVirtualMachineVolumeSecurityStyle, storageOntapInstanceStorageVirtualMachineVolumeStorageEfficiency, storageOntapInstanceStorageVirtualMachineVolumeType) -} diff --git a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machines_test.go b/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machines_test.go deleted file mode 100644 index 8e7cd284df..0000000000 --- a/ibm/service/vpc/data_source_ibm_is_storage_ontap_instance_virtual_machines_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright IBM Corp. 2023 All Rights Reserved. -// Licensed under the Mozilla Public License v2.0 - -package vpc_test - -import ( - "fmt" - "testing" - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/resource" - - acc "github.com/IBM-Cloud/terraform-provider-ibm/ibm/acctest" -) - -func TestAccIbmIsStorageOntapInstanceVirtualMachinesDataSourceBasic(t *testing.T) { - resource.Test(t, resource.TestCase{ - PreCheck: func() { acc.TestAccPreCheck(t) }, - Providers: acc.TestAccProviders, - Steps: []resource.TestStep{ - resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachinesDataSourceConfigBasic(), - Check: resource.ComposeTestCheckFunc( - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machines.is_storage_ontap_instance_virtual_machines", "id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machines.is_storage_ontap_instance_virtual_machines", "storage_ontap_instance_id"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machines.is_storage_ontap_instance_virtual_machines", "first.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machines.is_storage_ontap_instance_virtual_machines", "limit"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machines.is_storage_ontap_instance_virtual_machines", "storage_virtual_machines.#"), - resource.TestCheckResourceAttrSet("data.ibm_is_storage_ontap_instance_virtual_machines.is_storage_ontap_instance_virtual_machines", "total_count"), - ), - }, - }, - }) -} - -func testAccCheckIbmIsStorageOntapInstanceVirtualMachinesDataSourceConfigBasic() string { - return fmt.Sprintf(` - data "ibm_is_storage_ontap_instance_virtual_machines" "is_storage_ontap_instance_virtual_machines_instance" { - storage_ontap_instance_id = "storage_ontap_instance_id" - name = "name" - } - `) -} diff --git a/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_virtual_machine_volume.go b/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go similarity index 75% rename from ibm/service/vpc/resource_ibm_is_storage_ontap_instance_virtual_machine_volume.go rename to ibm/service/vpc/resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go index 6d3e8d71b3..ddf39235c3 100644 --- a/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_virtual_machine_volume.go +++ b/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume.go @@ -18,12 +18,12 @@ import ( "github.com/IBM/vpc-beta-go-sdk/ontapv1" ) -func ResourceIbmIsStorageOntapInstanceVirtualMachineVolume() *schema.Resource { +func ResourceIbmIsStorageOntapInstanceStorageVirtualMachineVolume() *schema.Resource { return &schema.Resource{ - CreateContext: resourceIbmIsStorageOntapInstanceVirtualMachineVolumeCreate, - ReadContext: resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead, - UpdateContext: resourceIbmIsStorageOntapInstanceVirtualMachineVolumeUpdate, - DeleteContext: resourceIbmIsStorageOntapInstanceVirtualMachineVolumeDelete, + CreateContext: resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeCreate, + ReadContext: resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeRead, + UpdateContext: resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeUpdate, + DeleteContext: resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDelete, Importer: &schema.ResourceImporter{}, Schema: map[string]*schema.Schema{ @@ -31,20 +31,20 @@ func ResourceIbmIsStorageOntapInstanceVirtualMachineVolume() *schema.Resource { Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_id"), + ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_id"), Description: "The storage ontap instance identifier.", }, "storage_virtual_machine_id": &schema.Schema{ Type: schema.TypeString, Required: true, ForceNew: true, - ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_virtual_machine_volume", "storage_virtual_machine_id"), + ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_storage_virtual_machine_volume", "storage_virtual_machine_id"), Description: "The storage virtual machine identifier.", }, "capacity": &schema.Schema{ Type: schema.TypeInt, Optional: true, - ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_virtual_machine_volume", "capacity"), + ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_storage_virtual_machine_volume", "capacity"), Description: "The capacity of the storage volume (in gigabytes).", }, "cifs_share": &schema.Schema{ @@ -171,28 +171,28 @@ func ResourceIbmIsStorageOntapInstanceVirtualMachineVolume() *schema.Resource { "name": &schema.Schema{ Type: schema.TypeString, Optional: true, - ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_virtual_machine_volume", "name"), + ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_storage_virtual_machine_volume", "name"), Description: "The name for this storage volume. The name is unique across all storage volumes in the storage virtual machine.", }, "security_style": &schema.Schema{ Type: schema.TypeString, Optional: true, Default: "mixed", - ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_virtual_machine_volume", "security_style"), + ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_storage_virtual_machine_volume", "security_style"), Description: "The security style for the storage volume:- `unix`: NFS clients can access the storage volume.- `windows`: SMB/CIFS clients can access the storage volume.- `mixed`: Both SMB/CIFS and NFS clients can access the storage volume.- `none`: No clients can access the volume.", }, "storage_efficiency": &schema.Schema{ Type: schema.TypeString, Optional: true, Default: "enabled", - ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_virtual_machine_volume", "storage_efficiency"), + ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_storage_virtual_machine_volume", "storage_efficiency"), Description: "The storage efficiency mode used for this storage volume.- `disabled`: storage efficiency methods will not be used- `enabled`: data-deduplication, compression and other methods will be used.", }, "type": &schema.Schema{ Type: schema.TypeString, Optional: true, Default: "read_write", - ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_virtual_machine_volume", "type"), + ValidateFunc: validate.InvokeValidator("ibm_is_storage_ontap_instance_storage_virtual_machine_volume", "type"), Description: "The type of the storage volume.", }, "created_at": &schema.Schema{ @@ -262,7 +262,7 @@ func ResourceIbmIsStorageOntapInstanceVirtualMachineVolume() *schema.Resource { } } -func ResourceIbmIsStorageOntapInstanceVirtualMachineVolumeValidator() *validate.ResourceValidator { +func ResourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeValidator() *validate.ResourceValidator { validateSchema := make([]validate.ValidateSchema, 0) validateSchema = append(validateSchema, validate.ValidateSchema{ @@ -332,11 +332,11 @@ func ResourceIbmIsStorageOntapInstanceVirtualMachineVolumeValidator() *validate. }, ) - resourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_storage_ontap_instance_virtual_machine_volume", Schema: validateSchema} + resourceValidator := validate.ResourceValidator{ResourceName: "ibm_is_storage_ontap_instance_storage_virtual_machine_volume", Schema: validateSchema} return &resourceValidator } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeCreate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { ontapClient, err := meta.(conns.ClientSession).OntapAPI() if err != nil { return diag.FromErr(err) @@ -371,7 +371,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeCreate(context context } createStorageOntapInstanceStorageVirtualMachineVolumeOptions.SetStorageOntapInstanceID(d.Get("storage_ontap_instance_id").(string)) createStorageOntapInstanceStorageVirtualMachineVolumeOptions.SetStorageVirtualMachineID(d.Get("storage_virtual_machine_id").(string)) - convertedModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumePrototype(bodyModelMap) + convertedModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumePrototype(bodyModelMap) if err != nil { return diag.FromErr(err) } @@ -385,10 +385,10 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeCreate(context context d.SetId(fmt.Sprintf("%s/%s/%s", *createStorageOntapInstanceStorageVirtualMachineVolumeOptions.StorageOntapInstanceID, *createStorageOntapInstanceStorageVirtualMachineVolumeOptions.StorageVirtualMachineID, *storageOntapInstanceStorageVirtualMachineVolume.ID)) - return resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context, d, meta) + return resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeRead(context, d, meta) } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeRead(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { ontapClient, err := meta.(conns.ClientSession).OntapAPI() if err != nil { return diag.FromErr(err) @@ -421,7 +421,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context.C } } if !core.IsNil(storageOntapInstanceStorageVirtualMachineVolume.CifsShare) { - cifsShareMap, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(storageOntapInstanceStorageVirtualMachineVolume.CifsShare) + cifsShareMap, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(storageOntapInstanceStorageVirtualMachineVolume.CifsShare) if err != nil { return diag.FromErr(err) } @@ -435,7 +435,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context.C } } if !core.IsNil(storageOntapInstanceStorageVirtualMachineVolume.ExportPolicy) { - exportPolicyMap, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(storageOntapInstanceStorageVirtualMachineVolume.ExportPolicy) + exportPolicyMap, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(storageOntapInstanceStorageVirtualMachineVolume.ExportPolicy) if err != nil { return diag.FromErr(err) } @@ -468,7 +468,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context.C } healthReasons := []map[string]interface{}{} for _, healthReasonsItem := range storageOntapInstanceStorageVirtualMachineVolume.HealthReasons { - healthReasonsItemMap, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(&healthReasonsItem) + healthReasonsItemMap, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(&healthReasonsItem) if err != nil { return diag.FromErr(err) } @@ -502,7 +502,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context context.C return nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeUpdate(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { ontapClient, err := meta.(conns.ClientSession).OntapAPI() if err != nil { return diag.FromErr(err) @@ -536,7 +536,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeUpdate(context context hasChange = true } if d.HasChange("cifs_share") { - cifsShare, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePatch(d.Get("cifs_share.0").(map[string]interface{})) + cifsShare, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePatch(d.Get("cifs_share.0").(map[string]interface{})) if err != nil { return diag.FromErr(err) } @@ -544,7 +544,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeUpdate(context context hasChange = true } if d.HasChange("export_policy") { - exportPolicy, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPatch(d.Get("export_policy.0").(map[string]interface{})) + exportPolicy, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPatch(d.Get("export_policy.0").(map[string]interface{})) if err != nil { return diag.FromErr(err) } @@ -572,10 +572,10 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeUpdate(context context } } - return resourceIbmIsStorageOntapInstanceVirtualMachineVolumeRead(context, d, meta) + return resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeRead(context, d, meta) } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDelete(context context.Context, d *schema.ResourceData, meta interface{}) diag.Diagnostics { ontapClient, err := meta.(conns.ClientSession).OntapAPI() if err != nil { return diag.FromErr(err) @@ -603,11 +603,11 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeDelete(context context return nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype{} accessControlList := []ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype{} for _, accessControlListItem := range modelMap["access_control_list"].([]interface{}) { - accessControlListItemModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype(accessControlListItem.(map[string]interface{})) + accessControlListItemModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype(accessControlListItem.(map[string]interface{})) if err != nil { return model, err } @@ -618,7 +618,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype{} model.Permission = core.StringPtr(modelMap["permission"].(string)) users := []string{} @@ -629,12 +629,12 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype{} if modelMap["rules"] != nil { rules := []ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype{} for _, rulesItem := range modelMap["rules"].([]interface{}) { - rulesItemModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype(rulesItem.(map[string]interface{})) + rulesItemModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype(rulesItem.(map[string]interface{})) if err != nil { return model, err } @@ -645,14 +645,14 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype{} if modelMap["access_control"] != nil && modelMap["access_control"].(string) != "" { model.AccessControl = core.StringPtr(modelMap["access_control"].(string)) } clients := []ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf{} for _, clientsItem := range modelMap["clients"].([]interface{}) { - clientsItemModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient(clientsItem.(map[string]interface{})) + clientsItemModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient(clientsItem.(map[string]interface{})) if err != nil { return model, err } @@ -672,7 +672,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient(modelMap map[string]interface{}) (ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient(modelMap map[string]interface{}) (ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient{} if modelMap["hostname"] != nil && modelMap["hostname"].(string) != "" { model.Hostname = core.StringPtr(modelMap["hostname"].(string)) @@ -689,36 +689,36 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname{} model.Hostname = core.StringPtr(modelMap["hostname"].(string)) return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP{} model.Address = core.StringPtr(modelMap["address"].(string)) return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR{} model.CidrBlock = core.StringPtr(modelMap["cidr_block"].(string)) return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName{} model.DomainSuffix = core.StringPtr(modelMap["domain_suffix"].(string)) return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePatch(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePatch, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePatch(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePatch, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePatch{} if modelMap["access_control_list"] != nil { accessControlList := []ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype{} for _, accessControlListItem := range modelMap["access_control_list"].([]interface{}) { - accessControlListItemModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype(accessControlListItem.(map[string]interface{})) + accessControlListItemModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlPrototype(accessControlListItem.(map[string]interface{})) if err != nil { return model, err } @@ -732,12 +732,12 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPatch(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPatch, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPatch(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPatch, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPatch{} if modelMap["rules"] != nil { rules := []ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype{} for _, rulesItem := range modelMap["rules"].([]interface{}) { - rulesItemModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype(rulesItem.(map[string]interface{})) + rulesItemModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRulePrototype(rulesItem.(map[string]interface{})) if err != nil { return model, err } @@ -748,7 +748,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumePrototype(modelMap map[string]interface{}) (ontapv1.StorageOntapInstanceStorageVirtualMachineVolumePrototypeIntf, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumePrototype(modelMap map[string]interface{}) (ontapv1.StorageOntapInstanceStorageVirtualMachineVolumePrototypeIntf, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumePrototype{} if modelMap["name"] != nil && modelMap["name"].(string) != "" { model.Name = core.StringPtr(modelMap["name"].(string)) @@ -757,7 +757,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta model.Capacity = core.Int64Ptr(int64(modelMap["capacity"].(int))) } if modelMap["cifs_share"] != nil && len(modelMap["cifs_share"].([]interface{})) > 0 { - CifsShareModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype(modelMap["cifs_share"].([]interface{})[0].(map[string]interface{})) + CifsShareModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype(modelMap["cifs_share"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err } @@ -767,7 +767,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta model.EnableStorageEfficiency = core.BoolPtr(modelMap["enable_storage_efficiency"].(bool)) } if modelMap["export_policy"] != nil && len(modelMap["export_policy"].([]interface{})) > 0 { - ExportPolicyModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype(modelMap["export_policy"].([]interface{})[0].(map[string]interface{})) + ExportPolicyModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype(modelMap["export_policy"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err } @@ -785,14 +785,14 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumePrototypeStorageOntapInstanceStorageVirtualMachineVolumeByCapacity(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumePrototypeStorageOntapInstanceStorageVirtualMachineVolumeByCapacity, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumePrototypeStorageOntapInstanceStorageVirtualMachineVolumeByCapacity(modelMap map[string]interface{}) (*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumePrototypeStorageOntapInstanceStorageVirtualMachineVolumeByCapacity, error) { model := &ontapv1.StorageOntapInstanceStorageVirtualMachineVolumePrototypeStorageOntapInstanceStorageVirtualMachineVolumeByCapacity{} if modelMap["name"] != nil && modelMap["name"].(string) != "" { model.Name = core.StringPtr(modelMap["name"].(string)) } model.Capacity = core.Int64Ptr(int64(modelMap["capacity"].(int))) if modelMap["cifs_share"] != nil && len(modelMap["cifs_share"].([]interface{})) > 0 { - CifsShareModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype(modelMap["cifs_share"].([]interface{})[0].(map[string]interface{})) + CifsShareModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeCIFSSharePrototype(modelMap["cifs_share"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err } @@ -802,7 +802,7 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta model.EnableStorageEfficiency = core.BoolPtr(modelMap["enable_storage_efficiency"].(bool)) } if modelMap["export_policy"] != nil && len(modelMap["export_policy"].([]interface{})) > 0 { - ExportPolicyModel, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype(modelMap["export_policy"].([]interface{})[0].(map[string]interface{})) + ExportPolicyModel, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeMapToStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyPrototype(modelMap["export_policy"].([]interface{})[0].(map[string]interface{})) if err != nil { return model, err } @@ -820,11 +820,11 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeMapToStorageOntapInsta return model, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShare) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShare) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) accessControlList := []map[string]interface{}{} for _, accessControlListItem := range model.AccessControlList { - accessControlListItemMap, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(&accessControlListItem) + accessControlListItemMap, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(&accessControlListItem) if err != nil { return modelMap, err } @@ -836,20 +836,20 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceSt return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControl) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControlToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeCIFSShareAccessControl) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["permission"] = model.Permission modelMap["users"] = model.Users return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicy) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicy) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["mount_path"] = model.MountPath if model.Rules != nil { rules := []map[string]interface{}{} for _, rulesItem := range model.Rules { - rulesItemMap, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(&rulesItem) + rulesItemMap, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(&rulesItem) if err != nil { return modelMap, err } @@ -860,12 +860,12 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceSt return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRule) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRule) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["access_control"] = model.AccessControl clients := []map[string]interface{}{} for _, clientsItem := range model.Clients { - clientsItemMap, err := resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(clientsItem) + clientsItemMap, err := resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(clientsItem) if err != nil { return modelMap, err } @@ -878,15 +878,15 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceSt return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(model ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientToMap(model ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientIntf) (map[string]interface{}, error) { if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname); ok { - return resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname)) + return resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP); ok { - return resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP)) + return resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR); ok { - return resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR)) + return resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName); ok { - return resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName)) + return resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName)) } else if _, ok := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient); ok { modelMap := make(map[string]interface{}) model := model.(*ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClient) @@ -908,31 +908,31 @@ func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceSt } } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostnameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByHostname) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["hostname"] = model.Hostname return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIPToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByIP) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["address"] = model.Address return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDRToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByCIDR) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["cidr_block"] = model.CidrBlock return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainNameToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeExportPolicyRuleClientByDomainName) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["domain_suffix"] = model.DomainSuffix return modelMap, nil } -func resourceIbmIsStorageOntapInstanceVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeHealthReason) (map[string]interface{}, error) { +func resourceIbmIsStorageOntapInstanceStorageVirtualMachineVolumeStorageOntapInstanceStorageVirtualMachineVolumeHealthReasonToMap(model *ontapv1.StorageOntapInstanceStorageVirtualMachineVolumeHealthReason) (map[string]interface{}, error) { modelMap := make(map[string]interface{}) modelMap["code"] = model.Code modelMap["message"] = model.Message diff --git a/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go b/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go similarity index 56% rename from ibm/service/vpc/resource_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go rename to ibm/service/vpc/resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go index f769061896..19b49a5cf5 100644 --- a/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_virtual_machine_volume_test.go +++ b/ibm/service/vpc/resource_ibm_is_storage_ontap_instance_storage_virtual_machine_volume_test.go @@ -17,7 +17,7 @@ import ( "github.com/IBM/vpc-beta-go-sdk/ontapv1" ) -func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumeBasic(t *testing.T) { +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachineVolumeBasic(t *testing.T) { var conf ontapv1.StorageOntapInstanceStorageVirtualMachineVolume storageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) storageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) @@ -25,21 +25,21 @@ func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumeBasic(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeDestroy, + CheckDestroy: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeConfigBasic(storageOntapInstanceID, storageVirtualMachineID), + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeConfigBasic(storageOntapInstanceID, storageVirtualMachineID), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeExists("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", conf), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_id", storageOntapInstanceID), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_virtual_machine_id", storageVirtualMachineID), + testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeExists("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", conf), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_id", storageOntapInstanceID), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_virtual_machine_id", storageVirtualMachineID), ), }, }, }) } -func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumeAllArgs(t *testing.T) { +func TestAccIbmIsStorageOntapInstanceStorageVirtualMachineVolumeAllArgs(t *testing.T) { var conf ontapv1.StorageOntapInstanceStorageVirtualMachineVolume storageOntapInstanceID := fmt.Sprintf("tf_storage_ontap_instance_id_%d", acctest.RandIntRange(10, 100)) storageVirtualMachineID := fmt.Sprintf("tf_storage_virtual_machine_id_%d", acctest.RandIntRange(10, 100)) @@ -59,37 +59,37 @@ func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumeAllArgs(t *testing.T) { resource.Test(t, resource.TestCase{ PreCheck: func() { acc.TestAccPreCheck(t) }, Providers: acc.TestAccProviders, - CheckDestroy: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeDestroy, + CheckDestroy: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDestroy, Steps: []resource.TestStep{ resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeConfig(storageOntapInstanceID, storageVirtualMachineID, capacity, enableStorageEfficiency, name, securityStyle, storageEfficiency, typeVar), + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeConfig(storageOntapInstanceID, storageVirtualMachineID, capacity, enableStorageEfficiency, name, securityStyle, storageEfficiency, typeVar), Check: resource.ComposeAggregateTestCheckFunc( - testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeExists("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", conf), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_id", storageOntapInstanceID), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_virtual_machine_id", storageVirtualMachineID), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "capacity", capacity), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "enable_storage_efficiency", enableStorageEfficiency), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "name", name), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "security_style", securityStyle), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_efficiency", storageEfficiency), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "type", typeVar), + testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeExists("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", conf), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_id", storageOntapInstanceID), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_virtual_machine_id", storageVirtualMachineID), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "capacity", capacity), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "enable_storage_efficiency", enableStorageEfficiency), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "name", name), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "security_style", securityStyle), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_efficiency", storageEfficiency), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "type", typeVar), ), }, resource.TestStep{ - Config: testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeConfig(storageOntapInstanceID, storageVirtualMachineID, capacityUpdate, enableStorageEfficiencyUpdate, nameUpdate, securityStyleUpdate, storageEfficiencyUpdate, typeVarUpdate), + Config: testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeConfig(storageOntapInstanceID, storageVirtualMachineID, capacityUpdate, enableStorageEfficiencyUpdate, nameUpdate, securityStyleUpdate, storageEfficiencyUpdate, typeVarUpdate), Check: resource.ComposeAggregateTestCheckFunc( - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_ontap_instance_id", storageOntapInstanceID), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_virtual_machine_id", storageVirtualMachineID), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "capacity", capacityUpdate), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "enable_storage_efficiency", enableStorageEfficiencyUpdate), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "name", nameUpdate), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "security_style", securityStyleUpdate), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "storage_efficiency", storageEfficiencyUpdate), - resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", "type", typeVarUpdate), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_ontap_instance_id", storageOntapInstanceID), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_virtual_machine_id", storageVirtualMachineID), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "capacity", capacityUpdate), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "enable_storage_efficiency", enableStorageEfficiencyUpdate), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "name", nameUpdate), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "security_style", securityStyleUpdate), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "storage_efficiency", storageEfficiencyUpdate), + resource.TestCheckResourceAttr("ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", "type", typeVarUpdate), ), }, resource.TestStep{ - ResourceName: "ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume", + ResourceName: "ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume", ImportState: true, ImportStateVerify: true, }, @@ -97,19 +97,19 @@ func TestAccIbmIsStorageOntapInstanceVirtualMachineVolumeAllArgs(t *testing.T) { }) } -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeConfigBasic(storageOntapInstanceID string, storageVirtualMachineID string) string { +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeConfigBasic(storageOntapInstanceID string, storageVirtualMachineID string) string { return fmt.Sprintf(` - resource "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { + resource "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { storage_ontap_instance_id = "%s" storage_virtual_machine_id = "%s" } `, storageOntapInstanceID, storageVirtualMachineID) } -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeConfig(storageOntapInstanceID string, storageVirtualMachineID string, capacity string, enableStorageEfficiency string, name string, securityStyle string, storageEfficiency string, typeVar string) string { +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeConfig(storageOntapInstanceID string, storageVirtualMachineID string, capacity string, enableStorageEfficiency string, name string, securityStyle string, storageEfficiency string, typeVar string) string { return fmt.Sprintf(` - resource "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { + resource "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { storage_ontap_instance_id = "%s" storage_virtual_machine_id = "%s" capacity = %s @@ -140,7 +140,7 @@ func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeConfig(storageOnta `, storageOntapInstanceID, storageVirtualMachineID, capacity, enableStorageEfficiency, name, securityStyle, storageEfficiency, typeVar) } -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeExists(n string, obj ontapv1.StorageOntapInstanceStorageVirtualMachineVolume) resource.TestCheckFunc { +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeExists(n string, obj ontapv1.StorageOntapInstanceStorageVirtualMachineVolume) resource.TestCheckFunc { return func(s *terraform.State) error { rs, ok := s.RootModule().Resources[n] @@ -174,13 +174,13 @@ func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeExists(n string, o } } -func testAccCheckIbmIsStorageOntapInstanceVirtualMachineVolumeDestroy(s *terraform.State) error { +func testAccCheckIbmIsStorageOntapInstanceStorageVirtualMachineVolumeDestroy(s *terraform.State) error { ontapClient, err := acc.TestAccProvider.Meta().(conns.ClientSession).OntapAPI() if err != nil { return err } for _, rs := range s.RootModule().Resources { - if rs.Type != "ibm_is_storage_ontap_instance_virtual_machine_volume" { + if rs.Type != "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" { continue } diff --git a/website/docs/d/is_storage_ontap_instance_storage_virtual_machine.html.markdown b/website/docs/d/is_storage_ontap_instance_storage_virtual_machine.html.markdown new file mode 100644 index 0000000000..718dc05714 --- /dev/null +++ b/website/docs/d/is_storage_ontap_instance_storage_virtual_machine.html.markdown @@ -0,0 +1,119 @@ +--- +layout: "ibm" +page_title: "IBM : ibm_is_storage_ontap_instance_storage_virtual_machine" +description: |- + Get information about StorageOntapInstanceStorageVirtualMachine +subcategory: "ontap" +--- + +# ibm_is_storage_ontap_instance_storage_virtual_machine + +Provides a read-only data source to retrieve information about a StorageOntapInstanceStorageVirtualMachine. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. + +## Example Usage + +```hcl +data "ibm_is_storage_ontap_instance_storage_virtual_machine" "is_storage_ontap_instance_storage_virtual_machine" { + id = "id" + storage_ontap_instance_id = "storage_ontap_instance_id" +} +``` + +## Argument Reference + +You can specify the following arguments for this data source. + +* `id` - (Required, Forces new resource, String) The storage virtual machine identifier. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. +* `storage_ontap_instance_id` - (Required, Forces new resource, String) The storage ontap instance identifier. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. The value must match regular expression `/^[-0-9a-z_]+$/`. + +## Attribute Reference + +After your data source is created, you can read values from the following attributes. + +* `id` - The unique identifier of the StorageOntapInstanceStorageVirtualMachine. +* `active_directory` - (List) The Active Directory service this storage virtual machine is joined to.If absent, this storage virtual machine is not joined to an Active Directory service. +Nested schema for **active_directory**: + * `administrators_group` - (String) The name of the domain group whose members have been granted administrative privileges for this storage virtual machine. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. + * `dns_ips` - (List) The IP addresses of the Active Directory DNS servers or domain controllers. + * Constraints: The list items must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. The maximum length is `3` items. The minimum length is `1` item. + * `domain_name` - (String) The fully qualified domain name of the self-managed Active Directory. + * Constraints: The maximum length is `255` characters. The minimum length is `4` characters. The value must match regular expression `/^((?=[A-Za-z0-9-]{1,63}\\.)[A-Za-z0-9-]*\\.)+[A-Za-z]{2,63}\\.?$/`. + * `domain_password` - (List) The password credential for the Active Directory domain. + Nested schema for **domain_password**: + * `crn` - (String) The CRN for this credential. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `credential`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + * `domain_password_credential` - (List) The password credential for the Active Directory domain. + Nested schema for **domain_password_credential**: + * `crn` - (String) The CRN for this credential. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `credential`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + * `netbios_name` - (String) The name of the Active Directory computer object that will be created for the storage virtual machine. + * Constraints: The maximum length is `15` characters. The minimum length is `1` character. The value must match regular expression `/^[\\S]{1,15}$/`. + * `organizational_unit_distinguished_name` - (String) The distinguished name of the organizational unit within the self-managed Active Directory. + * Constraints: The maximum length is `64` characters. The minimum length is `1` character. + * `username` - (String) The username that this storage virtual machine will use when joining the Active Directory domain. This username will be the same as the username credential used in `domain_password_credential`. + * Constraints: The maximum length is `256` characters. The minimum length is `1` character. The value must match regular expression `/^([a-zA-Z0-9~!@#$%^&*()\\\\\\\\\\\\-_. ]+)+$/`. + +* `admin_credentials` - (List) The credentials used for the administrator to access the storage virtual machine of thestorage ontap instance. At least one of `password`, `ssh`, or `http` will be present. +Nested schema for **admin_credentials**: + * `http` - (List) The security certificate credential for ONTAP REST API access for the storage virtualmachine administrator. + Nested schema for **http**: + * `crn` - (String) The CRN for this credential. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `credential`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + * `password` - (List) The password credential for the storage virtual machine administrator.If present, this password credential is used by the storage virtual machineadministrator for both ONTAP CLI SSH access and ONTAP REST API access.If absent, the storage virtual machine is not accessible through either the ONTAP CLIor ONTAP REST API using password-based authentication. + Nested schema for **password**: + * `crn` - (String) The CRN for this credential. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `credential`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + * `ssh` - (List) The public key credential for ONTAP CLI based ssh login for the storage virtualmachine administrator. + Nested schema for **ssh**: + * `crn` - (String) The CRN for this credential. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `credential`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + +* `admin_password` - (List) The password credential for the storage virtual machine administrator. +Nested schema for **admin_password**: + * `crn` - (String) The CRN for this credential. + * Constraints: The maximum length is `512` characters. The minimum length is `9` characters. + * `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `credential`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + +* `created_at` - (String) The date and time that the storage virtual machine was created. + +* `endpoints` - (List) The data and management endpoints for this storage virtual machine. +Nested schema for **endpoints**: + * `management` - (List) The NetApp management endpoint for this storage virtual machine. Management may beperformed using the ONTAP CLI, ONTAP API, or NetApp CloudManager. + Nested schema for **management**: + * `ipv4_address` - (String) The unique IP address of an endpoint. + * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. + * `nfs` - (List) The Network File System (NFS) protocol endpoint for this storage virtual machine.If absent, NFS is not enabled on this storage virtual machine. + Nested schema for **nfs**: + * `ipv4_address` - (String) The unique IP address of an endpoint. + * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. + * `smb` - (List) The Server Message Block (SMB) protocol endpoint for this storage virtual machine.If absent, SMB is not enabled on this storage virtual machine. + Nested schema for **smb**: + * `ipv4_address` - (String) The unique IP address of an endpoint. + * Constraints: The maximum length is `15` characters. The minimum length is `7` characters. The value must match regular expression `/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/`. + +* `href` - (String) The URL for this storage virtual machine. + * Constraints: The maximum length is `8000` characters. The minimum length is `10` characters. The value must match regular expression `/^http(s)?:\/\/([^\/?#]*)([^?#]*)(\\?([^#]*))?(#(.*))?$/`. + +* `lifecycle_state` - (String) The lifecycle state of the storage virtual machine. + * Constraints: Allowable values are: `deleting`, `failed`, `pending`, `stable`, `suspended`, `updating`, `waiting`. + +* `name` - (String) The name for this storage virtual machine. The name is unique across all storage virtual machines in the storage ontap instance. + * Constraints: The maximum length is `40` characters. The minimum length is `1` character. The value must match regular expression `/^-?([a-z]|[a-z][-a-z0-9]*[a-z0-9]|[0-9][-a-z0-9]*([a-z]|[-a-z][-a-z0-9]*[a-z0-9]))$/`. + +* `resource_type` - (String) The resource type. + * Constraints: Allowable values are: `storage_ontap_instance_storage_virtual_machine`. The maximum length is `128` characters. The minimum length is `1` character. The value must match regular expression `/^[a-z][a-z0-9]*(_[a-z0-9]+)*$/`. + diff --git a/website/docs/d/is_storage_ontap_instance_virtual_machine_volume.html.markdown b/website/docs/d/is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown similarity index 94% rename from website/docs/d/is_storage_ontap_instance_virtual_machine_volume.html.markdown rename to website/docs/d/is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown index 0c3adbccce..2aaee75920 100644 --- a/website/docs/d/is_storage_ontap_instance_virtual_machine_volume.html.markdown +++ b/website/docs/d/is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown @@ -1,22 +1,22 @@ --- layout: "ibm" -page_title: "IBM : ibm_is_storage_ontap_instance_virtual_machine_volume" +page_title: "IBM : ibm_is_storage_ontap_instance_storage_virtual_machine_volume" description: |- Get information about StorageOntapInstanceStorageVirtualMachineVolume subcategory: "ontap" --- -# ibm_is_storage_ontap_instance_virtual_machine_volume +# ibm_is_storage_ontap_instance_storage_virtual_machine_volume Provides a read-only data source to retrieve information about a StorageOntapInstanceStorageVirtualMachineVolume. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. ## Example Usage ```hcl -data "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume" { +data "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume" { id = "id" - storage_ontap_instance_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_ontap_instance_id - storage_virtual_machine_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_virtual_machine_id + storage_ontap_instance_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_ontap_instance_id + storage_virtual_machine_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_virtual_machine_id } ``` diff --git a/website/docs/d/is_storage_ontap_instance_virtual_machine_volumes.html.markdown b/website/docs/d/is_storage_ontap_instance_storage_virtual_machine_volumes.html.markdown similarity index 95% rename from website/docs/d/is_storage_ontap_instance_virtual_machine_volumes.html.markdown rename to website/docs/d/is_storage_ontap_instance_storage_virtual_machine_volumes.html.markdown index 552e2ca410..876a153d77 100644 --- a/website/docs/d/is_storage_ontap_instance_virtual_machine_volumes.html.markdown +++ b/website/docs/d/is_storage_ontap_instance_storage_virtual_machine_volumes.html.markdown @@ -1,21 +1,21 @@ --- layout: "ibm" -page_title: "IBM : ibm_is_storage_ontap_instance_virtual_machine_volumes" +page_title: "IBM : ibm_is_storage_ontap_instance_storage_virtual_machine_volumes" description: |- Get information about StorageOntapInstanceStorageVirtualMachineVolumeCollection subcategory: "ontap" --- -# ibm_is_storage_ontap_instance_virtual_machine_volumes +# ibm_is_storage_ontap_instance_storage_virtual_machine_volumes Provides a read-only data source to retrieve information about a StorageOntapInstanceStorageVirtualMachineVolumeCollection. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. ## Example Usage ```hcl -data "ibm_is_storage_ontap_instance_virtual_machine_volumes" "is_storage_ontap_instance_virtual_machine_volumes" { - storage_ontap_instance_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_ontap_instance_id - storage_virtual_machine_id = ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume.storage_virtual_machine_id +data "ibm_is_storage_ontap_instance_storage_virtual_machine_volumes" "is_storage_ontap_instance_storage_virtual_machine_volumes" { + storage_ontap_instance_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_ontap_instance_id + storage_virtual_machine_id = ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume.storage_virtual_machine_id } ``` diff --git a/website/docs/d/is_storage_ontap_instance_virtual_machines.html.markdown b/website/docs/d/is_storage_ontap_instance_storage_virtual_machines.html.markdown similarity index 97% rename from website/docs/d/is_storage_ontap_instance_virtual_machines.html.markdown rename to website/docs/d/is_storage_ontap_instance_storage_virtual_machines.html.markdown index 12cd52e285..e734c02191 100644 --- a/website/docs/d/is_storage_ontap_instance_virtual_machines.html.markdown +++ b/website/docs/d/is_storage_ontap_instance_storage_virtual_machines.html.markdown @@ -1,19 +1,19 @@ --- layout: "ibm" -page_title: "IBM : ibm_is_storage_ontap_instance_virtual_machines" +page_title: "IBM : ibm_is_storage_ontap_instance_storage_virtual_machines" description: |- Get information about StorageOntapInstanceStorageVirtualMachineCollection subcategory: "ontap" --- -# ibm_is_storage_ontap_instance_virtual_machines +# ibm_is_storage_ontap_instance_storage_virtual_machines Provides a read-only data source to retrieve information about a StorageOntapInstanceStorageVirtualMachineCollection. You can then reference the fields of the data source in other resources within the same configuration by using interpolation syntax. ## Example Usage ```hcl -data "ibm_is_storage_ontap_instance_virtual_machines" "is_storage_ontap_instance_virtual_machines" { +data "ibm_is_storage_ontap_instance_storage_virtual_machines" "is_storage_ontap_instance_storage_virtual_machines" { storage_ontap_instance_id = "storage_ontap_instance_id" } ``` diff --git a/website/docs/r/is_storage_ontap_instance_virtual_machine_volume.html.markdown b/website/docs/r/is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown similarity index 95% rename from website/docs/r/is_storage_ontap_instance_virtual_machine_volume.html.markdown rename to website/docs/r/is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown index 883bf975d1..d9cc010120 100644 --- a/website/docs/r/is_storage_ontap_instance_virtual_machine_volume.html.markdown +++ b/website/docs/r/is_storage_ontap_instance_storage_virtual_machine_volume.html.markdown @@ -1,19 +1,19 @@ --- layout: "ibm" -page_title: "IBM : ibm_is_storage_ontap_instance_virtual_machine_volume" +page_title: "IBM : ibm_is_storage_ontap_instance_storage_virtual_machine_volume" description: |- Manages StorageOntapInstanceStorageVirtualMachineVolume. subcategory: "ontap" --- -# ibm_is_storage_ontap_instance_virtual_machine_volume +# ibm_is_storage_ontap_instance_storage_virtual_machine_volume Create, update, and delete StorageOntapInstanceStorageVirtualMachineVolumes with this resource. ## Example Usage ```hcl -resource "ibm_is_storage_ontap_instance_virtual_machine_volume" "is_storage_ontap_instance_virtual_machine_volume_instance" { +resource "ibm_is_storage_ontap_instance_storage_virtual_machine_volume" "is_storage_ontap_instance_storage_virtual_machine_volume_instance" { capacity = 10 cifs_share { access_control_list { @@ -131,7 +131,7 @@ Nested schema for **health_reasons**: ## Import -You can import the `ibm_is_storage_ontap_instance_virtual_machine_volume` resource by using `id`. +You can import the `ibm_is_storage_ontap_instance_storage_virtual_machine_volume` resource by using `id`. The `id` property can be formed from `storage_ontap_instance_id`, `storage_virtual_machine_id`, and `id` in the following format: ``` @@ -143,5 +143,5 @@ The `id` property can be formed from `storage_ontap_instance_id`, `storage_virtu # Syntax ``` -$ terraform import ibm_is_storage_ontap_instance_virtual_machine_volume.is_storage_ontap_instance_virtual_machine_volume // +$ terraform import ibm_is_storage_ontap_instance_storage_virtual_machine_volume.is_storage_ontap_instance_storage_virtual_machine_volume // ```