Manage Ocean GKE Virtual Node Groups using Terraform


Spot by NetApp allows its users to manage their application infrastructure using a variety of provisioning tools. One of these tools is Terraform,
an infrastructure as code (IaC) tool that allows users to build, change, and version infrastructure safely and efficiently. Spot by NetApp solutions supports multiple Terraform resources, such as Elastigroup, EMR Mr scaler, Managed Instance, and Ocean clusters for different cloud providers, and many more.

One of the resources is Virtual Node Group (VNG) in an Ocean GKE cluster. VNG’s (previously known as Launch Specifications) provide a single layer of abstraction that allows users to manage different types of workloads in the same cluster. 

Managing Ocean VNGs

Users can manage their VNG’s using Terraform with the spotinst_ocean_gke_launch_spec resource. Before this new resource was available, users could create VNGs from imported node pools using spotinst_ocean_gke_launch_spec_import resource. Now, we’ve enhanced this to allow users to import or add new fields via Terraform. This resource enables users to
manage the VNG with two different approaches:

  1. Import node pool from GKE.
    The user is required to fill the ocean_id  and node_pool_name fields. Terraform will import all node pool fields and metadata from the node pool. Users can change the imported fields by specifying new values during the creation or after it. This capability (to do not have to specify required values) is achieved by creating these fields as computed. Which enables the Terraform to create the resource with these fields without having to specify them in the template at the time of the plan/apply. In addition, the users can obviously set fields that are relevant for Ocean VNG only, like strategy and autoscale_headrooms.

  2. Create VNG from scratch.
    The user is required to set all required fields in order to create new Ocean VNG, including the cluster’s metadata.
Example VNG creation via Terraform.

Note: the spotinst_ocean_gke_launch_spec_import is not deprecated but we highly recommend that users switch to the spotinst_ocean_gke_launch_spec resource.

To learn more about Ocean, visit our documentation.