Skip to content

Commit

Permalink
Merge pull request #171 from NetApp/integration/main
Browse files Browse the repository at this point in the history
Integration/main
  • Loading branch information
wenjun666 authored Jun 22, 2023
2 parents a5827bd + 97733b4 commit 89ed586
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 23.6.1
NEW FEATURES:
* resource/cvo_gcp: support HIGH `writing_speed_state` in GCP HA. Make `gcp_service_account` optional .

## 23.6.0
NEW FEATURES:
* resource/aws_fsx_volume: add new option`tags`.
Expand Down
13 changes: 5 additions & 8 deletions cloudmanager/cvo_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type createCVOGCPDetails struct {
DataEncryptionType string `structs:"dataEncryptionType"`
WorkspaceID string `structs:"tenantId,omitempty"`
Region string `structs:"region"`
GCPServiceAccount string `structs:"gcpServiceAccount"`
GCPServiceAccount string `structs:"gcpServiceAccount,omitempty"`
VpcID string `structs:"vpcId"`
SvmPassword string `structs:"svmPassword"`
SvmName string `structs:"svmName,omitempty"`
Expand All @@ -44,6 +44,7 @@ type createCVOGCPDetails struct {
EnableCompliance bool `structs:"enableCompliance"`
IsHA bool
HAParams haParamsGCP `structs:"haParams,omitempty"`
FlashCache bool `structs:"flashCache"`
}

// gcpLabels the input for requesting a CVO
Expand Down Expand Up @@ -133,9 +134,9 @@ func (c *Client) createCVOGCP(cvoDetails createCVOGCPDetails, clientID string) (

log.Print("retries ", c.Retries)
var CreationRetries int
if cvoDetails.IsHA == false {
if !cvoDetails.IsHA {
CreationRetries = c.Retries
} else if cvoDetails.IsHA == true {
} else {
CreationRetries = c.Retries + 30
}

Expand Down Expand Up @@ -298,11 +299,7 @@ func expandGCPLabelsToUserTags(set *schema.Set) []userTags {

// validateCVOGCPParams validates params
func validateCVOGCPParams(cvoDetails createCVOGCPDetails) error {
if cvoDetails.IsHA && cvoDetails.WritingSpeedState != "" {
return fmt.Errorf("writing_speed_state parameter not required for CVO GCP HA")
}

if cvoDetails.VsaMetadata.UseLatestVersion == true && cvoDetails.VsaMetadata.OntapVersion != "latest" {
if cvoDetails.VsaMetadata.UseLatestVersion && cvoDetails.VsaMetadata.OntapVersion != "latest" {
return fmt.Errorf("ontap_version parameter not required when having use_latest_version as true")
}

Expand Down
16 changes: 13 additions & 3 deletions cloudmanager/resource_netapp_cloudmanager_cvo_gcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func resourceCVOGCP() *schema.Resource {
},
"gcp_service_account": {
Type: schema.TypeString,
Required: true,
Optional: true,
ForceNew: true,
},
"workspace_id": {
Expand Down Expand Up @@ -317,6 +317,11 @@ func resourceCVOGCP() *schema.Resource {
return new == ""
},
},
"flash_cache": {
Type: schema.TypeBool,
Optional: true,
ForceNew: true,
},
"upgrade_ontap_version": {
Type: schema.TypeBool,
Optional: true,
Expand All @@ -343,7 +348,9 @@ func resourceCVOGCPCreate(d *schema.ResourceData, meta interface{}) error {

cvoDetails.Name = d.Get("name").(string)
log.Print("Create cvo name ", cvoDetails.Name)
cvoDetails.GCPServiceAccount = d.Get("gcp_service_account").(string)
if c, ok := d.GetOk("gcp_service_account"); ok {
cvoDetails.GCPServiceAccount = c.(string)
}
cvoDetails.DataEncryptionType = d.Get("data_encryption_type").(string)
cvoDetails.WorkspaceID = d.Get("workspace_id").(string)
cvoDetails.GCPVolumeType = d.Get("gcp_volume_type").(string)
Expand Down Expand Up @@ -390,7 +397,10 @@ func resourceCVOGCPCreate(d *schema.ResourceData, meta interface{}) error {
if c, ok := d.GetOk("enable_compliance"); ok {
cvoDetails.EnableCompliance = c.(bool)
}

// In GCP HA, HIGH write speed and FlashCache are coupled together both needs to be activated, one cannot be activated without the other.
if c, ok := d.GetOk("flash_cache"); ok {
cvoDetails.FlashCache = c.(bool)
}
if c, ok := d.GetOk("zone"); ok {
cvoDetails.Region = c.(string)
}
Expand Down
40 changes: 40 additions & 0 deletions examples/gcp/resources.tf
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,44 @@ resource "netapp-cloudmanager_cvo_gcp" "cvo-gcp_ha" {
vpc3_data_replication = "projects/default-project/global/networks/occm-network-1"
nss_account = "c3c3d4e5-123d-4012-83b3-1e4abcdefg"
client_id = netapp-cloudmanager_connector_gcp.cm-gcp.client_id
}

resource "netapp-cloudmanager_cvo_gcp" "cvo-gcp_ha_high" {
provider = netapp-cloudmanager
name = "terraformcvogcpHAhighspeed"
project_id = "default-project"
zone = "us-east1-b"
subnet_id = "default"
vpc_id = "default"
gcp_label {
label_key = "abcdefg"
label_value = "1232"
}
is_ha = true
svm_password = "********"
svm {
svm_name = "svmx"
}
svm {
svm_name = "svmy"
}
use_latest_version = true
ontap_version = "latest"
gcp_volume_type = "pd-ssd"
instance_type = "n2-standard-64"
writing_speed_state = "HIGH"
flash_cache = true
mediator_zone = "us-east1-d"
node1_zone = "us-east1-b"
node2_zone = "us-east1-c"
subnet0_node_and_data_connectivity = "projects/default-project/regions/us-east1/subnetworks/default"
subnet1_cluster_connectivity = "projects/default-project/regions/us-east1/subnetworks/subnet2"
subnet2_ha_connectivity = "projects/default-project/regions/us-east1/subnetworks/subnet3"
subnet3_data_replication = "projects/default-project/regions/us-east1/subnetworks/occm-us-east1-subnet-1"
vpc0_node_and_data_connectivity = "projects/default-project/global/networks/default"
vpc1_cluster_connectivity = "projects/default-project/global/networks/vpc2"
vpc2_ha_connectivity = "projects/default-project/global/networks/vpc3"
vpc3_data_replication = "projects/default-project/global/networks/occm-network-1"
nss_account = "c3c3d4e5-123d-4012-83b3-1e4abcdefg"
client_id = netapp-cloudmanager_connector_gcp.cm-gcp.client_id
}
41 changes: 39 additions & 2 deletions website/docs/r/cvo_gcp.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,50 @@ resource "netapp-cloudmanager_cvo_gcp" "cl-cvo-gcp" {
}
```

**Create netapp-cloudmanager_cvo_gcp HA with HIGH writing speed:**

```
resource "netapp-cloudmanager_cvo_gcp" "cl-cvo-gcp-ha" {
provider = netapp-cloudmanager
name = "tfcvohahigh"
project_id = "occm-project"
zone = "us-east4-a"
subnet_id = "default"
vpc_id = "default"
gcp_service_account = "[email protected]"
is_ha = true
svm_password = "netapp11!"
use_latest_version = false
ontap_version = "ONTAP-9.13.0.T1.gcpha"
gcp_volume_type = "pd-ssd"
capacity_package_name = "Professional"
instance_type = "n2-standard-16"
mediator_zone = "us-east4-c"
node1_zone = "us-east4-a"
node2_zone = "us-east4-b"
subnet0_node_and_data_connectivity = "projects/tlv-support/regions/us-east4/subnetworks/default"
subnet1_cluster_connectivity = "projects/tlv-support/regions/us-east4/subnetworks/rn-cluster-subnet"
subnet2_ha_connectivity = "projects/tlv-support/regions/us-east4/subnetworks/rn-rdma-subnet"
subnet3_data_replication = "projects/tlv-support/regions/us-east4/subnetworks/rn-replication-subnet"
vpc0_node_and_data_connectivity = "projects/tlv-support/global/networks/default"
vpc1_cluster_connectivity = "projects/tlv-support/global/networks/rnicholl-vpc1-cluster-internal"
vpc2_ha_connectivity = "projects/tlv-support/global/networks/rnicholl-vpc2-rdma-internal"
vpc3_data_replication = "projects/tlv-support/global/networks/rnicholl-vpc3-replication-internal"
nss_account = "cd12x234-f876-4567-8f1f-12345678xxx"
client_id = netapp-cloudmanager_connector_gcp.cm-gcp.client_id
writing_speed_state = "HIGH"
flash_cache = true
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required) The name of the Cloud Volumes ONTAP working environment.
* `project_id` - (Required) The ID of the GCP project.
* `zone` - (Optional) The zone of the region where the working environment will be created. It is required in single.
* `gcp_service_account` - (Required) The gcp_service_account email in order to enable tiering of cold data to Google Cloud Storage.
* `gcp_service_account` - (Optional) The gcp_service_account email in order to enable tiering of cold data to Google Cloud Storage.
* `svm_password` - (Required) The admin password for Cloud Volumes ONTAP.
* `svm_name` - (Optional) The name of the SVM.
* `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://console.bluexp.netapp.com/](https://console.bluexp.netapp.com/).
Expand All @@ -93,7 +129,8 @@ The following arguments are supported:
* `capacity_tier` - (Optional) Indicates the type of data tiering to use: ['cloudStorage']. The default is 'cloudStorage'.
* `tier_level` - (Optional) In case capacity_tier is cloudStorage, this argument indicates the tiering level: ['standard', 'nearline', 'coldline']. The default is: 'standard'.
* `nss_account` - (Optional) The NetApp Support Site account ID to use with this Cloud Volumes ONTAP system. If the license type is BYOL and an NSS account isn't provided, Cloud Manager tries to use the first existing NSS account.
* `writing_speed_state` - (Optional) The write speed setting for Cloud Volumes ONTAP: ['NORMAL','HIGH']. The default is 'NORMAL'. This argument is not relevant for HA pairs.
* `writing_speed_state` - (Optional) The write speed setting for Cloud Volumes ONTAP: ['NORMAL','HIGH']. The default is 'NORMAL'. For single node system, HIGH write speed is supported with all machine types. For HA, Flash Cache, high write speed, and a higher maximum transmission unit (MTU) of 8,896 bytes are available through the High write speed option with the n2-standard-16, n2-standard-32, n2-standard-48, and n2-standard-64 instance types.
* `flash_cache` - (Optional) Enable Flash Cache. In GCP HA (version 9.13.0), HIGH write speed and FlashCache are coupled together both needs to be activated, one cannot be activated without the other.
* `firewall_rule` - (Optional) The name of the firewall rule for Cloud Volumes ONTAP. If not provided, Cloud Manager generates the rule.
* `backup_volumes_to_cbs` - (Optional) Automatically enable back up of all volumes to Google Cloud buckets [true, false].
* `enable_compliance` - (Optional) Enable the Cloud Compliance service on the working environment [true, false].
Expand Down

0 comments on commit 89ed586

Please sign in to comment.