Skip to main content


Deploy and manage Virtual Servers using Terraform

Virtual Servers are a Kubernetes Custom Resource on CoreWeave Cloud, which means the Kubernetes Terraform provider can be used to create and modify Virtual Servers as Custom Resources.

Getting Started

Before you can access CoreWeave Cloud, you must first request an account.

To use the Terraform module as your deployment method, you will first need to obtain valid access credentials in the form of a kubeconfig file.


See Obtain Access Credentials for more information.

With the Virtual Server module cloned, and all configuration options adjusted to your preferences, a Virtual Server can either be created by running the module directly:

$ terraform init
$ terraform plan
$ terraform apply -auto-approve

Or, if managing a fleet of Virtual Servers, then ideally their outputs can be consumed by new module definitions for each machine, or by other modules.


module "virtualserver_1" {
source = "./coreweave/kubernetes-cloud/tree/master/virtual-server/examples/terraform"
kubeconfig_path = "./kube/config/kubeconfig"
vs_name = "myserver"
vs_username = "myuser"
vs_generate_password = "true"
user_namespace = "mynamespace"

Repeating a single definition for additional machines, then managing each Virtual Server, can be done by using the target option:

$ terraform plan -target=module.virtualserver_1
$ terraform apply -target=module.virtualserver_1 -auto-approve
$ terraform destroy -target=module.virtualserver_1

Once deployed, the status of the new machine can be verified using kubectl:

$ kubectl get vs example-vs

example-vs Initializing Waiting for VirtualMachineInstance to be ready False

The output of this command will include the Service External IP address for accessing the server.

Output variables

As shown in the example above, this module has two output values that can be referenced as attributes by other modules.


Apply complete! Resources: 0 added, 0 changed, 0 destroyed.


vs_network = "[address]"
vs_password = "[password]"

This will include the Service IP address and either the provided password or the one generated by Terraform as vs_network and vs_password, which can be referenced, for example, as outputs:

output "vs_network" {
value = module.virtualserver_1.vs_network

output "vs_password" {
value = module.virtualserver_1.vs_password


CoreWeave provides an example plan on GitHub.

Configuration quick reference

The table below is intended as a quick-reference guide for all available configuration options using the Kubernetes CLI deployment method. Learn more about each configuration option in their respective pages under Virtual Server Configuration Options.

Variable nameTypeDescription
kubeconfig_pathstringThe system path to the kubeconfig file to use
user_namespacestringThe namespace into which the Virtual Server will be deployed. Does not have a default value; must be set
vs_namestringThe hostname for the Virtual Server
vs_usernamestringUsername for the virtual server Does not have a default value; must be set
vs_generate_passwordboolWhen set to true, a strong password is generated
vs_passwordstringWith vs_generate_password set to false, provide a password for vs_username
vs_memorystringMemory requested in Gi (i.e. 16Gi)
vs_root_storagestringThe amount of storage requested for the root volume in Gi (i.e. 80Gi)
vs_os_typestringVirtual Server OS variant (i.e. linux)
vs_imagestringThe name of the OS image to deploy to the Virtual Server
vs_gpustringThe GPU model name for Virtual Server
vs_gpu_enableboolEnables a GPU for this Virtual Server
vs_gpu_countintThe number of GPUs requested
vs_cpu_countintThe number of CPUs requested
vs_regionstringThe data center region in which to deploy the Virtual Server
vs_runningboolStart the Virtual Server once deployed
vs_public_networkingboolEnable public networking
vs_attach_loadbalancerboolAttach a Service Load Balancer IP directly to the Virtual Server (vs_tcp_ports and vs_udp_ports must be empty, if enabled)
vs_tcp_portslistA list of TCP ports to allow access to
vs_udp_portslistA list of UDP ports to allow access to