- Create an API key for the project that will work with Terraform.
- Create and navigate to the directory which will be used to work with Terraform Provider.
- Create and open the provider.tf configuration file.
- Insert the provider information in the file, where is your API key, and save the changes.
- Use template of configuration file:
terraform {
required_providers {
serverspace = {
source = "itglobalcom/serverspace"
version = "0.2.3"
}
}
}
variable "s2_token" {
type = string
default = "<api key>"
}
provider "serverspace" {
key = var.s2_token
}
- Download source code of provider:
git clone https://github.com/itglobalcom/terraform-provider-serverspace.git
- Open the provider's directory:
cd terraform-provider-serverspace
- Run the following command to build the provider
go build -o terraform-provider-serverspace
- Create directory to make it visible to terraform
mkdir -p ~/.terraform.d/plugins/serverspace.local/local/serverspace/0.2.3/linux_amd64
- Copy built provider in the directory
cp terraform-provider-serverspace ~/.terraform.d/plugins/serverspace.local/local/serverspace/0.2.3/linux_amd64
- Use template of configuration file:
terraform {
required_providers {
serverspace = {
source = "serverspace.local/local/serverspace"
version = "0.2.3"
}
}
}
variable "s2_token" {
type = string
default = "<api key>"
}
provider "serverspace" {
key = var.s2_token
}
cd example
terraform init && terraform apply