diff --git a/cloudmanager/client.go b/cloudmanager/client.go index 06cbfb8..56290f1 100644 --- a/cloudmanager/client.go +++ b/cloudmanager/client.go @@ -67,8 +67,11 @@ func (c *Client) CallAWSInstanceCreate(occmDetails createOCCMDetails) (string, e svc := ec2.New(sess) var securityGroupIds []*string - securityGroupIds = append(securityGroupIds, aws.String(occmDetails.SecurityGroupID)) - + split := strings.Split(occmDetails.SecurityGroupID, ",") + for _, sgid := range split { + securityGroupIds = append(securityGroupIds, aws.String(sgid)) + } + // Specify the details of the instance that you want to create. runInstancesInput := &ec2.RunInstancesInput{ BlockDeviceMappings: []*ec2.BlockDeviceMapping{ @@ -89,6 +92,7 @@ func (c *Client) CallAWSInstanceCreate(occmDetails createOCCMDetails) (string, e MinCount: aws.Int64(1), MaxCount: aws.Int64(1), KeyName: aws.String(occmDetails.KeyName), + DisableApiTermination: aws.Bool(*occmDetails.EnableTerminationProtection), TagSpecifications: []*ec2.TagSpecification{ { ResourceType: aws.String("instance"), diff --git a/cloudmanager/data_source_netapp_cloudmanager_volume.go b/cloudmanager/data_source_netapp_cloudmanager_volume.go index 8510b26..f912291 100644 --- a/cloudmanager/data_source_netapp_cloudmanager_volume.go +++ b/cloudmanager/data_source_netapp_cloudmanager_volume.go @@ -174,6 +174,8 @@ func dataSourceCVOVolumeRead(d *schema.ResourceData, meta interface{}) error { volume.WorkingEnvironmentID = weInfo.PublicID volume.WorkingEnvironmentType = weInfo.WorkingEnvironmentType volume.SvmName = weInfo.SvmName + d.Set("working_environment_id", volume.WorkingEnvironmentID) + d.Set("svm_name", volume.SvmName) res, err := client.getVolume(volume) if err != nil { log.Print("Error reading volume") diff --git a/cloudmanager/occm_aws.go b/cloudmanager/occm_aws.go index 44e27f0..5557338 100644 --- a/cloudmanager/occm_aws.go +++ b/cloudmanager/occm_aws.go @@ -60,6 +60,7 @@ type createOCCMDetails struct { AssociatePublicIPAddress *bool AssociatePublicIP bool FirewallTags bool + EnableTerminationProtection *bool } // deleteOCCMDetails the users input for deleting a occm diff --git a/cloudmanager/resource_netapp_cloudmanager_connector_aws.go b/cloudmanager/resource_netapp_cloudmanager_connector_aws.go index 36b82ea..d298381 100644 --- a/cloudmanager/resource_netapp_cloudmanager_connector_aws.go +++ b/cloudmanager/resource_netapp_cloudmanager_connector_aws.go @@ -90,6 +90,12 @@ func resourceOCCMAWS() *schema.Resource { Computed: true, ForceNew: true, }, + "enable_termination_protection": { + Type: schema.TypeBool, + Optional: true, + ForceNew: true, + Default: false, + }, "associate_public_ip_address": { Type: schema.TypeBool, Optional: true, @@ -139,6 +145,11 @@ func resourceOCCMAWSCreate(d *schema.ResourceData, meta interface{}) error { associatePublicIPAddress := o.(bool) occmDetails.AssociatePublicIPAddress = &associatePublicIPAddress } + + if o, ok := d.GetOkExists("enable_termination_protection"); ok { + enableTerminationProtection := o.(bool) + occmDetails.EnableTerminationProtection = &enableTerminationProtection + } res, err := client.createOCCM(occmDetails) if err != nil { diff --git a/cloudmanager/volume.go b/cloudmanager/volume.go index 2c120ca..5177110 100644 --- a/cloudmanager/volume.go +++ b/cloudmanager/volume.go @@ -167,11 +167,14 @@ func (c *Client) deleteVolume(vol volumeRequest) error { baseURL = fmt.Sprintf("%s/volumes/%s/%s/%s", baseURL, vol.WorkingEnvironmentID, vol.SvmName, vol.Name) hostType := "CloudManagerHost" - statusCode, response, _, err := c.CallAPIMethod("DELETE", baseURL, nil, c.Token, hostType) + statusCode, response, onCloudRequestID, err := c.CallAPIMethod("DELETE", baseURL, nil, c.Token, hostType) responseError := apiResponseChecker(statusCode, response, "deleteVolume") if responseError != nil { return responseError } + + log.Print("Wait for volume deletion.") + err = c.waitOnCompletion(onCloudRequestID, "volume", "delete", 10, 60) if err != nil { log.Print("deleteVolume request failed ", statusCode) return err diff --git a/website/docs/d/cifs_server.html.markdown b/website/docs/d/cifs_server.html.markdown new file mode 100644 index 0000000..042798d --- /dev/null +++ b/website/docs/d/cifs_server.html.markdown @@ -0,0 +1,43 @@ +--- +layout: "netapp_cloudmanager" +page_title: "NetApp_CloudManager: netapp_cloudmanager_cifs_server" +sidebar_current: "docs-netapp-cloudmanager-datasource-cifs-server" +description: |- + Provides a netapp-cloudmanager_cifs_server resource. This can be used to read a CIFS server on the Cloud Volume ONTAP system that requires a CIFS volume, based on an Active Directory or Workgroup. +--- + +# netapp_cloudmanager_cifs_server + +Provides a netapp-cloudmanager_cifs_server resource. This can be used to read a CIFS server on the Cloud Volume ONTAP system that requires a CIFS volume, based on an Active Directory or Workgroup. +Requires existence of a Cloud Manager Connector and a Cloud Volumes ONTAP system. + +## Example Usages + +**Read netapp-cloudmanager_cifs_server:** + +``` +data "netapp-cloudmanager_cifs_server" "cvo-cifs" { + provider = netapp-cloudmanager + client_id = "AbCd6kdnLtvhwcgGvlFntdEHUfPJGc" + working_environment_name = "CvoName" +} +``` + +## Argument Reference + +The following arguments are supported: + +* `client_id` - (Required) The client ID of the Cloud Manager Connector. You can find the ID from a previous create Connector action as shown in the example, or from the Connector tab on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com). +* `working_environment_id` - (Optional) The public ID of the working environment where the CIFS server will be created. This argument is optional if working_environment_name is provided. You can find the ID from a previous create Cloud Volumes ONTAP action as shown in the example, or from the information page of the Cloud Volumes ONTAP working environment on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com). +* `working_environment_name` - (Optional) The working environment name where the CIFS server will be created. The argument will be ignored if working_environment_id is provided. + +## Attributes Reference + +The following attributes are exported in addition to the arguments listed above: + +* `id` - The unique identifier of the working environment. +* `domain` - Active Directory domain name. For CIFS AD only. +* `dns_domain` - DNS domain name. For CIFS AD only. +* `ip_addresses` - DNS server IP addresses. For CIFS AD only. +* `netbios` - CIFS server NetBIOS name. For CIFS AD only. +* `organizational_unit` - Organizational Unit in which to register the CIFS server. For CIFS AD only. \ No newline at end of file diff --git a/website/docs/d/nss_account.html.markdown b/website/docs/d/nss_account.html.markdown new file mode 100644 index 0000000..151f630 --- /dev/null +++ b/website/docs/d/nss_account.html.markdown @@ -0,0 +1,37 @@ +--- +layout: "netapp_cloudmanager" +page_title: "NetApp_CloudManager: netapp_cloudmanager_nss_account" +sidebar_current: "docs-netapp-cloudmanager-resource-nss-account" +description: |- + Provides a netapp-cloudmanager_nss_account resource. This can be used to read a NetApp Support Site account on the Cloud Manager system. +--- + +# netapp_cloudmanager_nss_account + +Provides a netapp-cloudmanager_nss_account resource. This can be used to read a NetApp Support Site account on the Cloud Manager system. + +## Example Usages + +**Read netapp-cloudmanager_nss_account:** + +``` +data "netapp-cloudmanager_nss_account" "nss-account-1" { + provider = netapp-cloudmanager + client_id = "Nw4Q2O1kdnLtvhwegGalFnodEHUfPJWh" + name = "accountName" + } +``` + +## Argument Reference + +The following arguments are supported: + +* `client_id` - (Required) The client ID of the Cloud Manager Connector. You can find the ID from a previous create Connector action as shown in the example, or from the Connector tab on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com). +* `name` - (Required) Account name. + +## Attributes Reference + +The following attributes are exported in addition to the arguments listed above: + +* `id` - The unique identifier of the account. +* `username` - NSS username. Not required in data source. diff --git a/website/docs/d/volume.html.markdown b/website/docs/d/volume.html.markdown index c2bff30..2816e62 100644 --- a/website/docs/d/volume.html.markdown +++ b/website/docs/d/volume.html.markdown @@ -29,6 +29,31 @@ data "netapp-cloudmanager_volume" "volume-nfs" { The following arguments are supported: +* `client_id` - (Required) The client ID of the Cloud Manager Connector. You can find the ID from a previous create Connector action as shown in the example, or from the Connector tab on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com). * `name` - (Required) The name of the volume. * `working_environment_id` - (Optional) The public ID of the working environment where the volume exists. The ID can be optional if working_environment_name is provided. You can find the ID from the previous create Cloud Volumes ONTAP action as shown in the example, or from the Information page of the Cloud Volumes ONTAP working environment on [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com). -* `working_environment_name` - (Optional) The working environment name where the volume exists. It will be ignored if working_environment_id is provided. \ No newline at end of file +* `working_environment_name` - (Optional) The working environment name where the volume exists. It will be ignored if working_environment_id is provided. + +## Attributes Reference + +The following attributes are exported in addition to the arguments listed above: + +* `svm_name` - The name of the SVM. +* `size` - The volume size, supported with decimal numbers. +* `size_unit` - ['Byte' or 'KB' or 'MB' or 'GB' or 'TB']. +* `provider_volume_type` - The underlying cloud provider volume type. For AWS: ["gp2", "io1", "st1", "sc1"]. For Azure: ['Premium_LRS','Standard_LRS','StandardSSD_LRS']. For GCP: ['pd-ssd','pd-standard'] +* `enable_thin_provisioning` - Enable thin provisioning. The default is 'true'. +* `enable_compression` - Enable compression. The default is 'true'. +* `enable_deduplication` - Enable deduplication. The default is 'true'. +* `aggregate_name ` - The aggregate in which the volume will be created. +* `volume_protocol` - The protocol for the volume: ["nfs", "cifs", "iscsi"]. The default is 'nfs' +* `capacity_tier` - The volume's capacity tier for tiering cold data to object storage: ['S3', 'Blob', 'cloudStorage']. The default values for each cloud provider are as follows: Amazon => 'S3', Azure => 'Blob', GCP => 'cloudStorage'. +* `mount_point` The mount point. +* `export_policy_name` - The export policy name. (NFS protocol parameters) +* `export_policy_type` - The export policy type. (NFS protocol parameters) +* `export_policy_ip` - Custom export policy list of IPs. (NFS protocol parameters) +* `export_policy_nfs_version` - Export policy protocol. (NFS protocol parameters) +* `snapshot_policy_name` - Snapshot policy name. The default is 'default'. (NFS protocol parameters) +* `share_name` Share name. (CIFS protocol parameters) +* `permission` CIFS share permission type. (CIFS protocol parameters) +* `users` List of users with the permission. (CIFS protocol parameters) diff --git a/website/docs/r/aggregate.html.markdown b/website/docs/r/aggregate.html.markdown index 7f1873d..142601c 100644 --- a/website/docs/r/aggregate.html.markdown +++ b/website/docs/r/aggregate.html.markdown @@ -37,9 +37,9 @@ The following arguments are supported: * `number_of_disks` - (Required) The required number of disks in the new aggregate. * `disk_size_size` - (Optional) The required size of the disks. For GB, the unit can be: [100 or 500]. For TB, the unit can be: [1,2,4,8,16]. The default is '1' * `disk_size_unit` - (Optional) The disk size unit ['GB' or 'TB']. The default is 'TB' -* `homeNode` - (Optional) The home node that the new aggregate should belong to. The default is the first node. -* `providerVolumeType` - (Optional) The cloud provider volume type. For AWS: ["gp2", "io1", "st1", "sc1"]. For Azure: ['Premium_LRS','Standard_LRS','StandardSSD_LRS']. For GCP: ['pd-ssd','pd-standard'] -* `capacityTier` - (Optional) The aggregate's capacity tier for tiering cold data to object storage: ['S3', 'Blob', 'cloudStorage']. The default values for each cloud provider are as follows: Amazon => 'S3', Azure => 'Blob', GCP => 'cloudStorage'. If NONE, the capacity tier won't be set on aggregate creation. +* `home_node` - (Optional) The home node that the new aggregate should belong to. The default is the first node. +* `provider_volume_type` - (Optional) The cloud provider volume type. For AWS: ["gp2", "io1", "st1", "sc1"]. For Azure: ['Premium_LRS','Standard_LRS','StandardSSD_LRS']. For GCP: ['pd-ssd','pd-standard'] +* `capacity_tier` - (Optional) The aggregate's capacity tier for tiering cold data to object storage: ['S3', 'Blob', 'cloudStorage']. The default values for each cloud provider are as follows: Amazon => 'S3', Azure => 'Blob', GCP => 'cloudStorage'. If NONE, the capacity tier won't be set on aggregate creation. * `iops` - (Optional) Provisioned IOPS. Needed only when providerVolumeType is "io1" ## Attributes Reference diff --git a/website/docs/r/connector_aws.html.markdown b/website/docs/r/connector_aws.html.markdown index 2cea09a..b117c77 100644 --- a/website/docs/r/connector_aws.html.markdown +++ b/website/docs/r/connector_aws.html.markdown @@ -45,12 +45,13 @@ The following arguments are supported: * `key_name` - (Required) The name of the key pair to use for the Connector instance. * `instance_type` - (Required) The type of instance (for example, t3.xlarge). At least 4 CPU and 16 GB of memory are required. * `subnet_id` - (Required) The ID of the subnet for the instance. -* `security_group_id` - (Required) The ID of the security group for the instance. +* `security_group_id` - (Required) The ID of the security group for the instance, multiple security groups can be provided seperated by ','. * `iam_instance_profile_name` - (Required) The name of the instance profile for the Connector. * `proxy_url` - (Optional) The proxy URL, if using a proxy to connect to the internet. * `proxy_user_name` - (Optional) The proxy user name, if using a proxy to connect to the internet. * `proxy_password` - (Optional) The proxy password, if using a proxy to connect to the internet. * `associate_public_ip_address` - (Optional) Indicates whether to associate a public IP address to the instance. If not provided, the association will be done based on the subnet's configuration. +* `enable_termination_protection` - (Optional) Indicates whether to enable termination protection on the instance, default is false. * `account_id` - (Optional) The NetApp account ID that the Connector will be associated with. If not provided, Cloud Manager uses the first account. If no account exists, Cloud Manager creates a new account. You can find the account ID in the account tab of Cloud Manager at [https://cloudmanager.netapp.com](https://cloudmanager.netapp.com). ## Attributes Reference