Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

[Go] Can't deploy a kubernetes cluster #62

Open
scraly opened this issue Aug 9, 2023 · 0 comments
Open

[Go] Can't deploy a kubernetes cluster #62

scraly opened this issue Aug 9, 2023 · 0 comments

Comments

@scraly
Copy link

scraly commented Aug 9, 2023

Hi,

i've tried to find how to create a kubernetes cluster but without any chance :(

My go.mod file:

require (
	github.com/lbrlabs/pulumi-ovh/sdk v0.2.0
	github.com/pulumi/pulumi/sdk/v3 v3.55.0
)

My main.go file:

package main

import (
	ovh "github.com/lbrlabs/pulumi-ovh/sdk/go/ovh"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		serviceName := "xxx"
		if param := cfg.Get("serviceName"); param != "" {
			serviceName = param
		}
		mykube, err := ovh.CloudProject.NewKube(ctx, "mykube", &ovh.CloudProject.KubeArgs{
			ServiceName: pulumi.String(serviceName),
			Name:        pulumi.String("my_desired_cluster"),
			Region:      pulumi.String("GRA5"),
		})
		if err != nil {
			return err
		}

		return nil
	})
}

If I don't follow the documentation and what the IDE tells me, here the new code but even not working code:

package main

import (
	"log"

	ovh "github.com/lbrlabs/pulumi-ovh/sdk/go/ovh"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi/config"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		cfg := config.New(ctx, "")
		serviceName := "xxx"
		if param := cfg.Get("serviceName"); param != "" {
			serviceName = param
		}

		//project := ovh.CloudProject.

		// Deploy a new Kubernetes cluster
		mykube, err := ovh.NewCloudProjectKube(ctx, "mykube", &ovh.CloudProjectKubeArgs{
			ServiceName: pulumi.String(serviceName),
			Name:        pulumi.String("my_desired_cluster"),
			Region:      pulumi.String("GRA5"),
		})
		if err != nil {
			return err
		}

		log.Println(mykube.Name)

		return nil
	})
}

FYI I want to do the same thing like with the cloud_project_kube resource in Terraform OVH provider: https://registry.terraform.io/providers/ovh/ovh/latest/docs/resources/cloud_project_kube

What am I missing?

Moreover, is it possible to add in this provider several useful and working examples, it can help a lot :).

Thanks

@scraly scraly changed the title Can't deploy a kubernetes cluster [Go] Can't deploy a kubernetes cluster Aug 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant