More about Cloud Automation
- Top 12 Site Reliability Engineering (SRE) Tools
- DevOps vs SRE: Can SRE Make DevOps Better?
- How to Deploy Cloud Volumes ONTAP Using NetApp Cloud Manager Terraform Provider
- Terraform & Cloud Manager: How to Use Cloud Manager Terraform Provider
- Watch This Vlog on Enhancing Data Management with NetApp Cloud Manager
- NetApp Cloud Storage Manager Case Study: How Willis Towers Watson Unlocked the Full Potential of Cloud Storage
- Cloud Cloning with FlexClone: Cloud Volumes ONTAP Customer Case Studies
- Infrastructure as Code: DevOps Done Right
- Cloud Automation: Why, Where and How
- Automating Storage Volume Provisioning with Ansible Automation Scripts and Cloud Volumes ONTAP
- Infrastructure as Code Ansible Deployment of Cloud Volumes ONTAP and Cloud Manager
- Automating Cloud Operations with Cloud Volumes ONTAP and REST
Subscribe to our blog
Thanks for subscribing to the blog.
March 29, 2021
Topics: Cloud Volumes ONTAPCloud Manager DevOpsMaster7 minute readAutomationProduct Admin
The cloud demands agility through automation, whether you’re deploying code or infrastructure. That has made infrastructure-as-code cloud automation an integral part of DevOps processes, by letting infrastructure be maintained the same way as code.
In this blog we will explore Terraform providers, which can enable infrastructure-as-code deployment process for your Cloud Volumes ONTAP storage infrastructure across multiple cloud platforms.
In this article we’ll be covering:- What Is Infrastructure as Code?
- What Is Terraform?
- Terraform Provider for Cloud Manager
- Getting Started with Terraform and Cloud Manager
- Supported Resources and Sample Configuration
What is Infrastructure as Code?
Infrastructure as code, or IAC as it is popularly known, offers a repeatable process of deploying infrastructure resources at scale, especially in large enterprises. IAC maintains the source of truth for your code and enables version control of your infrastructure configuration that simplifies deployments and rollbacks. An infrastructure-as-code deployment helps both in addressing the issue of configuration drifts and eliminating snowflake environments that could lead to errors and disorder.
All the leading cloud service providers offer their own native IAC solutions. On AWS there is Amazon CloudFormation, while Azure has ARM templates, and Google Cloud offers the Cloud Deployment Manager. However, with multi- and hybrid cloud deployments on the rise, it is more efficient to have a common IAC tool that can be used across multiple platforms. That’s where Terraform can come in handy.
What is Terraform?
Terraform is an open-source IAC solution that can be used for deploying, updating, and versioning infrastructure. It is cloud agnostic and can be used to manage deployments in AWS, GCP, or Azure. It can also be used for management of on-premises environments hosted on VMware, OpenStack, and more. There is also support to integrate Terraform with source control systems like GitHub and popular DevOps tools.
Terraform cloud deployments use Hashicorp Configuration Language (HCL) to write fully declarative configuration files to manage infrastructure. Terraform enables the concept of immutable infrastructure that can be versioned and checked in into a source control solution. It helps you to create and test execution plans before the actual deployment and tracks the state of environments to identify changes.
What Is a Terraform Provider?
Deploying different environments with Terraform is as easy as updating the Terraform template parameters to point to respective environments. Terraform providers are plugins that interact with APIs of service providers/vendors to create and manage resources. For example, each cloud platform has a Terraform provider to manage resources in their respective platforms.
Terraform Provider for Cloud Manager
Cloud Volumes ONTAP provides an enterprise class storage management solution for your workloads deployed across all leading cloud platforms. Cloud Volumes ONTAP is based on NetApp ONTAP technology trusted by enterprises to handle storage of mission critical LOB applications for almost 25 years. Besides enhancing performance and ensuring best-in-class data protection, governance, and security, Cloud Volumes ONTAP adds in agility to cloud storage with infrastructure as code, Ansible-ready capabilities.
Alongside Cloud Volumes ONTAP, NetApp Cloud Manager provides a single-pane management view of storage systems deployed across hybrid and multicloud environments. It simplifies provisioning and lifecycle management of cloud storage across diverse platforms, both through the GUI and through RESTful API calls. Cloud Manager also supports automated cloud operations and storage management through NetApp’s Terraform provider.
Features
The earlier approach to Terraform cloud deployment was through thinly wrapped API calls. Now Cloud Manager Terraform provider offers a native, fully supported NetApp product that enhances the previous approach.
The Cloud Manager Terraform provider:
- Is an official Terraform provider for Cloud Manager that can be used to orchestrate your Cloud Volumes ONTAP deployments.
- Offers multicloud support, making it usefully wherever Cloud Volumes ONTAP is deployed
- Can deploy Cloud Volumes ONTAP and related components such as connectors, aggregates, volumes and CIFS
- Supports deployment of single-node as well as dual-node high availability Cloud Volumes ONTAP deployments
- Can be used in both PayGo or BYOL Cloud Volumes ONTAP deployments
Getting Started with Cloud Manager Terraform Provider: Terraform Basics
Let’s start with the Terraform basics. You need to include the provider code in your template as the first step. NetApp Cloud Manager is listed in the Hashicorp Terraform registry and you can use the code block below in your Terraform configuration to use the provider.
terraform {
required_providers {
netapp-cloudmanager = {
source = "NetApp/netapp-cloudmanager"
version = "21.1.1"
}
}
}
provider "netapp-cloudmanager" {
# Configuration options
}
Execute the terraform init command to initiate the provider for your deployment.
You can obtain the refresh token by logging into your NetApp BlueXP account and going to this page: https://services.cloud.netapp.com/refresh-token.
Cloud Manager Terraform Provider Supported Resources and Sample Configuration
Cloud Manager Terraform provider can be used to create the following type of resources: Cloud Volumes ONTAP, aggregates, CIFS server, Cloud Volumes ONTAP storage volumes, NSS Accounts, and SnapMirror® relationships. Let’s look at how this works for each one of them.
Cloud Volumes ONTAP
In this section we’ll show you how to configure Cloud Volumes ONTAP using Terraform Provider for Cloud Manager.
As a prerequisite, you’ll need a Connecter in place. A Connector resource is required in each cloud provider environment for Cloud Manager to deploy/manage Cloud Volumes ONTAP resources and processes.
Too deploy a Connector, you’ll need an account with permissions in the cloud environment you want to use and a Connector with policies configured for AWS, Azure and GCP. Sample code for deployment of connectors can be found here:
- Sample code for connector deployment on AWS
- Sample code for connector deployment in Azure
- Sample code for connector deployment in GCP
With your Connector set up, you can now use Terraform to deploy Cloud Volumes ONTAP. Let’s explore a sample Terraform code block that can be used for Cloud Volumes ONTAP single node deployment in AWS.
resource "netapp-cloudmanager_cvo_aws" "Cloud Volumes ONTAP-aws" {
provider = netapp-cloudmanager
name = "Cloud Volumes ONTAPSingleNode"
region = "us-west-2"
subnet_id = "subnet-test"
vpc_id = "vpc-0f46c06a"
aws_tag {
tag_key = "demo"
tag_value = "env1"
}
aws_tag {
tag_key = "conf"
tag_value = "singlenode"
}
svm_password = "Test@1234!"
client_id = netapp-cloudmanager_connector_aws.cm-aws.client_id
writing_speed_state = "NORMAL"
}
The following are the arguments for this code
- name indicates the name of the Cloud Volumes ONTAP environment
- region is the AWS region where the Cloud Volumes ONTAP will be deployed
- subnet_id is the subnet id to which Cloud Volumes ONTAP will be connected
- vpc_id is the ID of the AWS VPC where the Cloud Volumes ONTAP will be created. This is an optional argument. If not provided it will be derived from the provided subnet ID.
- client_id is the ID that can be found from the connector tab in cloudmanager web console or can reference a connector created using Terraform as shown in this example
- svm_password is your Cloud Volumes ONTAP admin password
- aws_tag is the AWS tag key value pair to be added to the deployment
- writing_speed_state defines the write speed setting for Cloud Volumes ONTAP. Values can be either NORMAL or HIGH. It is an optional argument and the default value is NORMAL.
Aggregate
The architecture of Cloud Volumes ONTAP depends on the underlying cloud provider storage disks and groups them into aggregates. The aggregates are then used to provision Cloud Volumes ONTAP storage volumes. Cloud Manager aggregate deployment needs an existing Cloud Volumes ONTAP and Cloud Manager connector as prerequisites.
Sample code for deployment of an aggregate can be found here
CIFS Server
Using Cloud Manager Terraform provider, you can provision a CIFS server resource based on an existing AD or workgroup on a Cloud Volumes ONTAP. It can then be used to create CIFS volumes. It also requires a Cloud Volumes ONTAP and Cloud Manager connector deployed as prerequisites.
Sample code for deployment of CIFS server can be found here
Cloud Volumes ONTAP Storage Volumes
This code can be used to create, update, or delete Cloud Volumes ONTAP volumes. You can create NFS, CIFS, and iSCSI volumes using the provider. Both a Cloud Manager Connector resource and Cloud Volumes ONTAP are prerequisites for this action.
Sample code for provisioning volumes can be found here
NSS Account
Using Terraform provider, you can create or delete NetApp Support Site Account, that can be used to reach out to NetApp support team, access KB articles, and download software.
A sample code for deploying an NSS account can be found here
SnapMirror
You can use NetApp SnapMirror technology to replicate data between different Cloud Volumes ONTAP volumes. Cloud Manager Terraform provider can be leveraged to create new SnapMirror® configuration for Cloud Volumes ONTAP. Doing this requires a Cloud Volumes ONTAP system and a Cloud Manager connector as prerequisites.
Sample code to create new SnapMirror configurations for Cloud Volumes ONTAP can be found here.
Conclusion
NetApp Terraform Cloud provider enables fully supported IAC deployment for Cloud Volumes ONTAP environments in multiple cloud platforms. It can be easily integrated with your existing DevOps tools to build a comprehensive CI/CD solution for your cloud storage deployments. It enhances the agility offered by Cloud Volumes ONTAP to quickly provision and configure storage volumes for your enterprise workloads on demand.
To get started now, sample configuration files for AWS/Azure/GCP are available in the GitHub for NetApp Cloud Manager Terraform Provider.