Skip to main content
NetApp Solutions

Cloud Volumes Automation via Terraform

Contributors kevin-hoke netapp-vedantsethia netapp-dhruv-tyagi

This solution documents the automated deployments of Cloud Volumes on AWS (CVO Single Node, CVO HA and FSX ONTAP) and Azure (CVO Single Node, CVO HA and ANF) using Terraform modules. The code can be found at https://github.com/NetApp/na_cloud_volumes_automation

Pre-requisites

  1. Terraform >= 0.13

  2. Cloud Manager Account

  3. Cloud Provider Account – AWS, Azure

  4. Host machine (any OS supported by Terraform)

Provider documentation

The documentation of Terraform provider for Cloud Manager is available at: https://registry.terraform.io/providers/NetApp/netapp-cloudmanager/latest/docs

Controlling the provider version

Note that you can also control the provider version. This is controlled by a required_providers block in your Terraform configuration.

The syntax is as follows:

terraform {
  required_providers {
    netapp-cloudmanager = {
      source = "NetApp/netapp-cloudmanager"
      version = ">= 23.0.0"
    }
  }
}
Cli

Read more on provider version control.

Running Specific Modules

AWS
Terraform configuration files for deployment of NetApp CVO (Single Node Instance) on AWS

This section contains various Terraform configuration files to deploy/configure single node NetApp CVO (Cloud Volumes ONTAP) on AWS (Amazon Web Services).

Procedure

In order to run the template:

  1. Clone the repository.

        git clone https://github.com/NetApp/na_cloud_volumes_automation.git
    Cli
  2. Navigate to the desired folder

        cd na_cloud_volumes_automation/
    Cli
  3. Configure AWS credentials from the CLI.

        aws configure
    Cli
    • AWS Access Key ID [None]: accesskey

    • AWS Secret Access Key [None]: secretkey

    • Default region name [None]: us-west-2

    • Default output format [None]: json

  4. Update the variable values in vars/aws_cvo_single_node_deployment.tfvar

    Note You can choose to deploy the connector by setting the variable "aws_connector_deploy_bool" value to true/false.
  5. Initialize the Terraform repository to install all the pre-requisites and prepare for deployment.

        terraform init
    Cli
  6. Verify the terraform files using terraform validate command.

        terraform validate
    Cli
  7. Make a dry run of the configuration to get a preview of all the changes expected by the deployment.

        terraform plan -target="module.aws_sn" -var-file="vars/aws_cvo_single_node_deployment.tfvars"
    Cli
  8. Run the deployment

        terraform apply -target="module.aws_sn" -var-file="vars/aws_cvo_single_node_deployment.tfvars"
    Cli

To delete the deployment

    terraform destroy
Cli
Recipies:

Connector

Terraform variables for NetApp AWS connector instance for CVO deployment.

Name Type Description

aws_connector_deploy_bool

Bool

(Required) Check for Connector deployment.

aws_connector_name

String

(Required) The name of the Cloud Manager Connector.

aws_connector_region

String

(Required) The region where the Cloud Manager Connector will be created.

aws_connector_key_name

String

(Required) The name of the key pair to use for the Connector instance.

aws_connector_company

String

(Required) The name of the company of the user.

aws_connector_instance_type

String

(Required) The type of instance (for example, t3.xlarge). At least 4 CPU and 16 GB of memory are required.

aws_connector_subnet_id

String

(Required) The ID of the subnet for the instance.

aws_connector_security_group_id

String

(Required) The ID of the security group for the instance, multiple security groups can be provided separated by ','.

aws_connector_iam_instance_profile_name

String

(Required) The name of the instance profile for the Connector.

aws_connector_account_id

String

(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.

aws_connector_public_ip_bool

Bool

(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.

Single Node Instance

Terraform variables for single NetApp CVO instance.

Name Type Description

cvo_name

String

(Required) The name of the Cloud Volumes ONTAP working environment.

cvo_region

String

(Required) The region where the working environment will be created.

cvo_subnet_id

String

(Required) The subnet id where the working environment will be created.

cvo_vpc_id

String

(Optional) The VPC ID where the working environment will be created. If this argument isn't provided, the VPC will be calculated by using the provided subnet ID.

cvo_svm_password

String

(Required) The admin password for Cloud Volumes ONTAP.

cvo_writing_speed_state

String

(Optional) The write speed setting for Cloud Volumes ONTAP: ['NORMAL','HIGH']. The default is 'NORMAL'.

Azure
Terraform configuration files for deployment of ANF Volume on Azure

This section contains various Terraform configuration files to deploy/configure ANF (Azure Netapp Files) Volume on Azure.

Procedure

In order to run the template:

  1. Clone the repository.

        git clone https://github.com/NetApp/na_cloud_volumes_automation.git
    Cli
  2. Navigate to the desired folder

        cd na_cloud_volumes_automation
    Cli
  3. Login to your Azure CLI (Azure CLI must be installed).

        az login
    Cli
  4. Update the variable values in vars/azure_anf.tfvars.

    Note You can choose to deploy the ANF volume using an existing vnet and subnet by setting the variable "vnet_creation_bool" and "subnet_creation_bool" value to false and supplying the "subnet_id_for_anf_vol". You can also set those values to true and create a new vnet and subnet in which case, the subnet ID will automatically be taken from the newly created subnet.
  5. Initialize the Terraform repository to install all the pre-requisites and prepare for deployment.

        terraform init
    Cli
  6. Verify the terraform files using terraform validate command.

        terraform validate
    Cli
  7. Make a dry run of the configuration to get a preview of all the changes expected by the deployment.

        terraform plan -target="module.anf" -var-file="vars/azure_anf.tfvars"
    Cli
  8. Run the deployment

        terraform apply -target="module.anf" -var-file="vars/azure_anf.tfvars"
    Cli

To delete the deployment

  terraform destroy
Cli
Recipies:

Single Node Instance

Terraform variables for single NetApp ANF Volume.

Name Type Description

az_location

String

(Required) Specifies the supported Azure location where the resource exists. Changing this forces a new resource to be created.

az_prefix

String

(Required) The name of the resource group where the NetApp Volume should be created. Changing this forces a new resource to be created.

az_vnet_address_space

String

(Required) The address space to be used by the newly created vnet for ANF volume deployment.

az_subnet_address_prefix

String

(Required) The subnet address prefix to be used by the newly created vnet for ANF volume deployment.

az_volume_path

String

(Required) A unique file path for the volume. Used when creating mount targets. Changing this forces a new resource to be created.

az_capacity_pool_size

Integer

(Required) Capacity Pool Size mentioned in TB.

az_vnet_creation_bool

Boolean

(Required) Set this boolean to true if you want to create a new vnet. Set it to false to use an existing vnet.

az_subnet_creation_bool

Boolean

(Required) Set this boolean to true to create a new subnet. Set it to false to use an existing subnet.

az_subnet_id_for_anf_vol

String

(Required) Mention the subnet id in case you decide to use an existing subnet by setting subnet_creation_bool to true. If set to false, leave it at the default value.

az_netapp_pool_service_level

String

(Required) The target performance of the file system. Valid values include Premium , Standard , or Ultra.

az_netapp_vol_service_level

String

(Required) The target performance of the file system. Valid values include Premium , Standard , or Ultra.

az_netapp_vol_protocol

String

(Optional) The target volume protocol expressed as a list. Supported single value include CIFS, NFSv3, or NFSv4.1. If argument is not defined it will default to NFSv3. Changing this forces a new resource to be created and data will be lost.

az_netapp_vol_security_style

String

(Optional) Volume security style, accepted values are Unix or Ntfs. If not provided, single-protocol volume is created defaulting to Unix if it is NFSv3 or NFSv4.1 volume, if CIFS, it will default to Ntfs. In a dual-protocol volume, if not provided, its value will be Ntfs.

az_netapp_vol_storage_quota

String

(Required) The maximum Storage Quota allowed for a file system in Gigabytes.

Note As per the recommendation, this script uses the prevent_destroy lifecycle argument to mitigate the possibility of accidental data loss in the configuration file. For more information on the prevent_destroy lifecycle argument please see the terraform documentation: https://developer.hashicorp.com/terraform/tutorials/state/resource-lifecycle#prevent-resource-deletion.
GCP
Terraform configuration files for deployment of NetApp CVO (Single Node Instance) on GCP

This section contains various Terraform configuration files to deploy/configure single node NetApp CVO (Cloud Volumes ONTAP) on GCP (Google Cloud Platform).

Procedure

In order to run the template:

  1. Clone the repository.

        git clone https://github.com/NetApp/na_cloud_volumes_automation.git
    Cli
  2. Navigate to the desired folder

        cd na_cloud_volumes_automation/
    Cli
  3. Save the GCP authentication key JSON file in the directory.

  4. Update the variable values in vars/gcp_cvo_single_node_deployment.tfvar

    Note You can choose to deploy the connector by setting the variable "gcp_connector_deploy_bool" value to true/false.
  5. Initialize the Terraform repository to install all the pre-requisites and prepare for deployment.

        terraform init
    Cli
  6. Verify the terraform files using terraform validate command.

        terraform validate
    Cli
  7. Make a dry run of the configuration to get a preview of all the changes expected by the deployment.

        terraform plan -target="module.gco_single_node" -var-file="vars/gcp_cvo_single_node_deployment.tfvars"
    Cli
  8. Run the deployment

        terraform apply -target="module.gcp_single_node" -var-file="vars/gcp_cvo_single_node_deployment.tfvars"
    Cli

To delete the deployment

    terraform destroy
Cli
Recipies:

Connector

Terraform variables for NetApp GCP connector instance for CVO deployment.

Name Type Description

gcp_connector_deploy_bool

Bool

(Required) Check for Connector deployment.

gcp_connector_name

String

(Required) The name of the Cloud Manager Connector.

gcp_connector_project_id

String

(Required) The GCP project_id where the connector will be created.

gcp_connector_zone

String

(Required) The GCP zone where the Connector will be created.

gcp_connector_company

String

(Required) The name of the company of the user.

gcp_connector_service_account_email

String

(Required) The email of the service_account for the connector instance. This service account is used to allow the Connector to create Cloud Volume ONTAP.

gcp_connector_service_account_path

String

(Required) The local path of the service_account JSON file for GCP authorization purposes. This service account is used to create the Connector in GCP.

gcp_connector_account_id

String

(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.

Single Node Instance

Terraform variables for single NetApp CVO instance on GCP.

Name Type Description

gcp_cvo_name

String

(Required) The name of the Cloud Volumes ONTAP working environment.

gcp_cvo_project_id

String

(Required) The ID of the GCP project.

gcp_cvo_zone

String

(Required) The zone of the region where the working environment will be created.

gcp_cvo_gcp_service_account

String

(Required) The gcp_service_account email in order to enable tiering of cold data to Google Cloud Storage.

gcp_cvo_svm_password

String

(Required) The admin password for Cloud Volumes ONTAP.

gcp_cvo_workspace_id

String

(Optional) The ID of the Cloud Manager workspace where you want to deploy Cloud Volumes ONTAP. If not provided, Cloud Manager uses the first workspace. You can find the ID from the Workspace tab on https://cloudmanager.netapp.com.

gcp_cvo_license_type

String

(Optional) The type of license to use. For single node: ['capacity-paygo', 'gcp-cot-explore-paygo', 'gcp-cot-standard-paygo', 'gcp-cot-premium-paygo', 'gcp-cot-premium-byol'], For HA: ['ha-capacity-paygo', 'gcp-ha-cot-explore-paygo', 'gcp-ha-cot-standard-paygo', 'gcp-ha-cot-premium-paygo', 'gcp-ha-cot-premium-byol']. The default is 'capacity-paygo' for single node, and 'ha-capacity-paygo' for HA.

gcp_cvo_capacity_package_name

String

(Optional) The capacity package name: ['Essential', 'Professional', 'Freemium']. Default is 'Essential'.