This example shows how to deploy NetApp CVS volumes using terraform (i.e. without using any external modules). This code also enables replication between volumes if replication variable is set as true.
- You must have a recent version of Terraform installed (1.1.6+).
- A working GCP project with billing enabled and the below APIs enabled:
- NetApp Cloud Volumes API
- Service Management API
- Service Networking API
- Service Usage API
- Compute Engine API
- Make sure you have followed this Quickstart before using this Terraform example https://cloud.google.com/architecture/partners/netapp-cloud-volumes/quickstart. This will make sure that all the below prerequisites are met.
- Enable Peering between NetApp and your GCP project. The steps to do this are mentioned in below section.
Run the below commands to establish Network Peering between your project and NetApp Project. You will also get a prompt to run these commands manually when you try to create a volume from the Qwikstart.
export PROJECT_ID=<PROJECT_ID>
export NETWORK=<VPC_NETWORK_NAME>
gcloud --project=$PROJECT_ID compute addresses create \
netapp-addresses-custom-vpc-1 \
--global \
--purpose=VPC_PEERING \
--prefix-length=24 \
--network=$NETWORK \
--no-user-output-enabled
gcloud --project=$PROJECT services vpc-peerings connect \
--service=cloudvolumesgcp-api-network.netapp.com \
--ranges=netapp-addresses-custom-vpc-1 \
--network=$NETWORK \
--no-user-output-enabled
gcloud --project=$PROJECT compute networks peerings update netapp-cv-nw-customer-peer \
--network=$NETWORK \
--import-custom-routes \
--export-custom-routes
Before you deploy, make sure that you modify the below parameters in provider.tf
- bucket - bucket name which stores the terraform state
- project - project number in which you want to deploy the volumes
terraform init
terraform plan
terraform apply
name | description | type | required | default |
---|---|---|---|---|
project_id | Project where resources will be created | string |
✓ | |
allowed_clients | CIDR ranges that can access the NFS volume | string |
✓ | |
region | Default region for resources | string |
us-west2 |
|
service_level | The performance level for your workloads | string |
premium |
|
network_name | Default VPC Network name | string |
✓ |