This repository contains the Fluence Cloudless VMs Terraform Provider.
- SSH Key Management: Create, read, update, and delete SSH keys
- Virtual Machine Management: Full CRUD operations for VMs with advanced configuration options
- State Management: Robust state management with retry logic for eventual consistency
fluence_ssh_key- Manage SSH keys for VM accessfluence_vm- Manage virtual machines with full configuration options
fluence_ssh_keys- List all SSH keys in your accountfluence_vms- List all virtual machines in your accountfluence_basic_configurations- Get available VM configurationsfluence_available_countries- Get available datacenter countriesfluence_available_hardware- Get available hardware options
- Terraform >= 1.0
- Go >= 1.23
- Fluence API key (get one at console.fluence.network)
-
Set your API key:
export FLUENCE_API_KEY="your-api-key-here"
-
Create a basic configuration:
terraform { required_providers { fluence = { source = "hashicorp.com/decentralized-infrastructure/fluence" } } } provider "fluence" { # API key from environment variable FLUENCE_API_KEY } # Create an SSH key resource "fluence_ssh_key" "example" { name = "my-key" # Replace with your actual public key associated with a private key you control public_key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKgJIjnDg1DjqOOxINs78oU3f7PJXIyq9uiNocNVhXNx user@example.com" } # Create a VM resource "fluence_vm" "example" { name = "my-vm" os_image = "https://cloud-images.ubuntu.com/releases/22.04/release/ubuntu-22.04-server-cloudimg-amd64.img" ssh_keys = [fluence_ssh_key.example.fingerprint] open_ports = [{ port = 22 protocol = "tcp" }] instances = 1 basic_configuration = "small" }
-
Deploy:
terraform init terraform plan terraform apply
See the examples/ directory for comprehensive usage examples.
- Clone the repository
- Enter the repository directory
- Build the provider:
go build -o terraform-provider-fluenceThis provider uses Go modules.
To add a new dependency:
go get github.com/author/dependency
go mod tidyIf you wish to work on the provider, you'll first need Go installed on your machine.
To compile the provider, run go build. This will build the provider and put the provider binary in the current directory.
For development testing, you can use a .terraformrc file to override the provider location:
provider_installation {
dev_overrides {
"hashicorp.com/decentralized-infrastructure/fluence" = "/path/to/your/go/bin"
}
direct {}
}In order to generate documentation for the provider, the following command can be run:
go get github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs