dstack icon indicating copy to clipboard operation
dstack copied to clipboard

Implement a terraform provider

Open peterschmidt85 opened this issue 1 year ago • 4 comments

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 avatar Aug 04 '24 11:08 peterschmidt85

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 avatar Aug 04 '24 17:08 peterschmidt85

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

peterschmidt85 avatar Aug 22 '24 10:08 peterschmidt85

@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

  • create a dir in src with name provider.go,client.go,and resource_fleet.go with this being
  • package terraform // this is going to be provider.go import ( "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" )

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 !!

Er-Sadiq avatar Aug 31 '24 07:08 Er-Sadiq

Can I work on this issue?

easedeath avatar Oct 12 '24 03:10 easedeath

@peterschmidt85, I suggest we close this issue since it's been open for a long time and it's unlikely there will be any progress any time soon.

r4victor avatar Dec 26 '24 09:12 r4victor