Skip to content

coredgeio/terraform-provider-vastdata

 
 

Repository files navigation

Terraform Provider Vastdata

CI Release License: Apache2 Go Report Card Coverage Status Go Reference Terraform Registry Latest Release

The VastData Terraform provider is a provider to manage VastData clusters resources.

Table of Contents

Configuring Provider to be downloaded from Terraform Registry

In order to configure the provider to be used directly from Terraform registry, use the following provider defenition.

terraform {
  required_providers {
    vastdata = {
      source = "vast-data/vastdata"
    }
  }
}

Now when running terraform init it will download the VastData provider from the Terraform Registry

Building The Provider Directly From Github

In order to build the provider you can simpy use go install

$ go install github.com/vast-data/terraform-provider-vastdata

To install a specfic tag/branch version use the following syntax

$ go install github.com/vast-data/terraform-provider-vastdata@<branch/tag>

Check you go GOBIN path for the compiled file named terraform-provider-vastdata

Building The Provider Locally

In order to build the provider locally you will need to first clone the repo.

Cloning The Source Code

$ git clone https://github.com/vast-data/terraform-provider-vastdata.git
$ cd terraform-provider-vastdata

If you wish to checkout a specific tag check out the tag.

$ git checkout <tag name>

Building The Code Locally

In order to build the code locally you need to have GNU Make installed

To build the code ru the following command

make build

This will build the provider binary with the name terraform-provider-vastdata directly into the build directory.

Building Into A Differant directory

In order to build to a differant directory other than build , specify BUILD_DEST=<build directory>

	make build BUILD_DEST=some/other/directory

Using Local Copy Using dev_overrides

dev_overrides is a terraform configuration that will allow to overrides any other method of obtaining the terrafrom plugin binary and forces terrafrom to obtain the provider binary from a specific path locally.

Edit ~/.terraformrc file

This file is being scanned every time you run terrafrom if you dont want to create/edit it you can specify the environment vasriable TF_CLI_CONFIG_FILE=path/to/configuration/file

add the following configurations to the configuration file.

provider_installation {
  dev_overrides {
    "vastdata/vastdata" = "/some/directory/where/the/binary/is/stored"
  }
  direct {}
} 

When creating a terrafrom configration specify the following at the file

terraform {
  required_providers {
    vastdata = {
      source  = "vastdata/vastdata"
    }
  }
}

Now you can define providers.

provider vastdata {
username = "<username>"
port = <port>
password = "<password>"
host = "<address>"
skip_ssl_verify = true
version_validation_mode = "warn"
}

Importing Existing Resources

The VastData provider supports importing existing resources using various ID formats, including composite keys for resources that require multiple identifiers.

Import Formats

1. Simple ID Import

For resources that use a single identifier:

terraform import vastdata_example.my_resource "12345"

2. Key-Value Pairs Import

For resources requiring multiple fields, use key=value format with comma or semicolon separators:

# Using comma separator
terraform import vastdata_example.my_resource "gid=1001,tenant_id=22,context=ad"

# Using semicolon separator  
terraform import vastdata_example.my_resource "gid=1001;tenant_id=22;context=ad"

3. Ordered Values Import (Pipe-separated)

For resources with predefined import field order, use pipe-separated values:

terraform import vastdata_example.my_resource "1001|22|ad"

Import Field Types

The provider automatically handles type conversion for imported values:

  • String fields: Values are imported as-is
  • Integer fields: Numeric strings are converted to integers
  • Boolean fields: Accepts true, false, 1, or 0

Examples

Import a User with Multiple Identifiers

# Key-value format
terraform import vastdata_user.admin "username=admin,tenant_id=1,domain=local"

# Ordered format (if resource supports it)
terraform import vastdata_user.admin "admin|1|local"

Import a Quota with Composite Key

terraform import vastdata_quota.project_quota "name=project1,path=/data/project1,tenant_id=5"

Import a Network Interface

terraform import vastdata_network_interface.eth0 "name=eth0,node_id=1"

Troubleshooting Import

Error: "field 'x' is not present in the resource schema"

  • Ensure the field name matches exactly what's defined in the resource schema
  • Check the resource documentation for correct field names

Error: "expected X values for fields [...], got Y"

  • When using pipe-separated format, ensure the number of values matches the expected import fields
  • Use key=value format instead if you need to specify only some fields

Error: "invalid int64 for field 'x'"

  • Ensure numeric fields contain valid integer values
  • Check for extra spaces or non-numeric characters

Finding Import Fields

To determine which fields are required for importing a specific resource:

  1. Check the resource documentation
  2. Look at the resource's required attributes
  3. Use terraform plan after creating a minimal resource configuration to see required fields
  4. Refer to the VastData API documentation for the underlying resource identifiers

Submitting Bugs/Feature Requests

While it is common to submit Bugs/Feature Requests using github issues, we would rather if you open a Bug/Feature Request to Vast Data support at customer.support@vastdata.com

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 59.4%
  • Python 26.6%
  • HCL 11.4%
  • Makefile 1.4%
  • Shell 1.1%
  • Dockerfile 0.1%