dstackai / dstack

dstack is a lightweight, open-source alternative to Kubernetes & Slurm, simplifying AI container orchestration with multi-cloud & on-prem support. It natively supports NVIDIA, AMD, & TPU.
https://dstack.ai/docs
Mozilla Public License 2.0
1.58k stars 155 forks source link

Implement a terraform provider #1495

Open peterschmidt85 opened 3 months ago

peterschmidt85 commented 3 months ago

Example: https://developer.hashicorp.com/terraform/tutorials/kubernetes/kubernetes-provider

Using terraform will allow to manage multiple configurations at once and reuse the terraform ecosystem.

peterschmidt85 commented 3 months ago

Hi, I am working on this issue and will raise PR soon

@Er-Sadiq Great to hear! If you plan on implementing this, I'd strongly recommend sharing the implementation plan in advance so we can align, ideally with examples.

Also, please note that dstack run is deprecated and dstack apply is used instead. So, I suppose the Terraform provider will build on top of dstack apply. If you have any questions, don't hesitate to write here directly or ping me via Discord.

peterschmidt85 commented 3 months ago

BTW, one more example: https://registry.terraform.io/providers/databricks/databricks/latest/docs

Er-Sadiq commented 2 months ago

@peterschmidt85 Hi , I am really sorry but i have been trying to implement terrafrom,and i have made some progress tho i am unable to finish it up i am stuck ,and confused about a certain things here is how i tried to implement it

func Provider() schema.Provider { return &schema.Provider{ Schema: map[string]schema.Schema{ "server_url": { Type: schema.TypeString, Required: true, Description: "The URL of the dstack server.", }, "api_key": { Type: schema.TypeString, Required: true, Description: "The API key for authenticating with the dstack server.", }, }, ResourcesMap: map[string]*schema.Resource{ // here is where i am going to map resource }, ConfigureFunc: configureProvider, } }

func configureProvider(d *schema.ResourceData) (interface{}, error) { return NewDstackClient( d.Get("server_url").(string), d.Get("api_key").(string), ), nil } and so on i am just confused if this the write direction to go with i have Just a little experience with terrafrom altho i have been trying to learn it ,it is still new for me so i use some directions Thank You !!

easedeath commented 1 month ago

Can I work on this issue?