NetApp: Importing Spot Resources into Terraform – The Spot by NetApp Blog


More and more DevOps and platform teams are using infrastructure as code to design and implement infrastructure in the cloud. Hashicorp’s Terraform is one of the most popular infrastructures as code tools. It enables you to define the desired state of the infrastructure using code and deploy these changes in your cloud. Spot by NetApp offers comprehensive support for Terraform in Elastigroup and Ocean, our products for cloud infrastructure management. When integrated together, you can use your existing Terraform templates while Spot determines and optimizes cloud infrastructure resources for the best possible mix of compute type, size and lifecycle for the workload.

In previous posts, we discussed how Terraform can help with deployment management, and we went through How to create an ocean cluster with Terraform.If an Ocean Cluster is already running and you are starting to work with Terraform, this tutorial will help you import an Ocean Cluster or other Spot Resource (Elastigroup,virtual node groupetc.) in terraform.

In this tutorial, you will go through the steps to create a cluster from the Ocean UI and manage it with Terraform. By importing from Ocean to Terraform, you will automatically create the status of the resource and have a template to manage it. You can use this method to duplicate ocean environments in Terraform using the template that was created during the import process.

You will also learn how to import ocean into a specific resource. Ocean can also be imported into a specific module. Read more about the different options in the official Terraform documentation:

In advance:

  1. A Spot by NetApp account associated with a cloud provider
  2. Ocean runs in the Spot by NetApp console (or another Spot resource). It doesn’t matter whether the cluster was created through the UI or API.


1. Create a file with the following details:

      1. Spot provider: Here you can find the information you need. By clicking on the “Use provider” button, you will see all the information you should have in order to import the ocean resource:[Link]
      2. Empty resource: Here is an example of an empty resource:

2. Run Terraform init

3. Once the file is ready, use the import command

Here is an example:

4. After the import is complete, you will have a status file for the resource. Next, run the command to get the Terraform template that you want to use.

Please note that you should remove the ID parameter in Ocean in order to be able to use this template to manage your cluster. After the import is complete, you will have a status file for the resource.

You are done! You can now manage the ocean cluster with Terraform. R.You can find more information about the Ocean features at the following link:

Disclaimer of liability

NetApp Inc. published this content on December 16, 2021 and is solely responsible for the information contained therein. Distributed by General, unedited and unchanged, on December 17, 2021 6:08:03 AM UTC.


Comments are closed.