The VastData Terraform provider is a provider to manage VastData clusters resources.
Table of Contents
- Terraform Provider Vastdata
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
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
In order to build the provider locally you will need to first clone the repo.
$ 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>
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.
In order to build to a differant directory other than build , specify BUILD_DEST=<build directory>
make build BUILD_DEST=some/other/directory
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.
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"
}
The VastData provider supports importing existing resources using various ID formats, including composite keys for resources that require multiple identifiers.
For resources that use a single identifier:
terraform import vastdata_example.my_resource "12345"
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"
This is the recommended import format as it is explicit, order-independent, and allows you to specify only the required fields without needing to know a specific field order.
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
, or0
This section is for backward compatibility with provider version 1.7 only.
A limited set of resources still support the legacy pipe-separated import format for backward compatibility. This format requires all values to be provided in a specific order and is not recommended for new configurations.
Only the following resources support pipe-separated imports:
vastdata_nonlocal_user
:username|context|tenant_id
vastdata_nonlocal_group
:groupname|context|tenant_id
vastdata_view_policy
:name|tenant_name
vastdata_view
:path|tenant_name
# Example: Import a nonlocal user (not recommended - use key=value instead)
terraform import vastdata_nonlocal_user.example "admin|ldap|1"
# Example: Import a view (not recommended - use key=value instead)
terraform import vastdata_view.example "/data/project|tenant1"
terraform import vastdata_user.admin "username=admin,tenant_id=1,domain=local"
terraform import vastdata_quota.project_quota "name=project1,path=/data/project1,tenant_id=5"
terraform import vastdata_network_interface.eth0 "name=eth0,node_id=1"
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
To determine which fields are required for importing a specific resource:
- Check the resource documentation
- Look at the resource's required attributes
- Use
terraform plan
after creating a minimal resource configuration to see required fields - Refer to the VastData API documentation for the underlying resource identifiers
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 [email protected]